/* NextEra Energy Dashboard — Custom Styles */

/* ── Overall ───────────────────────────────────────────── */
body {
    background-color: #1a1a2e !important;
    color: #e0e0e0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Header ────────────────────────────────────────────── */
.dashboard-header {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border-bottom: 2px solid #e94560;
    padding: 12px 24px;
    margin-bottom: 0;
}

.dashboard-title {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

.dashboard-subtitle {
    color: #8a8fa8;
    font-size: 0.8rem;
    margin: 0;
}

.persona-switcher {
    max-width: 280px;
    background-color: #16213e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* ── Welcome Card ──────────────────────────────────────── */
.welcome-card {
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    border-left: 4px solid #e94560;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 12px 0;
    animation: fadeIn 0.3s ease-in;
}

.welcome-card .welcome-title {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.welcome-card .welcome-message {
    color: #b0b0c0;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

/* ── KPI Cards ─────────────────────────────────────────── */
.kpi-row {
    margin: 8px 0 12px 0;
}

.kpi-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    transition: transform 0.15s, border-color 0.15s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: #e94560;
}

.kpi-label {
    color: #8a8fa8;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.kpi-value {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.kpi-delta {
    font-size: 0.75rem;
    margin-top: 2px;
}

.kpi-delta.positive { color: #2ecc71; }
.kpi-delta.negative { color: #e94560; }
.kpi-delta.neutral  { color: #8a8fa8; }

/* ── Tabs ──────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid #0f3460;
    padding: 0 12px;
}

.nav-tabs .nav-link {
    color: #8a8fa8;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 16px;
    border: none;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav-tabs .nav-link:hover {
    color: #e0e0e0;
    border-bottom-color: #0f3460;
}

.nav-tabs .nav-link.active {
    color: #ffffff;
    background: transparent;
    border-bottom-color: #e94560;
}

.tab-content {
    padding: 16px;
}

/* ── Charts ────────────────────────────────────────────── */
.chart-container {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.chart-title {
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ── Insight Cards ────────────────────────────────────── */
.insight-card {
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 8px 0;
    animation: fadeIn 0.3s ease-in;
}

.insight-card:empty {
    display: none;
}

/* ── Scenario Simulator Sliders ────────────────────────── */
.slider-container {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.slider-label {
    color: #b0b0c0;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.slider-value {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Preset Scenario Buttons ───────────────────────────── */
.preset-btn {
    background: #0f3460;
    border: 1px solid #1a3a6e;
    color: #e0e0e0;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    width: 100%;
    text-align: left;
    margin-bottom: 6px;
}

.preset-btn:hover {
    background: #1a3a6e;
    color: #ffffff;
}

.preset-btn .preset-name {
    font-weight: 600;
    display: block;
}

.preset-btn .preset-meta {
    color: #8a8fa8;
    font-size: 0.7rem;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert-card {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.alert-card.critical {
    background: rgba(233, 69, 96, 0.15);
    border-left-color: #e94560;
}

.alert-card.warning {
    background: rgba(255, 183, 77, 0.15);
    border-left-color: #ffb74d;
}

.alert-card.info {
    background: rgba(100, 181, 246, 0.15);
    border-left-color: #64b5f6;
}

/* ── Metrics Table ─────────────────────────────────────── */
.metrics-table {
    width: 100%;
    border-collapse: collapse;
}

.metrics-table th {
    background: #0f3460;
    color: #e0e0e0;
    padding: 8px 12px;
    font-size: 0.8rem;
    text-align: center;
}

.metrics-table td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid #0f3460;
    font-size: 0.85rem;
}

/* ── News Ticker ──────────────────────────────────────── */
.news-ribbon {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 16px;
}

.news-ribbon-header {
    color: #8a8fa8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.news-ticker-viewport {
    overflow: hidden;
}

.news-ticker-track {
    display: flex;
    gap: 12px;
    animation: ticker-scroll 60s linear infinite;
    width: max-content;
}

.news-ticker-viewport:hover .news-ticker-track {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.news-ribbon-card {
    flex: 0 0 260px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-left: 3px solid #e94560;
    border-radius: 6px;
    padding: 10px 12px;
    transition: border-color 0.15s;
    text-decoration: none;
    display: block;
}

.news-ribbon-card:hover {
    border-color: #e94560;
}

.news-ribbon-card .news-title {
    color: #e0e0e0;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-ribbon-card:hover .news-title {
    color: #e94560;
}

.news-ribbon-card .news-meta {
    color: #6c6c7c;
    font-size: 0.7rem;
    margin-top: 6px;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Data Freshness Badge ──────────────────────────────── */
.freshness-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.freshness-badge.fresh   { background: #2ecc71; color: #1a1a2e; }
.freshness-badge.stale   { background: #ffb74d; color: #1a1a2e; }
.freshness-badge.expired { background: #e94560; color: #ffffff; }

/* ── Region Selector ───────────────────────────────────── */
.region-selector {
    max-width: 240px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .kpi-card { margin-bottom: 8px; }
    .dashboard-title { font-size: 1.1rem; }
    .dashboard-header { padding: 8px 12px; }
    .nav-tabs .nav-link { padding: 8px 10px; font-size: 0.75rem; }
    .slider-container { padding: 10px; }
    .chart-container { padding: 8px; }
    .news-ribbon-card { flex: 0 0 220px; }
}

@media (min-width: 1440px) {
    .kpi-value { font-size: 1.8rem; }
    .chart-container { padding: 16px; }
}

@media (min-width: 1920px) {
    .dashboard-header { padding: 16px 32px; }
    .tab-content { padding: 20px 24px; }
}

/* ── Focus Indicators (Accessibility) ──────────────────── */
*:focus-visible {
    outline: 2px solid #56B4E9;
    outline-offset: 2px;
}

.nav-tabs .nav-link:focus-visible {
    outline: 2px solid #56B4E9;
    outline-offset: -2px;
}

.preset-btn:focus-visible {
    outline: 2px solid #56B4E9;
    box-shadow: 0 0 0 3px rgba(86, 180, 233, 0.3);
}

/* ── Screen Reader Only ────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 8px 16px;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .welcome-card, .insight-card { animation: none; }
    .news-ticker-track { animation: none; }
    .kpi-card { transition: none; }
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
