/* Copyright (c) 2025-2026 William Chesher | MIT License */
/* dashboard.css - Dashboard/overview page styles (index.html) */

/* ============================================
   Dashboard Grid Layout
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Live panels row: full-width at the top of the overview. */
.overview-panels-row {
    margin-bottom: 1.5rem;
}

/* 2-col grid for the cards that sit below the live-panels row:
   row a = quick actions | fleet, row b = users | recent miniverses. */
.dashboard-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-grid .span-2 {
        grid-column: auto;
    }
    .dashboard-grid-2col {
        grid-template-columns: 1fr;
    }
}

.span-2 {
    grid-column: span 2;
}

.full-width {
    grid-column: 1 / -1;
}

/* ============================================
   Dashboard Sections
   ============================================ */

.dashboard-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 1.25rem;
}

.dashboard-section h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-section h2 svg {
    width: 1.2em;
    height: 1.2em;
    color: var(--accent);
}

.dashboard-section h2 .circle-btn {
    margin-left: auto;
}

.dashboard-section h2 a.health-section-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.dashboard-section h2 a.health-section-link:hover {
    color: var(--accent);
}

html.dark-theme .dashboard-section {
    background: rgba(15, 15, 35, 0.85);
    border: 1px solid rgba(124, 255, 220, 0.15);
}

html.dark-theme .dashboard-section h2 {
    border-color: rgba(124, 255, 220, 0.1);
    color: #eee;
}

/* ============================================
   Status Cards (Service Health)
   ============================================ */

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 400px) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.status-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
}

a.status-card {
    color: inherit;
    text-decoration: none;
    display: block;
}

a.status-card:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.status-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-card svg {
    width: 40px;
    height: 40px;
    color: var(--accent, #7c6fae);
    margin-bottom: 0.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.status-card .indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-card .indicator.healthy { background: #4caf50; }
.status-card .indicator.degraded { background: #ff9800; }
.status-card .indicator.down { background: #f44336; }
.status-card .indicator.unknown { background: #9e9e9e; }

.status-card .name {
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
    text-transform: lowercase;
}

.status-card .state {
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    margin-top: 0.25rem;
    text-transform: lowercase;
}

html.dark-theme .status-card {
    background: #1e1e2e;
    border-color: #3a3a4a;
}

html.dark-theme .status-card .name {
    color: #e0e0e0;
}

html.dark-theme .status-card .state {
    color: #888;
}

html.dark-theme .status-card svg {
    color: var(--accent, #9d8fce);
}

/* ============================================
   Stat Cards (Large Display)
   ============================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-card-lg {
    background: var(--accent, #00d4ff);
    border: 1px solid var(--accent-light, #a0a1d0);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s;
}

a.stat-card-lg {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.stat-card-lg:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.stat-card-lg svg {
    width: 40px;
    height: 40px;
    color: #fff;
    margin-bottom: 0.5rem;
}

.stat-card-lg .value {
    font-size: 2rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.stat-card-lg .label {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.25rem;
}

.stat-card-lg.online .value { color: #fff; }
.stat-card-lg.warning .value { color: #fff; }
.stat-card-lg.error .value { color: #fff; }

html.dark-theme .stat-card-lg {
    background: var(--accent, #00d4ff);
    border-color: var(--accent-hover, #726fae);
}

html.dark-theme .stat-card-lg svg {
    color: #fff;
}

html.dark-theme .stat-card-lg .value {
    color: #fff;
}

html.dark-theme .stat-card-lg .label {
    color: rgba(255, 255, 255, 0.8);
}

html.dark-theme .stat-card-lg.online .value { color: #fff; }
html.dark-theme .stat-card-lg.warning .value { color: #fff; }
html.dark-theme .stat-card-lg.error .value { color: #fff; }

/* ============================================
   Activity List
   ============================================ */

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list .activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.activity-list .activity-item svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
    flex-shrink: 0;
}

.activity-list .activity-item .info {
    flex: 1;
    min-width: 0;
}

.activity-list .activity-item .title {
    font-size: 0.85rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-list .activity-item .meta {
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
}

.activity-list .activity-item .status {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    background: #e8f5e9;
    color: #2e7d32;
}

.activity-list .activity-item .status.offline {
    background: #f5f5f5;
    color: #666;
}

html.dark-theme .activity-list .activity-item {
    border-color: #3a3a4a;
}

html.dark-theme .activity-list .activity-item .title {
    color: #e0e0e0;
}

html.dark-theme .activity-list .activity-item .status {
    background: rgba(124, 255, 220, 0.15);
    color: #7cffdc;
}

html.dark-theme .activity-list .activity-item .status.offline {
    background: #2a2a3a;
    color: #888;
}

/* ============================================
   Quick Actions
   ============================================ */

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-actions-primary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.quick-action-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    text-decoration: none;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.quick-action-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 111, 174, 0.3);
}

.quick-action-primary svg {
    width: 1em;
    height: 1em;
}

.quick-actions-secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #555;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.quick-action:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.quick-action svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

html.dark-theme .quick-action-primary {
    color: #fff;
}

html.dark-theme .quick-action-primary:hover {
    color: #fff;
}

html.dark-theme .quick-action {
    background: #1e1e2e;
    border-color: #3a3a4a;
    color: #e0e0e0;
}

html.dark-theme .quick-action:hover {
    background: rgba(124, 255, 220, 0.1);
    border-color: var(--accent);
}

/* ============================================
   Version Info
   ============================================ */

.version-info {
    display: flex;
    gap: 2rem;
    font-size: 0.8rem;
    color: #666;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.version-info .item {
    display: flex;
    gap: 0.5rem;
}

.version-info .label {
    color: #888;
}

.version-info .value {
    font-family: 'Roboto Mono', monospace;
}

html.dark-theme .version-info {
    border-color: #3a3a4a;
    color: #888;
}

/* ============================================
   Environment Badge
   ============================================ */

/* FOLD-PENDING (claude/admin-badge-consolidation): replace with the
 * canonical .tag primitive in admin.css per the three-primitive split:
 *   .env-badge.env-<name>  ->  .tag.tag-env-<name>
 *
 * Reference: output/badge-standard-2026-04-30.md
 */
.env-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #9e9e9e;
    color: #fff;
}

.env-badge.env-development {
    background: #4caf50;
    color: #fff;
}

.env-badge.env-staging {
    background: #ff9800;
    color: #fff;
}

.env-badge.env-production {
    background: #f44336;
    color: #fff;
}

/* ============================================
   Data Freshness + Ingestion Gaps (overview)
   ============================================ */
.freshness-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.freshness-card {
    border: 1px solid var(--border-default, #e0e0e0);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary, #fff);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.freshness-card .table-name {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.freshness-card .age {
    font-size: 1rem;
    font-weight: 600;
}
.freshness-card .status-pill {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.freshness-card .status-pill.fresh { background: #e8f5e9; color: #2e7d32; }
.freshness-card .status-pill.lagging { background: #fff3e0; color: #e65100; }
.freshness-card .status-pill.stale { background: #ffebee; color: #c62828; }
.freshness-card .status-pill.absent { background: #f5f5f5; color: #616161; }
.freshness-card.fresh { border-color: #4caf50; }
.freshness-card.lagging { border-color: #ff9800; }
.freshness-card.stale { border-color: #f44336; }
.freshness-card.absent { border-color: #9e9e9e; opacity: 0.6; }

.ingestion-gaps h3 {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #888);
}
.gaps-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 220px;
    overflow-y: auto;
}
.gap-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    background: var(--bg-secondary, #f5f5f5);
    font-size: 0.8rem;
    font-family: 'Roboto Mono', monospace;
    align-items: center;
}
.gap-row .gap-table { color: var(--text-primary, #333); }
.gap-row .gap-duration {
    font-weight: 600;
    color: #c62828;
}
.gap-row .gap-when { color: var(--text-muted, #888); font-size: 0.75rem; }
.gaps-empty { color: var(--text-muted, #888); font-size: 0.85rem; padding: 0.5rem; }
