/* ================================
   Rewind Status Page Styles
   iOS Design System
   ================================ */

/* CSS Variables */
:root {
    --ios-blue: #007AFF;
    --ios-blue-dark: #0051D5;
    --ios-gray: #8E8E93;
    --ios-light-gray: #F2F2F7;
    --ios-separator: #E5E5EA;
    --ios-white: #FFFFFF;
    --ios-black: #000000;
    --ios-green: #34C759;
    --ios-yellow: #FFCC00;
    --ios-red: #FF3B30;

    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F8FC;
    --bg-tertiary: #F2F2F7;
    --bg-elevated: #FFFFFF;

    --label-primary: #000000;
    --label-secondary: #6E6E73;
    --label-tertiary: #A1A1A6;

    --fill-primary: #E8E8ED;
    --fill-secondary: #EDEDF2;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);

    --ease-ios: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --bg-elevated: #1C1C1E;

    --label-primary: #FFFFFF;
    --label-secondary: #ABABAB;
    --label-tertiary: #6E6E73;

    --fill-primary: #2C2C2E;
    --fill-secondary: #38383A;

    --ios-separator: #38383A;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #000000;
        --bg-secondary: #1C1C1E;
        --bg-tertiary: #2C2C2E;
        --bg-elevated: #1C1C1E;

        --label-primary: #FFFFFF;
        --label-secondary: #ABABAB;
        --label-tertiary: #6E6E73;

        --fill-primary: #2C2C2E;
        --fill-secondary: #38383A;

        --ios-separator: #38383A;
    }
}

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

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--label-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Settings Bar */
.settings-bar {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.toggle-button {
    width: 44px;
    height: 44px;
    background: var(--bg-elevated);
    border: 1px solid var(--ios-separator);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-ios);
    box-shadow: var(--shadow-sm);
}

.toggle-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--label-primary);
}

.theme-icon {
    width: 20px;
    height: 20px;
    color: var(--label-primary);
}

.theme-icon.moon {
    display: none;
}

[data-theme="dark"] .theme-icon.sun {
    display: none;
}

[data-theme="dark"] .theme-icon.moon {
    display: block;
}

/* Header */
.status-header {
    padding: 24px;
    display: flex;
    justify-content: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--label-primary);
}

/* Status Hero */
.status-hero {
    padding: 60px 24px;
    text-align: center;
    background: var(--bg-secondary);
}

.overall-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.overall-status h1 {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.overall-status.operational .status-indicator {
    background: var(--ios-green);
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.6);
    animation: pulse-green 2s ease-in-out infinite;
}

.overall-status.operational h1 {
    color: var(--ios-green);
}

.overall-status.degraded .status-indicator {
    background: var(--ios-yellow);
    box-shadow: 0 0 12px rgba(255, 204, 0, 0.6);
}

.overall-status.degraded h1 {
    color: var(--ios-yellow);
}

.overall-status.outage .status-indicator {
    background: var(--ios-red);
    box-shadow: 0 0 12px rgba(255, 59, 48, 0.6);
}

.overall-status.outage h1 {
    color: var(--ios-red);
}

@keyframes pulse-green {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.last-updated {
    font-size: 15px;
    color: var(--label-secondary);
}

/* Services Section */
.services-section {
    padding: 40px 24px;
    flex: 1;
}

.services-container {
    max-width: 700px;
    margin: 0 auto;
}

.services-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--label-primary);
}

.services-list {
    background: var(--bg-elevated);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--ios-separator);
}

.service-item {
    border-bottom: 1px solid var(--ios-separator);
}

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

.service-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.service-header:hover {
    background: var(--fill-secondary);
}

.service-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-expand-icon {
    width: 20px;
    height: 20px;
    color: var(--label-tertiary);
    transition: transform var(--duration-fast);
}

.service-item.expanded .service-expand-icon {
    transform: rotate(180deg);
}

.service-name {
    font-size: 17px;
    font-weight: 500;
    color: var(--label-primary);
}

.service-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.service-status-text {
    font-size: 14px;
    color: var(--label-secondary);
}

.service-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.service-status-dot.operational {
    background: var(--ios-green);
    box-shadow: 0 0 8px rgba(52, 199, 89, 0.5);
}

.service-status-dot.degraded {
    background: var(--ios-yellow);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

.service-status-dot.outage {
    background: var(--ios-red);
    box-shadow: 0 0 8px rgba(255, 59, 48, 0.5);
}

.service-status-dot.checking_status {
    background: var(--ios-gray);
    animation: pulse-checking 1.5s ease-in-out infinite;
}

@keyframes pulse-checking {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.service-details {
    padding: 0 20px 16px 52px;
    display: none;
}

.service-item.expanded .service-details {
    display: block;
    animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.service-details p {
    font-size: 14px;
    color: var(--label-secondary);
    margin-bottom: 12px;
}

.service-metrics {
    display: flex;
    gap: 24px;
}

.metric {
    font-size: 12px;
}

.metric-label {
    color: var(--label-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.metric-value {
    color: var(--label-primary);
    font-weight: 600;
    margin-left: 6px;
}

/* Refresh Button */
.refresh-container {
    text-align: center;
    margin-top: 24px;
}

.refresh-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--ios-blue);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast);
    border-radius: 12px;
}

.refresh-button:hover {
    background: var(--fill-secondary);
}

.refresh-icon {
    width: 18px;
    height: 18px;
}

.refresh-button.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* History Section */
.history-section {
    padding: 40px 24px;
    background: var(--bg-secondary);
}

.history-container {
    max-width: 700px;
    margin: 0 auto;
}

.history-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--label-primary);
}

.no-incidents {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--bg-elevated);
    border-radius: 16px;
    border: 1px solid var(--ios-separator);
}

.no-incidents svg {
    width: 24px;
    height: 24px;
    stroke: var(--ios-green);
    flex-shrink: 0;
}

.no-incidents p {
    font-size: 15px;
    color: var(--label-secondary);
}

/* Incidents Timeline */
.incidents-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.incident-item {
    background: var(--bg-elevated);
    border: 1px solid var(--ios-separator);
    border-radius: 14px;
    overflow: hidden;
    animation: slide-down 0.3s ease-out;
}

.incident-item.outage {
    border-left: 3px solid var(--ios-red);
}

.incident-item.degraded {
    border-left: 3px solid var(--ios-yellow);
}

.incident-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.incident-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.incident-status-dot.outage {
    background: var(--ios-red);
    box-shadow: 0 0 8px rgba(255, 59, 48, 0.5);
}

.incident-status-dot.degraded {
    background: var(--ios-yellow);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

.incident-info {
    flex: 1;
}

.incident-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--label-primary);
    margin: 0 0 2px 0;
}

.incident-type {
    font-size: 13px;
    color: var(--label-secondary);
}

.incident-badge {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
}

.incident-badge.ongoing {
    background: rgba(255, 59, 48, 0.15);
    color: var(--ios-red);
}

.incident-badge.resolved {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
}

.incident-details {
    display: flex;
    gap: 24px;
    padding: 0 16px 16px 40px;
    flex-wrap: wrap;
}

.incident-time {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.incident-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--label-tertiary);
}

.incident-time span:last-child {
    font-size: 14px;
    color: var(--label-primary);
}

/* Footer */
.footer {
    padding: 40px 24px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--ios-separator);
}

.footer-content {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

@media (min-width: 600px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.footer-logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--label-primary);
}

.footer-copyright {
    font-size: 13px;
    color: var(--label-tertiary);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    font-size: 13px;
    color: var(--label-secondary);
    text-decoration: none;
    transition: color var(--duration-fast);
}

.footer-link:hover {
    color: var(--ios-blue);
}

/* Responsive */
@media (max-width: 500px) {
    .status-hero {
        padding: 40px 20px;
    }

    .overall-status {
        flex-direction: column;
        gap: 12px;
    }

    .service-metrics {
        flex-direction: column;
        gap: 8px;
    }
}