:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-card-hover: rgba(26, 34, 54, 0.85);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --accent-cyan: #06b6d4;
    --accent-pink: #e11d48;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-purple: #8b5cf6;
    
    --font-main: 'Outfit', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header Navbar */
.app-header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-card-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-icon {
    font-size: 28px;
    background: rgba(225, 29, 72, 0.15);
    border: 1px solid rgba(225, 29, 72, 0.3);
    padding: 6px 10px;
    border-radius: 12px;
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.brand-text p {
    font-size: 12px;
    color: var(--text-muted);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--accent-green);
    font-weight: 500;
}

.status-pill.storage {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
}

.status-dot.pulsing {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.clock {
    font-family: var(--font-code);
    font-size: 14px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 8px;
}

/* Dashboard Main Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    flex: 1;
    height: calc(100vh - 65px);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: rgba(15, 23, 42, 0.5);
    border-right: 1px solid var(--bg-card-border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.badge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.store-search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    outline: none;
}

.store-search-box input:focus {
    border-color: var(--accent-cyan);
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.store-item {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.store-item:hover, .store-item.selected {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    transform: translateX(2px);
}

.store-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
}

.store-item-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Main Content Area */
.main-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.metrics-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    padding: 16px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-card.cyan { border-top: 3px solid var(--accent-cyan); }
.metric-card.green { border-top: 3px solid var(--accent-green); }
.metric-card.yellow { border-top: 3px solid var(--accent-yellow); }
.metric-card.purple { border-top: 3px solid var(--accent-purple); }

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.card-value {
    font-size: 26px;
    font-weight: 700;
    margin: 8px 0 4px 0;
    color: #fff;
}

.card-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

.trend.positive { color: var(--accent-green); }
.trend.warning { color: var(--accent-yellow); }

/* View Tabs */
.view-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--bg-card-border);
    padding-bottom: 10px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover, .tab-btn.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    color: #fff;
}

/* Tab Panels */
.tab-panel {
    display: none;
    flex-direction: column;
    gap: 20px;
}

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

/* Live Camera Viewports (4 Cameras Per Page Layout) */
.camera-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--bg-card-border);
    padding: 10px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
}

.pagination-btn {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid var(--accent-cyan);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.1);
}

.pagination-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.camera-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.camera-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cam-header {
    background: rgba(15, 23, 42, 0.8);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.cam-mode-buttons {
    display: flex;
    gap: 6px;
}

.cam-mode-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cam-mode-btn.active, .cam-mode-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
    color: #fff;
}

.cam-badge.live {
    background: rgba(225, 29, 72, 0.2);
    color: var(--accent-pink);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
}

.cam-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cam-viewport img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cam-overlay-info {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-family: var(--font-code);
    color: #00ffcc;
}

/* Glass Card & Charts */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    padding: 20px;
    border-radius: 16px;
}

.chart-split-container {
    display: flex;
    gap: 16px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.chart-wrapper {
    position: relative;
    height: 260px;
    margin-top: 14px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 12px;
}

.data-table th {
    text-align: left;
    color: var(--text-muted);
    padding: 8px;
    border-bottom: 1px solid var(--bg-card-border);
}

.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Tub Inventory Grid (16-24 Tubs) */
.tub-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.tub-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-card-border);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tub-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
}

.tub-fill-bar-bg {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.tub-fill-bar-fg {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.tub-fill-bar-fg.green { background: var(--accent-green); }
.tub-fill-bar-fg.yellow { background: var(--accent-yellow); }
.tub-fill-bar-fg.red { background: var(--accent-pink); }

/* Alerts Right Panel */
.alerts-sidebar {
    background: rgba(15, 23, 42, 0.5);
    border-left: 1px solid var(--bg-card-border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-count-badge {
    background: var(--accent-pink);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.alerts-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.alert-card {
    background: rgba(225, 29, 72, 0.08);
    border: 1px solid rgba(225, 29, 72, 0.3);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.alert-card.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-title-bar {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
}

.alert-msg {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-resolve {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
}

.btn-resolve:hover {
    background: var(--accent-green);
}

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

/* Big Screen Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 30, 0.92);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.big-screen-card {
    background: var(--bg-card);
    border: 1px solid var(--accent-cyan);
    border-radius: 16px;
    width: 92vw;
    height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(6, 182, 212, 0.35);
}

.modal-header {
    background: rgba(15, 23, 42, 0.95);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg-card-border);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin: 0;
}

.modal-close-btn {
    background: rgba(225, 29, 72, 0.2);
    border: 1px solid var(--accent-pink);
    color: #fff;
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--accent-pink);
    color: #fff;
    box-shadow: 0 0 12px rgba(225, 29, 72, 0.5);
}

.modal-body {
    flex: 1;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.modal-footer {
    background: rgba(15, 23, 42, 0.95);
    padding: 12px 24px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--bg-card-border);
}

.cam-location-badge {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 6px;
}
