@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #8B5CF6; /* Violet */
    --primary-glow: rgba(139, 92, 246, 0.3);
    --secondary: #06B6D4; /* Cyan */
    --accent: #F43F5E; /* Rose */
    --bg-dark: #020617;
    --card-glass: rgba(15, 23, 42, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
    --success: #10B981;
    --warning: #F59E0B;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 35%),
        radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.1) 0%, transparent 35%);
    background-attachment: fixed;
    /* WebView native feel */
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Background Atmosphere */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.glow-orb {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.4;
    animation: orbFloat 20s infinite alternate;
}

@keyframes orbFloat {
    from { transform: translate(-20%, -20%) scale(1); }
    to { transform: translate(20%, 20%) scale(1.2); }
}

.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    position: relative;
    padding-bottom: calc(110px + var(--safe-area-bottom));
}

@media (max-width: 400px) {
    .app-container {
        padding: 1rem;
    }
}

/* Glassmorphism Card */
.glass-card {
    background: var(--card-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

/* Header & Identity */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #FFF 30%, #CBD5E1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (min-width: 480px) {
    .brand h1 { font-size: 1.5rem; }
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    padding: 3px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    position: relative;
    cursor: pointer;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    background: var(--bg-dark);
    object-fit: cover;
}

/* Biometric Scanner UI */
#clock-display {
    font-size: 2.8rem !important;
}

@media (min-width: 380px) {
    #clock-display { font-size: 3.5rem !important; }
}

.scanner-container {
    position: relative;
    width: 100%;
    height: 420px; /* Fixed height for 6.5" phone stability */
    border-radius: 35px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto 1.5rem;
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.7),
        inset 0 0 120px rgba(0, 0, 0, 1);
}

#video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transform: scaleX(-1) !important;
    filter: contrast(1.05) brightness(1.05);
    z-index: 1;
}

.photo-review {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 12;
    display: none;
    filter: brightness(1.1) contrast(1.1);
    animation: reviewEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes reviewEntrance {
    from { opacity: 0; transform: scale(1.1); }
    to { opacity: 1; transform: scale(1); }
}

.scanner-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0.8) 100%);
    z-index: 5;
    pointer-events: none;
}

.scanner-corners {
    position: absolute;
    inset: 20px;
    z-index: 10;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.5s ease;
}

.corner.top-left { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 16px 0 0 0; }
.corner.top-right { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.corner.bottom-left { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.corner.bottom-right { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 16px 0; }

.scanner-container.capturing .corner {
    border-color: var(--secondary);
    width: 50px;
    height: 50px;
    border-width: 3px;
    filter: drop-shadow(0 0 10px var(--secondary));
    animation: cornerPulse 2s infinite ease-in-out;
}

@keyframes cornerPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.98); }
}

.scanner-status {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    display: flex;
    justify-content: space-between;
    z-index: 15;
    pointer-events: none;
}

.status-item {
    font-size: 0.65rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.1em;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.scanner-container.capturing .status-item {
    color: var(--secondary);
    border-color: rgba(6, 182, 212, 0.3);
}

.pulsing {
    animation: textPulse 1.5s infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.scanner-frame {
    position: absolute;
    inset: 30px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 35px;
    z-index: 6;
    pointer-events: none;
    transition: all 0.5s ease;
}

.scanner-container.capturing .scanner-frame {
    border-color: rgba(6, 182, 212, 0.3);
    inset: 25px;
    border-style: solid;
}

.scanner-info-tags {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    z-index: 15;
    pointer-events: none;
    font-family: monospace;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.05em;
}

.laser-line {
    position: absolute;
    width: calc(100% - 60px);
    left: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--secondary), transparent);
    box-shadow: 0 0 15px var(--secondary), 0 0 30px rgba(6, 182, 212, 0.5);
    z-index: 20;
    animation: laserMove 3s infinite ease-in-out;
    display: none;
    opacity: 0;
}

@keyframes laserMove {
    0% { top: 30px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: calc(100% - 30px); opacity: 0; }
}

/* Face Silhouette Guide */
.face-guide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 11;
    pointer-events: none;
    transition: var(--transition);
}

.face-guide svg {
    width: 80%;
    height: 80%;
    color: var(--secondary);
    opacity: 0.4;
    filter: drop-shadow(0 0 15px var(--secondary));
    animation: guidePulse 3s infinite ease-in-out;
}

.guide-text {
    position: absolute;
    bottom: 25%;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: 0.15em;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 100px;
    border: 1px solid rgba(6, 182, 212, 0.2);
    text-transform: uppercase;
}

@keyframes guidePulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

/* Shutter Effect */
.shutter {
    position: absolute;
    inset: 0;
    background: #FFF;
    opacity: 0;
    z-index: 20;
    pointer-events: none;
}

.shutter.active {
    animation: shutterFlash 0.3s ease-out;
}

@keyframes shutterFlash {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* Action Buttons & Forms */
select.btn-glow {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d=' Brave 19 9l-7 7-7-7' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.5rem center;
    background-size: 1rem;
    padding-right: 3.5rem !important;
    cursor: pointer;
    line-height: 1.2;
}

select.btn-glow option {
    background: #0F172A;
    color: #FFF;
    padding: 1rem;
}

input.btn-glow, select.btn-glow {
    transition: var(--transition);
    outline: none;
}

input.btn-glow:focus, select.btn-glow:focus {
    border-color: var(--primary) !important;
    background: rgba(139, 92, 246, 0.08) !important;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.btn-glow {
    position: relative;
    width: 100%;
    height: 68px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 12px 28px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    opacity: 0;
    transition: 0.3s;
}

.btn-glow:hover::after { opacity: 1; }
.btn-glow:active { transform: scale(0.97); }

/* Status Widgets */
.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.widget {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1.25rem;
}

.widget-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

.widget-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFF;
}

/* Bottom Nav - Neo Futuristic */
.dock-nav {
    position: fixed;
    bottom: var(--safe-area-bottom);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2.5rem);
    max-width: 400px;
    height: 72px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* History Page Bottom Nav - Legacy support but same style */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.75rem 1rem calc(0.75rem + var(--safe-area-bottom));
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--card-border);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
}

.nav-item i { font-size: 1.25rem; }
.nav-item.active { color: var(--primary); }

.dock-item {
    text-decoration: none;
    color: var(--text-secondary);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border-radius: 14px;
    transition: var(--transition);
}

.dock-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 16px var(--primary-glow);
}

/* Attendance Log Premium */
.log-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: 24px;
    background: rgba(255,255,255,0.02);
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,0.03);
}

.log-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
}

/* Admin Specific Overrides */
.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}


.mobile-admin-header {
    display: none;
    padding: 1rem 1.5rem;
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

@media (max-width: 992px) {
    .mobile-admin-header { display: flex; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.sidebar-overlay.active { display: block; }

.admin-sidebar {
    background: #020617;
    border-right: 1px solid var(--card-border);
    padding: 2.5rem 1.5rem;
    border-radius: 0;
    margin: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    display: block;
}

.admin-nav {
    list-style: none;
    margin-top: 3rem;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

.admin-nav a.active, .admin-nav a:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.data-table {
    width: 100%;
    border-spacing: 0 0.75rem;
    border-collapse: separate;
}

.data-table th {
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: left;
}

.data-table tr td {
    background: var(--card-glass);
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

.data-table tr td:first-child { border-left: 1px solid var(--card-border); border-radius: 20px 0 0 20px; }
.data-table tr td:last-child { border-right: 1px solid var(--card-border); border-radius: 0 20px 20px 0; }

/* Admin Modernization & Responsiveness */
.admin-main {
    padding: 1.25rem !important;
    background: rgba(0,0,0,0.2);
}

@media (min-width: 993px) {
    .admin-main {
        padding: 3rem !important;
    }
}

.admin-header h2 {
    font-size: 1.5rem !important;
}

@media (min-width: 480px) {
    .admin-header h2 { font-size: 2.2rem !important; }
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Responsive Overrides - High Priority */
@media (max-width: 992px) {
    .admin-shell { 
        display: block !important; 
    }
    .admin-sidebar { 
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        bottom: 0 !important;
        z-index: 10000 !important;
        width: 280px !important;
        background: #020617 !important;
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        display: block !important;
        transform: none !important;
        border-radius: 0 !important;
    }
    .admin-sidebar.active {
        left: 0 !important;
        box-shadow: 20px 0 60px rgba(0,0,0,0.8) !important;
    }
    .admin-main { 
        padding: 1.25rem !important; 
        width: 100% !important;
    }
    .mobile-admin-header { 
        display: flex !important; 
    }
    .sidebar-overlay.active { 
        display: block !important; 
    }
}

/* Fix for large numbers in stats on mobile */
@media (max-width: 480px) {
    h3 { font-size: 2.2rem !important; }
    .glass-card { padding: 1.5rem; }
}
/* Modern Neural Toast System */
.neural-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    width: calc(100% - 3rem);
    max-width: 400px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 99999;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

.neural-toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFF;
    line-height: 1.4;
}

.toast-success .toast-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.toast-error .toast-icon { background: rgba(244, 63, 94, 0.1); color: var(--accent); }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

/* Premium Alert Modal */
.neural-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.neural-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.neural-modal {
    width: 100%;
    max-width: 360px;
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
}

.neural-modal-overlay.active .neural-modal {
    transform: scale(1) translateY(0);
}

.modal-glow {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 100px;
    background: var(--primary);
    filter: blur(60px);
    opacity: 0.3;
    pointer-events: none;
}

.modal-icon {
    width: 80px;
    height: 80px;
    border-radius: 28px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.modal-body h2 {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    margin-bottom: 0.75rem;
}

.modal-body p {
    font-size: 1rem;
    font-weight: 600;
    color: #FFF;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-btn {
    width: 100%;
    height: 60px;
    border-radius: 18px;
    border: none;
    background: var(--primary);
    color: #FFF;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.modal-btn:active {
    transform: scale(0.96);
}
