/* ============================================================
   Base Reset & Global Styles
   ============================================================ */

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

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* Focus ring — accent-colored, replaces browser default */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

/* ============================================================
   View Transitions
   ============================================================ */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: viewFadeIn 150ms var(--ease-out);
}

@keyframes viewFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   Status Dot (shared component)
   ============================================================ */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-green {
    background: var(--status-green);
}

.status-dot.status-amber {
    background: var(--status-amber);
}

.status-dot.status-red {
    background: var(--status-red);
}

.status-dot.status-pending {
    background: var(--status-pending);
}

.status-dot-inline {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    vertical-align: middle;
}

.status-dot-inline.status-green {
    background: var(--status-green);
}

.status-dot-inline.status-red {
    background: var(--status-red);
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state p {
    font-size: 13px;
    margin-bottom: var(--space-sm);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .info-row { grid-template-columns: 1fr; }
    .wg-info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .main { padding: var(--space-md); }
    .stats-row { grid-template-columns: 1fr 1fr; gap: var(--space-md); }
    .page-title { font-size: 18px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
    .settings-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .wg-info-grid { grid-template-columns: 1fr; }
    .chart-legend { flex-wrap: wrap; gap: var(--space-sm); }
    .card { padding: var(--space-md); }
    .card-value { font-size: 22px; }

    /* Responsive tables — horizontal scroll with shadow indicators */
    .table-responsive-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(-1 * var(--space-md));
        padding: 0 var(--space-md);
    }
    .table-responsive-wrap table {
        min-width: 600px;
    }

    /* Gateway detail */
    .gw-detail-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
    .gw-detail-title-row { flex-wrap: wrap; }

    /* Actions cell — stack buttons on small screens */
    .actions-cell { gap: 2px; }
    .actions-cell .btn-sm { padding: 4px 6px; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; gap: var(--space-sm); }
    .main { padding: var(--space-sm); }
    .page-title { font-size: 16px; }
    .card { padding: var(--space-sm) var(--space-md); }
    .card-value { font-size: 20px; }

    /* Stack actions vertically on very small screens */
    .actions-cell {
        flex-direction: column;
        align-items: flex-end;
    }
}
