:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--bg-body);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 40px;
}

/* ---- Layout ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-container {
    max-width: 800px;
    /* Focus view */
}

/* ---- Header & Nav ---- */
.user-bar {
    background: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 20px;
}

.navbar-branding {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 20px;
    border-right: 1px solid var(--border);
}

.nav-logo {
    height: 32px;
    width: auto;
}

.nav-system-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    white-space: nowrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
}

.user-info i {
    font-size: 1.2rem;
    color: var(--primary);
}

.badge-admin {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Top Nav Links */
.top-nav {
    display: flex;
    gap: 5px;
    background: var(--input-bg);
    padding: 4px;
    border-radius: 30px;
    margin: 0 auto;
}

.top-nav-link {
    text-decoration: none;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-nav-link:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
}

.top-nav-link.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
}

.user-info i {
    font-size: 1.2rem;
    color: var(--primary);
}

.badge-admin {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.action-link:hover {
    color: var(--primary);
}

.logout-btn {
    color: var(--danger);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.logout-btn:hover {
    opacity: 0.8;
}

/* ---- Hero Section (Clock) ---- */
.hero-section {
    text-align: center;
    margin: 30px 0 40px;
}

.clock-display {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    color: white;
    line-height: 1;
}

#clock {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -2px;
    color: white;
}

.seconds {
    font-size: 2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.date-display {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 500;
}

/* ---- Scan Card ---- */
.scan-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid white;
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
}

.scan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
}

/* Zone Tabs (Modern) */
.zone-tabs-modern {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: var(--input-bg);
    padding: 5px;
    border-radius: var(--radius-lg);
}

.zone-tab {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.zone-tab input {
    opacity: 0;
    position: absolute;
}

.tab-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.zone-tab input:checked+.tab-content {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: scale(1.02);
}

/* Inputs */
.scan-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modern-select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1.1rem;
    background: white;
    color: var(--text);
    cursor: pointer;
    transition: border 0.2s;
    outline: none;
}

.modern-select:focus {
    border-color: var(--primary);
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.modern-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1.2rem;
    outline: none;
    transition: all 0.2s;
    font-family: 'JetBrains Mono', 'Sarabun';
}

.modern-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.scan-btn {
    width: 60px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.scan-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.scan-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* ---- Timeline (Recent) ---- */
.recent-section {
    margin-top: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.section-header h2 {
    font-size: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-refresh {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.3s;
}

.btn-refresh:hover {
    color: var(--primary);
    transform: rotate(180deg);
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-card {
    background: white;
    padding: 15px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.timeline-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.color-out {
    background: var(--warning-light);
    color: var(--warning);
}

.color-in {
    background: var(--success-light);
    color: var(--success);
}

.card-info {
    flex: 1;
}

.card-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.dept-badge {
    font-size: 0.75rem;
    background: var(--input-bg);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

.status-text {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.card-time {
    text-align: right;
}

.time-big {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.duration-small {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 2px;
}

/* ---- Popup Modal ---- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.popup-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.popup-box {
    background: white;
    width: 90%;
    max-width: 340px;
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border);
}

.popup-overlay.visible .popup-box {
    transform: scale(1);
}

.popup-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.popup-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.popup-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.popup-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text);
}

.popup-details {
    text-align: left;
    background: var(--bg-body);
    padding: 20px;
    border-radius: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row.name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    justify-content: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 8px;
}

.detail-row .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.status-pill {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.scan-type {
    font-weight: 700;
}

.scan-type.in {
    color: var(--success);
}

.scan-type.out {
    color: var(--warning);
}

/* New Status Colors */
.scan-text-up {
    color: var(--success) !important;
}

.scan-text-down {
    color: var(--danger) !important;
}

.cooldown-timer {
    font-size: 3rem;
    font-weight: 700;
    color: var(--warning);
    font-family: 'JetBrains Mono';
    margin-top: 10px;
}

/* ---- Report Page Buttons (Legacy Support) ---- */
.zone-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.zone-btn {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.zone-btn:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.zone-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* ---- Report Page Headers & Tables (Keep existing or update) ---- */
.header h1 {
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.nav-link {
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: white;
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.filter-section {
    background: white;
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

/* Responsive */
@media (max-width: 600px) {
    #clock {
        font-size: 4rem;
    }

    .scan-card {
        padding: 20px;
    }

    .zone-tabs-modern {
        flex-direction: column;
        gap: 5px;
    }

    .tab-content {
        justify-content: flex-start;
        padding: 10px 15px;
    }

    .nav-links {
        flex-direction: column;
        align-items: center;
    }

    .nav-link {
        width: 100%;
        text-align: center;
    }
}

/* --- New Dashboard Styles (Added) --- */
.dashboard-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.action-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.clock-card {
    background: #ef4444;
    /* Bright Red */
    border: 6px solid #b91c1c;
    /* Darker Red Border */
    color: white;
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}

.clock-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    filter: blur(40px);
}

#clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.seconds {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    opacity: 0.8;
}

.date-display {
    margin-top: 10px;
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.9);
}

.scan-wrapper {
    background: var(--card-bg, white);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* Tabs */
.zone-tabs-modern {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: var(--bg-body);
    padding: 6px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.zone-tab {
    cursor: pointer;
    position: relative;
}

.zone-tab input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.tab-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tab-content i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.zone-tab input:checked+.tab-content {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

/* Inputs */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.modern-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: white;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

.modern-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 16px;
    font-size: 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}

.modern-select:focus,
.modern-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.scan-btn {
    padding: 0 24px;
    background: var(--text);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.scan-btn:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

/* Timeline */
.timeline-panel {
    background: var(--card-bg, white);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    height: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: 20px;
}

.timeline-list::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 27px;
    width: 2px;
    background: var(--border);
    z-index: 0;
}

.timeline-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.timeline-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--border);
    margin-top: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px white;
}

.timeline-item.in .timeline-icon {
    border-color: var(--success);
}

.timeline-item.out .timeline-icon {
    border-color: var(--warning);
}

.timeline-content {
    flex: 1;
    background: var(--bg-body);
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 2px;
}

.t-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.t-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.t-time {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.t-details {
    display: flex;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.badge-dept {
    background: #e2e8f0;
    color: #475569;
}

.badge-status {
    background: #e0e7ff;
    color: #4338ca;
}

.status-pill.in {
    color: var(--success);
    font-weight: 700;
    font-size: 0.75rem;
}

.status-pill.out {
    color: var(--warning);
    font-weight: 700;
    font-size: 0.75rem;
}

/* Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.popup-box {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-overlay.visible .popup-box {
    transform: scale(1);
}

.success-animation {
    width: 80px;
    height: 80px;
    background: var(--success-light);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 20px;
}

.popup-info-grid {
    text-align: left;
    background: var(--bg-body);
    padding: 20px;
    border-radius: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.info-val {
    font-weight: 600;
    color: var(--text);
}

.info-val.time {
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary);
    font-size: 1.1rem;
}

/* Animations */
@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulseIcon {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.popup-overlay.visible .popup-box {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 1;
}

.popup-overlay.visible .success-animation {
    animation: pulseIcon 1.5s infinite;
}

#errorPopup .success-animation {
    animation: none;
}

#errorPopup.visible .popup-box {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, shake 0.5s ease-in-out 0.4s;
}

/* Popup Animations */
@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulseIcon {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Enhanced Popup Styles */
.popup-box {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-overlay.visible .popup-box {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 1;
}

.success-animation {
    width: 80px;
    height: 80px;
    background: var(--success-light);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 20px;
}

.popup-overlay.visible .success-animation {
    animation: pulseIcon 1.5s infinite;
}

/* Error specific animation adjustment */
#errorPopup .success-animation {
    background: #fee2e2;
    color: #ef4444;
    animation: none;
    /* Reset distinct animation if needed, or keep pulse with red shadow */
}

#errorPopup.visible .popup-box {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Scan Status Pills Distinction */
.status-pill.scan-up {
    color: var(--success);
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 6px;
}

.status-pill.scan-down {
    color: #ea580c;
    /* Orange-600 */
    background: #ffedd5;
    /* Orange-100 */
    border: 1px solid #fed7aa;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 6px;
}