@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --bg-color: #F4F7FB;
    --card-bg: #FFFFFF;
    --primary: #2563EB;
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --border: rgba(37, 99, 235, 0.08);
    --shadow: 0 10px 30px rgba(15, 41, 94, 0.06);
    --shadow-hover: 0 12px 40px rgba(15, 41, 94, 0.1);
    --success: #10B981;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

h1, h2, h3, h4, .metric-value, .brand-name {
    font-family: 'Outfit', sans-serif;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    z-index: 100;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.logo {
    height: 32px;
}
.brand-name {
    font-size: 22px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    color: var(--success);
    font-weight: 600;
    font-size: 13px;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 25px 40px 60px 40px;
    min-height: calc(100vh - 65px);
    box-sizing: border-box;
}

/* Hero Section */
.hero-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.camera-tabs {
    display: flex;
    gap: 10px;
}
.cam-tab {
    padding: 10px 24px;
    border: none;
    background: #E2E8F0;
    color: var(--text-muted);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}
.cam-tab.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(37,99,235,0.3);
}

.video-wrapper {
    flex-grow: 1;
    background: #000;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 8px solid white;
}
#videoStream {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#overlayCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: auto;
    z-index: 10;
}
#overlayCanvas.calibrating {
    cursor: crosshair;
}
.camera-status {
    position: absolute;
    color: white;
    text-align: center;
    opacity: 0.8;
}
.camera-status img {
    width: 50px;
    margin-bottom: 10px;
}

.slider-wrapper {
    background: white;
    padding: 15px 25px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}
.slider-label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}
input[type="range"] {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #E2E8F0;
    border-radius: 3px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.slider-value {
    font-weight: 700;
    color: var(--primary);
    width: 40px;
    text-align: right;
}

/* Metrics Panel */
.metrics-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}
.metric-card {
    background: white;
    border-radius: 24px;
    padding: 25px;
    box-shadow: var(--shadow);
}
.primary-gradient {
    background: var(--primary-gradient);
    color: white;
}
.metric-header {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 15px;
}
.text-dark { color: var(--text-dark); }
.text-white { color: white; }
.text-white-50 { color: rgba(255,255,255,0.7); }

.metric-value {
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}
.metric-sub {
    font-size: 15px;
    font-weight: 500;
}
.metric-divider {
    height: 1px;
    background: rgba(255,255,255,0.2);
    margin: 20px 0;
}
.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
}

/* Circular Charts */
.circular-charts {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
}
.chart-container {
    width: 100px;
    text-align: center;
}
.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 80%;
    max-height: 250px;
}
.circle-bg {
    fill: none;
    stroke: #E2E8F0;
    stroke-width: 2.5;
}
.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-out;
}
.circular-chart.blue .circle {
    stroke: var(--primary);
}
.percentage {
    fill: var(--text-dark);
    font-family: 'Outfit', sans-serif;
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
}
.chart-label {
    margin-top: 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
}

/* Activity Timeline */
.log-card {
    min-height: 250px;
    display: flex;
    flex-direction: column;
}
.timeline-container {
    max-height: 250px;
    overflow-y: auto;
    padding-left: 10px;
}
.timeline-container::-webkit-scrollbar { width: 4px; }
.timeline-container::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }

.timeline {
    list-style: none;
    padding: 0; margin: 0;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 6px;
    width: 2px;
    background: #E2E8F0;
}
.timeline li {
    position: relative;
    padding-left: 25px;
    padding-bottom: 20px;
    animation: slideIn 0.3s ease-out forwards;
}
.timeline li::before {
    content: '';
    position: absolute;
    left: 0; top: 4px;
    width: 10px; height: 10px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline li .timestamp {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}
.timeline li .label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}
.timeline li .confidence {
    color: var(--primary);
    font-weight: 700;
    margin-left: 5px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.error-banner {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    background: var(--danger);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    z-index: 1000;
}

/* Restroom Occupancy Hero Card */
.restroom-card {
    border: 2px solid #E2E8F0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.restroom-card.occupied {
    background: linear-gradient(135deg, #FFF1F2 0%, #FFE4E6 100%);
    border-color: #F43F5E;
    box-shadow: 0 10px 25px rgba(244, 63, 94, 0.18);
}
.restroom-card.free {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-color: #22C55E;
    box-shadow: 0 10px 25px rgba(34, 197, 94, 0.15);
}
.restroom-live-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #E2E8F0;
    color: #475569;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.restroom-card.occupied .restroom-live-badge {
    background: #FFE4E6;
    color: #BE123C;
}
.restroom-card.free .restroom-live-badge {
    background: #DCFCE7;
    color: #15803D;
}
.restroom-state-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 6px 0;
}
.restroom-status-icon {
    font-size: 32px;
    line-height: 1;
}
.restroom-status-text {
    font-size: 28px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}
.restroom-card.occupied .restroom-status-text {
    color: #BE123C;
}
.restroom-card.free .restroom-status-text {
    color: #15803D;
}
.restroom-time {
    font-size: 14px;
    font-weight: 600;
    color: #64748B;
    margin-bottom: 14px;
}
.restroom-actions {
    display: flex;
    gap: 10px;
}
.restroom-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}
.restroom-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.free-btn:hover {
    background: #22C55E;
    border-color: #22C55E;
    color: white;
}
.occ-btn:hover {
    background: #F43F5E;
    border-color: #F43F5E;
    color: white;
}

/* Door Box Calibration Tool */
.calibration-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(100, 116, 139, 0.25);
}
.calibrate-toggle-btn {
    width: 100%;
    padding: 10px 14px;
    background: #0284C7;
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}
.calibrate-toggle-btn:hover {
    background: #0369A1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.calibrate-toggle-btn.active {
    background: #DC2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}
.calibration-panel {
    margin-top: 10px;
    background: rgba(2, 132, 199, 0.07);
    border: 1.5px solid #38BDF8;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeInCal 0.2s ease;
}
@keyframes fadeInCal {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.cal-tip {
    font-size: 12px;
    color: #0369A1;
    line-height: 1.45;
    font-weight: 500;
}
.cal-actions {
    display: flex;
    gap: 8px;
}
.cal-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.cal-btn-save {
    background: #10B981;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.cal-btn-save:hover {
    background: #059669;
    transform: translateY(-1px);
}
.cal-btn-reset {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #CBD5E1;
}
.cal-btn-reset:hover {
    background: #E2E8F0;
}
.cal-btn-cancel {
    background: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FCA5A5;
}
.cal-btn-cancel:hover {
    background: #FECACA;
}
.toast-notice {
    position: fixed;
    top: 24px;
    right: 24px;
    background: #065F46;
    color: #FFFFFF;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
}
.toast-notice.show {
    transform: translateY(0);
    opacity: 1;
}


