/* Status Page — oack */

:root {
    --brand-primary: #1a73e8;
    --bg: #ffffff;
    --bg-card: #f8f9fa;
    --bg-header: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6c757d;
    --border: #e0e0e0;
    --green: #28a745;
    --yellow: #f0ad4e;
    --orange: #fd7e14;
    --red: #dc3545;
    --blue: #0d6efd;
    --gray: #d1d5db;
    --radius: 8px;
    --max-width: 720px;
}

[data-theme="dark"] {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-header: #161b22;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --border: #30363d;
    --gray: #484f58;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Header */
.header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-header);
}

.header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

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

.header__logo {
    max-height: 40px;
    flex-shrink: 0;
}

.header__title-link {
    color: var(--text);
    text-decoration: none;
}

.header__title-link:hover {
    text-decoration: none;
}

.header__title {
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Header actions (theme toggle + subscribe) */
.header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header__theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 0;
    transition: border-color 0.15s;
}

.header__theme-toggle:hover {
    border-color: var(--text);
}

.header__theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Subscribe dropdown */
.subscribe-dropdown {
    position: relative;
    flex-shrink: 0;
}

.subscribe-dropdown__toggle {
    background: var(--brand-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.subscribe-dropdown__toggle:hover {
    opacity: 0.9;
}

.subscribe-dropdown__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    width: 340px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.subscribe-dropdown__panel[hidden] {
    display: none;
}

.subscribe-dropdown__heading {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.subscribe-dropdown__form {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.subscribe-dropdown__input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--bg);
    color: var(--text);
}

.subscribe-dropdown__submit {
    background: var(--brand-primary);
    color: #fff;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.subscribe-dropdown__submit:hover {
    opacity: 0.9;
}

.subscribe-dropdown__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.subscribe-dropdown__result {
    font-size: 0.85rem;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.subscribe-dropdown__result--success {
    background: var(--green);
    color: #fff;
}

.subscribe-dropdown__result--error {
    background: var(--red);
    color: #fff;
}

.subscribe-dropdown__result--info {
    background: var(--blue);
    color: #fff;
}

.subscribe-dropdown__divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.subscribe-dropdown__link {
    display: block;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    color: var(--text-muted);
}

.subscribe-dropdown__link:hover {
    color: var(--brand-primary);
}

.subscribe-dropdown__channels {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.subscribe-dropdown__channel-icon {
    width: 28px;
    height: 28px;
    opacity: 0.5;
}

.subscribe-dropdown__channel-icon svg {
    width: 100%;
    height: 100%;
}

/* Overall status banner */
.overall-status {
    margin: 1.5rem auto;
    max-width: var(--max-width);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.overall-status--green { background: var(--green); color: #fff; }
.overall-status--yellow { background: var(--yellow); color: #1a1a2e; }
.overall-status--orange { background: var(--orange); color: #fff; }
.overall-status--red { background: var(--red); color: #fff; }
.overall-status--blue { background: var(--blue); color: #fff; }
.overall-status--gray { background: var(--gray); color: #fff; }

/* Sections */
.section {
    margin: 2rem 0;
}

.section__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.section__intro {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin: 1.5rem 0;
}

.tabs__tab {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    text-decoration: none;
}

.tabs__tab:hover {
    color: var(--text);
    text-decoration: none;
}

.tabs__tab--active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* Component rows */
.component {
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
}

.component:last-child {
    border-bottom: none;
}

.component__info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.component__name {
    font-weight: 500;
}

.component__status {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.component__status--green { color: var(--green); }
.component__status--yellow { color: var(--yellow); }
.component__status--orange { color: var(--orange); }
.component__status--red { color: var(--red); }
.component__status--blue { color: var(--blue); }

/* Component groups */
.component-group {
    margin-bottom: 1.5rem;
}

.component-group__header {
    margin-bottom: 0.25rem;
}

.component-group__name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.component-group__desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Cards (incidents, maintenance) */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.card__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.card__icon {
    font-size: 1.1rem;
}

.card__icon--minor { color: var(--yellow); }
.card__icon--medium { color: var(--yellow); }
.card__icon--major { color: var(--orange); }
.card__icon--critical { color: var(--red); }
.card__icon--blue { color: var(--blue); }

.card__title {
    font-size: 1rem;
    font-weight: 600;
}

.card__meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card__message {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card--severity-minor { border-left: 3px solid var(--yellow); }
.card--severity-medium { border-left: 3px solid var(--yellow); }
.card--severity-major { border-left: 3px solid var(--orange); }
.card--severity-critical { border-left: 3px solid var(--red); }
.card--maintenance { border-left: 3px solid var(--blue); }
.card--resolved { border-left: 3px solid var(--green); }

.card--link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.15s;
}

.card--link:hover {
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Timeline (incident updates) */
.timeline {
    margin-top: 0.75rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.timeline__entry {
    padding: 0.375rem 0;
}

.timeline__time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline__status {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.timeline__message {
    font-size: 0.9rem;
}

/* Month groups */
.month-group {
    margin-bottom: 1.5rem;
}

.month-group__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border);
}

/* Uptime bars */
.uptime-bar {
    margin-top: 0.375rem;
}

.uptime-bar__bars {
    display: flex;
    gap: 2px;
    height: 34px;
}

.uptime-bar__day {
    flex: 1;
    border-radius: 3px;
    min-width: 3px;
    cursor: default;
    transition: opacity 0.1s;
}

.uptime-bar__day:hover {
    opacity: 0.75;
}

.uptime-bar__day--green { background: var(--green); }
.uptime-bar__day--yellow { background: var(--yellow); }
.uptime-bar__day--orange { background: var(--orange); }
.uptime-bar__day--red { background: var(--red); }
.uptime-bar__day--gray { background: var(--gray); }

/* Day wrapper for popup positioning */
.uptime-bar__day-wrap {
    flex: 1;
    min-width: 2px;
    position: relative;
}

.uptime-bar__day-wrap .uptime-bar__day {
    width: 100%;
    height: 100%;
    display: block;
}

.uptime-bar__popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + 8px);
    margin-bottom: 0;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    font-size: 0.85rem;
    white-space: nowrap;
}

.uptime-bar__day-wrap:hover .uptime-bar__popup {
    display: block;
}

/* Invisible bridge so cursor can move from bar to popup without losing hover */
.uptime-bar__popup::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.uptime-bar__popup-date {
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.uptime-bar__popup-downtime {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
}

.uptime-bar__popup-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.uptime-bar__popup-dot--green { background: var(--green); }
.uptime-bar__popup-dot--yellow { background: var(--yellow); }
.uptime-bar__popup-dot--orange { background: var(--orange); }
.uptime-bar__popup-dot--red { background: var(--red); }

.uptime-bar__popup-ok {
    color: var(--green);
    margin-bottom: 0.25rem;
}

.uptime-bar__popup-nodata {
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.uptime-bar__popup-related {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.uptime-bar__popup-incident {
    display: block;
    font-size: 0.85rem;
    padding: 0.125rem 0;
    color: var(--brand-primary);
}

.uptime-bar__popup-maintenance {
    display: block;
    font-size: 0.85rem;
    padding: 0.125rem 0;
    color: var(--blue);
}

.uptime-bar__labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Uptime calendar page */
.uptime-page__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.uptime-page__select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    max-width: 300px;
}

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

.uptime-calendar {
    min-width: 0;
}

.uptime-calendar__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.uptime-calendar__month {
    font-size: 0.9rem;
    font-weight: 600;
}

.uptime-calendar__pct {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.uptime-calendar__grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.uptime-calendar__row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.uptime-calendar__cell {
    aspect-ratio: 1;
    border-radius: 3px;
    cursor: default;
    transition: opacity 0.1s;
}

.uptime-calendar__cell:hover {
    opacity: 0.75;
}

.uptime-calendar__cell--green { background: var(--green); }
.uptime-calendar__cell--yellow { background: var(--yellow); }
.uptime-calendar__cell--orange { background: var(--orange); }
.uptime-calendar__cell--red { background: var(--red); }
.uptime-calendar__cell--gray { background: var(--gray); }
.uptime-calendar__cell--empty { background: transparent; }

.uptime-calendar__cell-wrap {
    position: relative;
    aspect-ratio: 1;
}

.uptime-calendar__cell-wrap .uptime-calendar__cell {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
}

.uptime-calendar__cell-wrap .uptime-bar__popup {
    left: 50%;
    bottom: calc(100% + 4px);
}

.uptime-calendar__cell-wrap:hover .uptime-bar__popup {
    display: block;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
}

.pagination--inline {
    padding: 0;
}

.pagination__link {
    font-weight: 500;
}

.pagination__link--disabled {
    color: var(--text-muted);
    opacity: 0.4;
    pointer-events: none;
}

.pagination__current {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Refresh banner */
.refresh-banner {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--brand-primary);
    color: #fff;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
}

.refresh-banner a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer__history {
    color: var(--text-muted);
}

.footer__powered a {
    color: var(--text-muted);
    font-weight: 500;
}

.footer__theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 0;
    transition: border-color 0.15s;
}

.footer__theme-toggle:hover {
    border-color: var(--text);
}

.footer__theme-toggle svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Utilities */
.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.back-link {
    margin: 1.5rem 0 1rem;
    font-size: 0.9rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert--success { background: var(--green); color: #fff; }
.alert--error { background: var(--red); color: #fff; }
.alert--info { background: var(--blue); color: #fff; }

/* Print */
@media print {
    .subscribe-dropdown,
    .footer,
    .refresh-banner,
    .tabs { display: none; }
    .header { border-bottom: 1px solid #000; }
}

/* Responsive */
@media (max-width: 720px) {
    .uptime-page__months {
        grid-template-columns: 1fr;
    }

    .uptime-page__controls {
        flex-direction: column;
        align-items: stretch;
    }

    .uptime-page__select {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 1.1rem;
    }

    .component__info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .component__name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
}
