/* ==========================================================================
   DESIGN SYSTEM & VARIABLES (Clean White & Blue Theme)
   ========================================================================== */
:root {
    /* Color Palette */
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff6ff;
    --color-primary-text: #1e3a8a;
    
    --color-text-main: #0f172a;
    --color-text-muted: #475569;
    --color-text-light: #94a3b8;
    
    /* Semantic Colors */
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-success-text: #065f46;
    
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-text: #92400e;
    
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-danger-text: #991b1b;
    --color-danger-hover: #dc2626;

    /* Shadows & Border Radii */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-circle: 50%;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

/* Utility hide class */
.hide {
    display: none !important;
}

/* ==========================================================================
   AUTHENTICATION OVERLAYS
   ========================================================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-bg);
    z-index: 9999;
    display: block; /* Disable flexbox centering overflow clipping bug */
    overflow-y: auto;
    padding: 40px 20px;
}

.auth-card {
    background-color: var(--color-surface);
    padding: 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px; /* Synchronized max-width for both forms */
    border: 1px solid var(--color-border);
    animation: fadeIn 0.4s ease;
    margin: 0 auto; /* Standard safe centering without negative coordinates */
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.auth-logo svg {
    width: 28px;
    height: 28px;
}

.auth-brand h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-main);
    letter-spacing: -0.02em;
}

.auth-brand p {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-switch-text {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 12px;
}

.auth-switch-text a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch-text a:hover {
    text-decoration: underline;
}

.nip-generation-notice {
    background-color: var(--color-primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--color-primary-text);
    line-height: 1.4;
}

.info-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Registration Face ID styling */
.reg-face-box {
    margin-top: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px;
    background-color: var(--color-bg);
}

.reg-webcam-wrapper {
    width: 130px;
    height: 130px;
    border-radius: var(--radius-circle);
    overflow: hidden;
    border: 2px solid var(--color-border);
    background-color: #0f172a;
    margin: 10px auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reg-webcam-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.reg-webcam-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.reg-webcam-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.reg-face-status-pending {
    font-size: 0.75rem;
    color: var(--color-danger);
    font-weight: 600;
    text-align: center;
    margin-top: 6px;
}

.reg-face-status-success {
    font-size: 0.75rem;
    color: var(--color-success);
    font-weight: 600;
    text-align: center;
    margin-top: 6px;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.brand-logo svg {
    width: 24px;
    height: 24px;
}

.brand-name h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-main);
}

.brand-name span {
    font-size: 0.75rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-align: left;
    transition: var(--transition-fast);
    width: 100%;
}

.nav-item:hover {
    background-color: var(--color-bg);
    color: var(--color-text-main);
}

.nav-item.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
}

.avatar {
    width: 44px;
    height: 44px;
    background-color: #f1f5f9;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    flex-shrink: 0;
    border: 2px solid var(--color-border);
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-circle);
    object-fit: cover;
}

.avatar svg {
    width: 20px;
    height: 20px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.profile-id {
    font-size: 0.72rem;
    color: var(--color-text-light);
}

.profile-role {
    font-size: 0.65rem;
    color: var(--color-primary);
    font-weight: 700;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-logout {
    border-color: var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    padding: 8px 16px;
}

.btn-logout:hover {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.mobile-logout-container {
    display: none !important;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--color-bg);
}

.top-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-main);
    margin-bottom: 6px;
}

.page-title p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.live-clock-card {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#live-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

#live-time {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.tab-content-wrapper {
    padding: 30px 40px;
    flex-grow: 1;
    overflow-y: auto;
}

/* ==========================================================================
   TAB PANEL & CARDS
   ========================================================================== */
.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-main);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.badge-privacy {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.badge-privacy svg {
    width: 12px;
    height: 12px;
}

/* ==========================================================================
   TERMINAL TAB (CAMERA & GEOFENCING)
   ========================================================================== */
.terminal-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 30px;
    align-items: start;
}

/* 2-Step view indicators */
.step-indicator-wrapper {
    display: flex;
    gap: 8px;
}

.step-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background-color: var(--color-bg);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    transition: var(--transition-fast);
}

.step-badge.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-color: rgba(37, 99, 235, 0.2);
}

.step-badge.completed {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
}

/* Camera Card Specifics */
.camera-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.camera-viewport-container {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.camera-outer-ring {
    width: 290px;
    height: 290px;
    border-radius: var(--radius-circle);
    border: 3px dashed var(--color-border);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.camera-outer-ring.scanning {
    border-color: var(--color-primary);
    animation: ringRotate 20s linear infinite;
}

.camera-outer-ring.success {
    border-color: var(--color-success);
    border-style: solid;
}

.camera-outer-ring.failed {
    border-color: var(--color-danger);
    border-style: solid;
}

@keyframes ringRotate {
    100% { transform: rotate(360deg); }
}

.camera-viewfinder {
    width: 260px;
    height: 260px;
    border-radius: var(--radius-circle);
    overflow: hidden;
    position: relative;
    background-color: #1e293b;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* LANDSCAPE PANORAMA CAMERA FRAME OVERRIDES */
.camera-outer-ring.pano-frame {
    width: 340px !important;
    height: 200px !important;
    border-radius: var(--radius-lg) !important;
    padding: 8px !important;
    border-style: solid !important;
    animation: none !important;
}

.camera-outer-ring.pano-frame .camera-viewfinder {
    width: 320px !important;
    height: 180px !important;
    border-radius: var(--radius-md) !important;
    animation: none !important;
}

.camera-outer-ring.pano-frame .scan-guide {
    width: 320px !important;
    border-radius: 0 !important;
    animation: none !important; /* Hide laser sweep in panorama mode */
    display: none !important;
}

/* 3-POINT PANORAMA VISUAL GUIDES Overlay */
.pano-dots-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 82%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through if needed, though they are targeted via buttons */
}

.pano-dots-guide::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    border-top: 2px dashed rgba(255, 255, 255, 0.5);
    z-index: -1;
    transform: translateY(-50%);
}

.pano-dot-target {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: rgba(15, 23, 42, 0.82);
    border: 2.5px solid rgba(255, 255, 255, 0.7);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
}

.pano-dot-target.completed {
    background-color: var(--color-success) !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    transform: scale(1.15);
    box-shadow: 0 0 16px var(--color-success);
}

.pano-reticle {
    position: absolute;
    top: 50%;
    left: 50%; /* Controlled via JS */
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-circle);
    border: 3px solid var(--color-primary);
    background-color: rgba(37, 99, 235, 0.2);
    z-index: 12;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5), inset 0 0 8px rgba(37, 99, 235, 0.3);
    transition: left 0.1s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.pano-reticle::before,
.pano-reticle::after {
    content: "";
    position: absolute;
    background-color: var(--color-primary);
}

/* Horizontal crosshair */
.pano-reticle::before {
    width: 16px;
    height: 2px;
}

/* Vertical crosshair */
.pano-reticle::after {
    width: 2px;
    height: 16px;
}

/* Blinking target to guide alignment */
.pano-dot-target.active-target {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 15px var(--color-primary);
    animation: activeTargetGlow 1.2s infinite alternate ease-in-out;
}

@keyframes activeTargetGlow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 4px var(--color-primary);
    }
    100% {
        transform: scale(1.1);
        box-shadow: 0 0 16px var(--color-primary);
    }
}


/* Stop video rotation during scanning */
.camera-outer-ring.scanning .camera-viewfinder {
    animation: counterRotate 20s linear infinite;
}
@keyframes counterRotate {
    100% { transform: rotate(-360deg); }
}

.camera-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera view */
}

.camera-viewfinder canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.camera-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-light);
    gap: 12px;
    text-align: center;
    padding: 20px;
    background-color: #0f172a;
}

.camera-fallback svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.camera-fallback p {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Scanner laser animation */
.scan-guide {
    position: absolute;
    width: 260px;
    height: 2px;
    background: linear-gradient(90deg, rgba(37,99,235,0) 0%, rgba(37,99,235,1) 50%, rgba(37,99,235,0) 100%);
    box-shadow: 0 0 10px var(--color-primary);
    top: 25px;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    border-radius: 50%;
}

.camera-outer-ring.scanning .scan-guide {
    animation: scannerMotion 2.5s ease-in-out infinite;
    opacity: 1;
}

@keyframes scannerMotion {
    0%, 100% { top: 25px; }
    50% { top: 265px; }
}

.verification-controls {
    width: 100%;
    margin-top: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-circle);
    flex-shrink: 0;
}

.pulse-gray { background-color: var(--color-text-light); }
.pulse-blue { background-color: var(--color-primary); animation: pulseDot 1.5s infinite; }
.status-dot.success { background-color: var(--color-success); }
.status-dot.danger { background-color: var(--color-danger); }

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

.status-text {
    color: var(--color-text-muted);
    font-weight: 500;
}

.status-text.success { color: var(--color-success-text); font-weight: 600; }
.status-text.danger { color: var(--color-danger-text); font-weight: 600; }

/* Validation Cards */
.details-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.validation-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 8px;
}

.validation-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.validation-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.status-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.status-icon svg {
    width: 18px;
    height: 18px;
}

.icon-pending {
    background-color: var(--color-bg);
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
}

.icon-success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid transparent;
}

.icon-danger {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid transparent;
}

.icon-warning {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid transparent;
}

.validation-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.validation-info p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.coordinates-preview {
    font-family: monospace;
    font-size: 0.72rem;
    background-color: var(--color-bg);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-text-light);
    display: inline-block;
    margin-top: 4px;
}

.warning-alert-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-warning-text);
    margin-top: 2px;
}

.danger-alert-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-danger-text);
    margin-top: 2px;
}

/* Action card Buttons */
.action-buttons-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 15px;
}

.alert-box {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    transition: var(--transition-normal);
}

.alert-box.success {
    background-color: var(--color-success-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-success-text);
}

.alert-box.danger {
    background-color: var(--color-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-danger-text);
}

/* ==========================================================================
   DASHBOARD TAB (STATS & LOGS)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.icon-blue { background-color: var(--color-primary-light); color: var(--color-primary); }
.icon-green { background-color: var(--color-success-bg); color: var(--color-success); }
.icon-orange { background-color: var(--color-warning-bg); color: var(--color-warning); }
.icon-red { background-color: var(--color-danger-bg); color: var(--color-danger); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text-main);
    letter-spacing: -0.01em;
}

/* Logs Table Section */
.logs-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.table th {
    background-color: var(--color-bg);
    color: var(--color-text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-main);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: #fafafa;
}

/* Table statuses badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
}

.status-pill.present { background-color: var(--color-success-bg); color: var(--color-success-text); }
.status-pill.late { background-color: var(--color-warning-bg); color: var(--color-warning-text); }
.status-pill.early { background-color: var(--color-primary-light); color: var(--color-primary-text); }
.status-pill.absent { background-color: var(--color-danger-bg); color: var(--color-danger-text); }
.status-pill.weekend { background-color: #f1f5f9; color: var(--color-text-muted); }
.status-pill.sick { background-color: #f5f3ff; color: #6d28d9; }
.status-pill.permit { background-color: #ecfeff; color: #0891b2; }
.status-pill.leave { background-color: #f0fdf4; color: #16a34a; }

/* Inline View Photo Button */
.btn-view-photo {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid rgba(37, 99, 235, 0.15);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-view-photo:hover {
    background-color: var(--color-primary);
    color: #ffffff;
}

.font-monospace {
    font-family: monospace;
}

/* ==========================================================================
   PHOTO AUDIT MODAL OVERLAY
   ========================================================================== */
.photo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.photo-modal-card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 580px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.photo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
}

.photo-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--color-text-light);
    line-height: 1;
}

.btn-close-modal:hover {
    color: var(--color-text-main);
}

.photo-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.photo-modal-frame {
    width: 180px;
    height: 180px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 3px solid var(--color-border);
    background-color: #0f172a;
    box-shadow: var(--shadow-sm);
}

.photo-modal-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-modal-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    background-color: var(--color-bg);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.photo-modal-details p {
    color: var(--color-text-muted);
}

.photo-modal-details strong {
    color: var(--color-text-main);
}

/* ==========================================================================
   ADMIN / CONFIGURATION TAB
   ========================================================================== */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.col-6 {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.form-control {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text-main);
    transition: var(--transition-fast);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-select {
    font-family: inherit;
    font-size: 0.82rem;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text-main);
    outline: none;
    cursor: pointer;
}

.form-helper {
    font-size: 0.72rem;
    color: var(--color-text-light);
    line-height: 1.3;
}

.admin-danger-actions {
    display: flex;
    gap: 16px;
    margin-top: 15px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-primary:disabled {
    background-color: var(--color-border);
    color: var(--color-text-light);
    cursor: not-allowed;
}

.btn-outline {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary-light);
}

.btn-outline:disabled {
    border-color: var(--color-border);
    color: var(--color-text-light);
    cursor: not-allowed;
}

.btn-outline:disabled:hover {
    background: none;
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: var(--color-danger-hover);
}

.card-danger {
    border-color: rgba(239, 68, 68, 0.2);
    background-color: #fffafb;
}

.btn-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
}

.text-center {
    text-align: center;
}

/* Responsive elements */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        background-color: var(--color-surface);
    }
    
    .brand {
        margin-bottom: 0 !important;
        gap: 0;
        display: flex;
        align-items: center;
        justify-content: flex-start !important;
        margin-right: auto !important;
    }
    
    .brand-logo {
        display: none !important;
    }
    
    .brand-name h2 {
        font-size: 0.85rem;
        line-height: 1.25;
        max-width: 200px;
        white-space: normal;
        font-weight: 800;
        color: var(--color-primary);
        text-transform: uppercase;
        letter-spacing: 0.02em;
        text-align: left !important;
    }
    
    .brand-name span {
        display: none !important;
    }
    
    .sidebar .btn-logout {
        display: none !important;
    }
    
    .mobile-logout-container {
        display: block !important;
        margin-top: 24px;
        border-top: 1px solid var(--color-border);
        padding-top: 20px;
    }
    
    /* FLOATING BOTTOM GLASSMORPHISM NAV BAR */
    .nav-menu {
        position: fixed;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: 440px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.25);
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
        border-radius: 40px;
        padding: 6px 12px;
        z-index: 9999;
        display: flex;
        flex-direction: row !important;
        justify-content: space-around;
        align-items: center;
        gap: 4px;
        margin-top: 0 !important;
    }
    
    .nav-menu::-webkit-scrollbar {
        display: none;
    }
    
    .nav-item {
        width: auto;
        background: none;
        border: none;
        padding: 10px !important;
        border-radius: 50% !important;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--color-text-muted);
        transition: var(--transition-normal);
    }
    
    .nav-item span {
        display: none !important; /* Hide labels, icons only */
    }
    
    .nav-item .nav-icon {
        width: 22px;
        height: 22px;
        margin: 0 !important;
    }
    
    .nav-item.active {
        background-color: var(--color-primary-light) !important;
        color: var(--color-primary) !important;
        transform: scale(1.15);
    }
    
    .user-profile-summary {
        display: none;
    }
    
    .terminal-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    /* Top content header adjustments on mobile */
    .top-header {
        padding: 12px 16px !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 12px !important;
    }
    
    .page-title h1 {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
    }
    
    .page-title p {
        display: none !important;
    }
    
    .live-clock-card {
        text-align: right !important;
        flex-direction: row !important;
        gap: 8px !important;
        align-items: center !important;
    }
    
    #live-date, #live-time {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
    }
    
    /* Avoid floating nav cover content */
    .main-content {
        padding-bottom: 90px !important;
    }
}

/* ==========================================================================
   PASSWORD ACCESSIBILITY (TOGGLE VIEW)
   ========================================================================== */
.password-input-container {
    position: relative;
    width: 100%;
}

.password-input-container .form-control {
    padding-right: 44px; /* Space for the eye button */
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    z-index: 5;
    transition: var(--transition-fast);
}

.btn-toggle-password:hover {
    color: var(--color-text-muted);
}

.btn-toggle-password svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS OVERRIDES
   ========================================================================== */
@media (max-width: 768px) {
    .top-header {
        padding: 16px 20px;
    }
    
    .tab-content-wrapper {
        padding: 16px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .photo-modal-card {
        width: 92%;
    }
}

@media (max-width: 520px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .dual-photo-grid {
        grid-template-columns: 1fr !important; /* Stack photos vertically for visibility in small screens */
        gap: 16px;
    }
    
    .photo-modal-frame {
        width: 100%;
        max-width: 240px;
        height: 160px;
        margin: 0 auto;
    }
    
    .photo-modal-body {
        padding: 16px;
    }
}

/* ==========================================================================
   AUTH ERROR BANNER & SHAKE ANIMATION
   ========================================================================== */
.auth-error-banner {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.auth-error-banner svg {
    color: var(--color-danger);
    width: 16px;
    height: 16px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.4s ease;
}

/* Danger Button Styling */
.btn-danger {
    background-color: var(--color-danger-text) !important;
    color: white !important;
    border: none !important;
    transition: var(--transition-fast);
}

.btn-danger:hover {
    background-color: var(--color-danger-hover) !important;
}
