/* CSS Variables — тёмная тема (по умолчанию) */
:root {
    --color-ok: #22c55e;
    --color-degraded: #f59e0b;
    --color-error: #ef4444;
    --color-unknown: #6b7280;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #263148;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --uptime-track: rgba(255, 255, 255, 0.1);
    --cta-bg: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
    --cta-border: rgba(96, 165, 250, 0.2);
}

/* CSS Variables — светлая тема */
[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.08);
    --uptime-track: rgba(0, 0, 0, 0.08);
    --cta-bg: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    --cta-border: rgba(37, 99, 235, 0.2);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

/* Logo */
.logo-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.site-logo {
    width: 17.2vw;
    min-width: 160px;
    max-width: 360px;
    height: auto;
    display: block;
}

.logo-wrapper .theme-toggle {
    position: absolute;
    right: 0;
}

/* Точка-индикатор статуса */
.header-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

.dot-ok      { background-color: var(--color-ok); }
.dot-degraded { background-color: var(--color-degraded); }
.dot-error   { background-color: var(--color-error); }
.dot-unknown { background-color: var(--color-unknown); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Ссылка на сайт ФССП */
.fssp-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
    text-underline-offset: 3px;
}

.fssp-link:hover {
    text-decoration-color: var(--text-primary);
}

/* Кнопка переключения темы */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text-secondary);
    transition: background-color 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
    background-color: var(--bg-card-hover);
}

/* Card base */
.status-block,
.uptime-block,
.chart-block,
.incidents-block,
.cta-block,
.methodology-block,
.faq-block {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

/* Padding для каждого блока отдельно */
.status-block {
    padding: 0.7rem;
}

.uptime-block,
.chart-block,
.incidents-block,
.cta-block,
.methodology-block,
.faq-block {
    padding: 1.5rem;
}

.status-ok {
    border-left: 4px solid var(--color-ok);
    background: rgba(34, 197, 94, 0.05);
}

.status-degraded {
    border-left: 4px solid var(--color-degraded);
    background: rgba(245, 158, 11, 0.05);
}

.status-error {
    border-left: 4px solid var(--color-error);
    background: rgba(239, 68, 68, 0.05);
}

.status-unknown {
    border-left: 4px solid var(--color-unknown);
    background: rgba(107, 114, 128, 0.05);
}

.status-icon-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-icon {
  display: none;
    font-size: 2rem;
    line-height: 1;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.status-metrics {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.status-metrics span {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

.status-metrics strong {
    color: var(--text-primary);
    font-weight: 600;
}

.status-updated {
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.status-updated-mobile {
    display: none;
    margin-left: auto;
}

@media (max-width: 600px) {
    .status-updated-desktop {
        display: none;
    }

    .status-updated-mobile {
        display: block;
    }

    .updated-label {
        display: none;
    }

    .status-updated::before {
        content: '⌛';
        margin-right: 0.25em;
    }
}

.status-time {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.status-unknown-detail {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.status-unknown-detail p {
    margin-bottom: 0.25rem;
}

/* Uptime Block */
.uptime-block h2,
.chart-block h2,
.incidents-block h2,
.cta-block h2,
.methodology-block h2,
.faq-block h2 {
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.uptime-rows {
    display: flex;
    gap: 1.5rem;
}

.uptime-row {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.uptime-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--uptime-track);
    border-radius: 4px;
    overflow: hidden;
}

.uptime-bar {
    height: 100%;
    background: var(--color-ok);
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 0;
    max-width: 100%;
}

.uptime-value {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
    min-width: 70px;
    text-align: right;
}

.uptime-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    min-width: 90px;
}

/* Chart Block */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-no-data {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-style: italic;
    text-align: center;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    flex-wrap: wrap;
}

.legend-blue {
    color: #60a5fa;
}

.legend-red {
    color: #f87171;
}

/* Incidents Block */
.incident-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.incident-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.incident-item:first-child {
    padding-top: 0;
}

.incident-item .icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.incident-details {
    flex: 1;
}

.incident-title {
    font-size: 0.91rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.incident-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.incident-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9375rem;
}

.loading {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9375rem;
}

/* CTA Block */
.cta-block {
    background: var(--cta-bg);
    border: 1px solid var(--cta-border);
    text-align: center;
    padding: 2rem 1.5rem;
}

.cta-block h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.cta-block p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.cta-button {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    background-color: #2563eb;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.cta-button:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.cta-button:active {
    transform: translateY(0);
}

/* Methodology Block */
.methodology-block {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.methodology-block h2 {
    font-size: 1rem;
    color: var(--text-primary);
}

.methodology-block p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.methodology-block ul {
    list-style: disc;
    padding-left: 1.25rem;
}

.methodology-block ul li {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

/* FAQ Block */
.faq-block {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.faq-block h2 {
    font-size: 1rem;
    color: var(--text-primary);
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.faq-item:first-of-type {
    padding-top: 0;
}

.faq-item:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-item summary {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
    line-height: 1;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    margin-top: 0.5rem;
    line-height: 1.7;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 1rem 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0.5rem 0.44rem;
    }

    .logo-wrapper,
    .status-block,
    .uptime-block,
    .chart-block,
    .incidents-block,
    .cta-block,
    .methodology-block,
    .faq-block {
        margin-bottom: 0.5rem;
    }

  .status-block,
  .uptime-block {
    padding: 0.7rem;
  }

  .uptime-block {
    padding-top: 0.44rem;
  }

    .status-icon-text {
        margin-bottom: 0.5rem;
    }

    .status-text {
        font-size: 0.94rem;
    }

    .status-metrics {
        flex-wrap: nowrap;
        gap: 1rem;
    }

    .status-metrics span {
        font-size: 0.9rem;
        color: var(--text-secondary);
      }

    .uptime-rows {
        display: block;
    }

    .uptime-rows .uptime-row {
        margin-bottom: 0.75rem;
        gap: 0.375rem;
        flex-wrap: nowrap;
    }

    .uptime-rows .uptime-row:last-child {
        margin-bottom: 0;
    }

    .uptime-label {
        min-width: auto;
        white-space: nowrap;
    }

    .chart-block {
        padding: 0.38rem;
    }

    .chart-block h2 {
        text-align: center;
    }

    .chart-container {
        height: 220px;
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        width: calc(100% + 1.5rem);
    }

    .chart-legend {
        flex-wrap: nowrap;
        gap: 0;
    }

    .legend-blue::after {
        content: ';';
        color: var(--text-secondary);
        margin-right: 0.5rem;
    }

    .cta-block {
        padding: 1.5rem 1rem;
    }
}
