/* ============================================
   Master Control - PWA Styles
   Rudra EduGurus Platform
   ============================================ */

:root {
    /* Primary brand colours */
    --primary: #6C63FF;
    --primary-dark: #4F46E5;
    --primary-light: #AEA7FF;
    --primary-glow: rgba(108, 99, 255, 0.3);
    
    /* Secondary accents */
    --secondary: #EF5DA8;
    --secondary-dark: #E11D48;
    --secondary-muted: #FF9F9F;
    
    /* Surface and background layers */
    --surface: #F7F7FB;
    --surface-muted: #E8E7F2;
    --surface-dark: #1B1340;
    --surface-elevated: #FFFFFF;
    
    /* Text colours */
    --text-primary: #1F1B3D;
    --text-secondary: #514F6E;
    --text-muted: #8F8DA5;
    
    /* Supporting colours */
    --teal: #0EA5E9;
    --emerald: #10B981;
    --amber: #F59E0B;
    
    /* Status colours */
    --success: #34D399;
    --warning: #FBBF24;
    --danger: #EF4444;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6C63FF 0%, #EF5DA8 100%);
    --gradient-dark: linear-gradient(135deg, #1B1340 0%, #2D1F5E 100%);
    --gradient-surface: linear-gradient(180deg, #F7F7FB 0%, #FFFFFF 30%);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(31, 27, 61, 0.06);
    --shadow-md: 0 4px 16px rgba(31, 27, 61, 0.1);
    --shadow-lg: 0 8px 32px rgba(31, 27, 61, 0.15);
    --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.2);
    
    /* Spacing */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);
    
    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--surface);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Screen Management */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    background: var(--surface);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   Splash Screen
   ============================================ */
#splash-screen {
    background: var(--gradient-dark);
    justify-content: center;
    align-items: center;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    width: 140px;
    height: 140px;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.splash-logo .app-logo {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 32px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), 0 0 60px rgba(108, 99, 255, 0.3);
}

.splash-icon {
    width: 140px;
    height: 140px;
    margin: 0 auto 32px;
    background: var(--gradient-primary);
    border-radius: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    animation: pulse 2s ease-in-out infinite;
}

.splash-icon .material-icons-round {
    font-size: 72px;
    color: white;
}

.splash-title {
    font-size: 36px;
    font-weight: 700;
    color: white;
    margin-bottom: 48px;
    letter-spacing: -0.5px;
}

.splash-loader {
    display: flex;
    justify-content: center;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: var(--shadow-glow); }
    50% { transform: scale(1.02); box-shadow: 0 0 60px rgba(108, 99, 255, 0.35); }
}

/* ============================================
   Login Screen
   ============================================ */
#login-screen {
    background: var(--gradient-dark);
    justify-content: center;
    align-items: center;
    padding: 24px;
    padding-top: calc(24px + var(--safe-area-top));
    padding-bottom: calc(24px + var(--safe-area-bottom));
}

.login-container {
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-header {
    margin-bottom: 48px;
}

.login-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo .app-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 40px rgba(108, 99, 255, 0.3);
}

.login-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    background: var(--gradient-primary);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.login-icon .material-icons-round {
    font-size: 52px;
    color: white;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.login-header p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
}

/* PIN Section */
.pin-section {
    margin-bottom: 32px;
}

.pin-section.hidden {
    display: none;
}

.pin-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
}

.pin-info .material-icons-round {
    font-size: 24px;
    color: var(--primary-light);
}

.pin-info p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-fast);
}

.pin-dot.filled {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(108, 99, 255, 0.5);
}

.pin-dot.error {
    background: var(--danger);
    border-color: var(--danger);
    animation: shake 0.4s ease;
}

.pin-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 8px;
}

/* Biometric Button */
.biometric-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 24px;
    margin-bottom: 16px;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--gradient-primary);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-glow);
}

.biometric-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.biometric-btn .material-icons-round {
    font-size: 28px;
}

.biometric-btn.hidden {
    display: none;
}

/* Or Divider */
.or-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 16px;
}

.or-divider.hidden {
    display: none;
}

/* Link Device Section */
.link-device-info {
    text-align: center;
    margin-bottom: 24px;
}

.link-device-info .material-icons-round {
    font-size: 48px;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.link-device-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.link-device-info p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.verification-input-container {
    margin-bottom: 20px;
}

.verification-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.08);
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: white;
    text-align: center;
    letter-spacing: 2px;
    transition: all var(--transition-fast);
}

.verification-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
}

.verification-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: normal;
}

.verify-btn {
    margin-bottom: 16px;
}

#link-device-section.hidden {
    display: none;
}

/* PIN Pad */
.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
}

.pin-key {
    aspect-ratio: 1;
    width: 100%;
    max-width: 80px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-key:active {
    background: var(--primary);
    transform: scale(0.95);
}

.pin-key.empty {
    background: transparent;
    pointer-events: none;
}

.pin-key.delete {
    background: rgba(239, 68, 68, 0.15);
}

.pin-key.delete:active {
    background: var(--danger);
}

.pin-key .material-icons-round {
    font-size: 24px;
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-md);
    color: #FCA5A5;
    font-size: 14px;
}

.error-message.hidden {
    display: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* ============================================
   Dashboard Screen
   ============================================ */
#dashboard-screen {
    background: var(--gradient-surface);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: calc(16px + var(--safe-area-top));
    background: rgba(247, 247, 251, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(232, 231, 242, 0.5);
}

.app-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--surface-muted);
}

.icon-btn:active {
    transform: scale(0.95);
}

.dashboard-content {
    padding: 16px 20px;
    padding-bottom: calc(40px + var(--safe-area-bottom));
}

/* Section Styles */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Cards Container */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Control Card */
.control-card,
.lock-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.control-card:hover,
.lock-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: rgba(108, 99, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon .material-icons-round {
    font-size: 28px;
    color: var(--primary);
}

.lock-icon {
    background: rgba(251, 191, 36, 0.1);
}

.lock-icon .material-icons-round {
    color: var(--warning);
}

.lock-card.locked .lock-icon {
    background: rgba(239, 68, 68, 0.1);
}

.lock-card.locked .lock-icon .material-icons-round {
    color: var(--danger);
}

.lock-card.locked {
    border: 2px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.1);
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-content .status {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
}

.card-content .status.active {
    color: var(--danger);
}

.lock-status.locked {
    color: var(--danger);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--surface-muted);
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch.danger input:checked + .toggle-slider {
    background: var(--danger);
}

/* Admin Management Card */
.admin-management-card {
    padding: 24px;
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.admin-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.admin-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: rgba(239, 93, 168, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-card-icon .material-icons-round {
    font-size: 28px;
    color: var(--secondary);
}

.admin-card-info h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.admin-card-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Buttons */
.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--secondary);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.primary-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.primary-btn .material-icons-round {
    font-size: 20px;
}

.primary-btn.danger {
    background: var(--danger);
}

.outline-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--surface-muted);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.outline-btn:active {
    transform: scale(0.98);
}

.outline-btn.danger {
    border-color: var(--danger);
    color: var(--danger);
}

.outline-btn .material-icons-round {
    font-size: 18px;
}

/* Device Link Card */
.device-link-card {
    padding: 24px;
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--surface-muted);
}

.device-link-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.device-link-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: rgba(14, 165, 233, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.device-link-icon .material-icons-round {
    font-size: 28px;
    color: var(--teal);
}

.device-link-info h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.device-link-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.verification-code-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.code-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.code-value {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.code-value.hidden-code {
    color: var(--text-muted);
}

.code-copy-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.code-copy-btn:hover {
    background: var(--primary-dark);
}

.code-copy-btn:active {
    transform: scale(0.95);
}

.code-copy-btn .material-icons-round {
    font-size: 20px;
}

.device-link-actions {
    display: flex;
    gap: 12px;
}

.device-link-actions .outline-btn {
    flex: 1;
}

/* Danger Section */
.danger-section {
    margin-top: 24px;
}

.danger-card {
    padding: 24px;
    background: var(--surface-elevated);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-xl);
}

.danger-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.danger-header .material-icons-round {
    font-size: 24px;
    color: var(--danger);
}

.danger-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.danger-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.danger-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ============================================
   Admin Screen
   ============================================ */
#admin-screen {
    background: var(--gradient-surface);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-content {
    padding: 16px 20px;
    padding-bottom: calc(40px + var(--safe-area-bottom));
}

.admin-header-info {
    margin-bottom: 24px;
}

.admin-header-info h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.admin-header-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Admin Card */
.admin-card {
    padding: 20px;
    background: var(--surface-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-muted);
    box-shadow: var(--shadow-sm);
}

.admin-card.disabled {
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.admin-card-top {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(108, 99, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-avatar .material-icons-round {
    font-size: 24px;
    color: var(--primary);
}

.admin-card.disabled .admin-avatar {
    background: rgba(239, 68, 68, 0.1);
}

.admin-card.disabled .admin-avatar .material-icons-round {
    color: var(--danger);
}

.admin-info {
    flex: 1;
    min-width: 0;
}

.admin-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-info h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.disabled-badge {
    display: inline-flex;
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
}

.admin-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.admin-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--surface-muted);
    border-radius: var(--radius-md);
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.admin-action-btn .material-icons-round {
    font-size: 18px;
}

.admin-action-btn.edit {
    color: var(--primary);
    border-color: var(--primary);
}

.admin-action-btn.reset {
    color: var(--warning);
    border-color: var(--warning);
}

.admin-action-btn.toggle {
    color: var(--warning);
    border-color: var(--warning);
}

.admin-action-btn.toggle.enable {
    color: var(--success);
    border-color: var(--success);
}

.admin-action-btn.delete {
    color: var(--danger);
    border-color: var(--danger);
}

.admin-action-btn:active {
    transform: scale(0.97);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
}

.empty-state.hidden {
    display: none;
}

.empty-state .material-icons-round {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state span {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(27, 19, 64, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface-elevated);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    padding-bottom: calc(24px + var(--safe-area-bottom));
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--surface-muted);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

/* Confirm Modal */
.confirm-modal-content {
    text-align: center;
    padding: 32px 24px;
    padding-bottom: calc(32px + var(--safe-area-bottom));
}

.confirm-modal-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.confirm-modal-content p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

/* ============================================
   Toast
   ============================================ */
#toast-container {
    position: fixed;
    bottom: calc(24px + var(--safe-area-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 40px);
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-dark);
    border-radius: var(--radius-lg);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

.toast.success {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
}

.toast.error {
    background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
}

.toast .material-icons-round {
    font-size: 20px;
    flex-shrink: 0;
}

@keyframes toastIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* ============================================
   Loading Overlay
   ============================================ */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(27, 19, 64, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   Desktop Enhancements
   ============================================ */
@media (min-width: 768px) {
    .login-container {
        max-width: 400px;
    }
    
    .pin-key {
        max-width: 72px;
    }
    
    .pin-key:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .dashboard-content,
    .admin-content {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .modal-content {
        border-radius: var(--radius-xl);
        margin: auto;
        max-height: 85vh;
    }
    
    .confirm-modal-content {
        padding-bottom: 32px;
    }
}

@media (min-width: 1024px) {
    .dashboard-content,
    .admin-content {
        max-width: 700px;
    }
    
    .cards-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Dark Mode Support (System Preference)
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --surface: #0F0A1F;
        --surface-muted: #1F1840;
        --surface-elevated: #18122E;
        --text-primary: #F3F2F7;
        --text-secondary: #A5A3B8;
        --text-muted: #6B698B;
    }
    
    #dashboard-screen,
    #admin-screen {
        background: var(--surface);
    }
    
    .app-header {
        background: rgba(15, 10, 31, 0.85);
        border-bottom-color: rgba(31, 24, 64, 0.8);
    }
    
    .control-card,
    .lock-card,
    .admin-management-card,
    .admin-card,
    .danger-card {
        background: var(--surface-elevated);
    }
    
    .toggle-slider {
        background: var(--surface-muted);
    }
    
    .form-group input {
        background: var(--surface);
        border-color: var(--surface-muted);
    }
    
    .modal-content {
        background: var(--surface-elevated);
    }
    
    .modal-close {
        background: var(--surface);
    }
}

