/* app.css — Arcade Hub Web Dashboard
   Forked from device-manager-web/css/app.css with amber/gold accent (#f59e0b) */

/* =========================================================
   Layout: Fixed sidebar + scrollable main content
   ========================================================= */

body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #1a1d23;
    color: #c9cdd4;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

#sidebar .sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#sidebar .sidebar-brand h5 {
    color: #fff;
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

#sidebar .sidebar-brand .brand-icon {
    color: #f59e0b;
    font-size: 1.4rem;
}

/* Nav links */
#sidebar .nav-link {
    color: #9ba3af;
    padding: 0.65rem 1.5rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    transition: color 0.15s, background 0.15s;
}

#sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

#sidebar .nav-link.active {
    color: #fff;
    background: rgba(245, 158, 11, 0.18);
    border-left: 3px solid #f59e0b;
}

#sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Sidebar footer */
#sidebar .sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.82rem;
    color: #6b7280;
}

#sidebar .sidebar-footer .user-name {
    color: #c9cdd4;
    font-weight: 600;
}

/* =========================================================
   Main content area
   ========================================================= */

#main-content {
    margin-left: 240px;
    padding: 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e2328;
    margin: 0;
}

.page-header .subtitle {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* =========================================================
   Stat cards
   ========================================================= */

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #1e2328;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: #6b7280;
    margin-top: 0.2rem;
}

/* Icon background colours — amber accent */
.icon-amber  { background: rgba(245,158,11,0.12); color: #f59e0b; }
.icon-green  { background: rgba(34,197,94,0.12);  color: #22c55e; }
.icon-yellow { background: rgba(234,179,8,0.12);  color: #eab308; }
.icon-red    { background: rgba(239,68,68,0.12);  color: #ef4444; }

/* =========================================================
   Charts + card containers
   ========================================================= */

.card-custom {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    padding: 1.5rem;
}

.card-custom .card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e2328;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =========================================================
   Machine table
   ========================================================= */

.table-custom thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    white-space: nowrap;
}

.table-custom tbody tr:hover {
    background: #fffbeb;
}

/* =========================================================
   Heartbeat freshness indicators
   ========================================================= */

.heartbeat-indicator {
    font-size: 0.85rem;
    font-weight: 500;
}

.heartbeat-indicator.fresh {
    color: #22c55e;
}

.heartbeat-indicator.stale {
    color: #f59e0b;
}

.heartbeat-indicator.dead {
    color: #ef4444;
}

/* =========================================================
   WebSocket connection status
   ========================================================= */

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.connection-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 4px rgba(34,197,94,0.5);
}

.connection-dot.disconnected {
    background: #ef4444;
    box-shadow: 0 0 4px rgba(239,68,68,0.5);
}

/* =========================================================
   Live event feed
   ========================================================= */

.event-feed {
    max-height: 480px;
    overflow-y: auto;
}

.event-item {
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.event-item:last-child {
    border-bottom: none;
}

.event-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.event-machine {
    font-weight: 500;
    color: #1e2328;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-time {
    color: #9ba3af;
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: auto;
}

.event-value {
    font-weight: 600;
    color: #22c55e;
    white-space: nowrap;
}

/* =========================================================
   Toolbar
   ========================================================= */

.toolbar {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    margin-bottom: 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* =========================================================
   Login page
   ========================================================= */

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .brand-icon {
    font-size: 3rem;
    color: #f59e0b;
    display: block;
    margin-bottom: 0.5rem;
}

.login-brand h2 {
    font-weight: 700;
    color: #1e2328;
    margin: 0;
}

.login-brand p {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

/* =========================================================
   Pagination
   ========================================================= */

.pagination .page-link {
    color: #f59e0b;
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

/* =========================================================
   Toast container
   ========================================================= */

#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

/* =========================================================
   Responsive: collapse sidebar on small screens
   ========================================================= */

@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
        padding: 1rem;
    }

    #hamburger {
        display: flex !important;
    }
}

#hamburger {
    display: none;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}

#sidebar-overlay.show {
    display: block;
}

/* =========================================================
   Utility
   ========================================================= */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #9ba3af;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.2rem;
    }

    #main-content {
        padding: 0.75rem;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}
