@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap');

/* Page header with logo and subscribe */
.ncr-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 48px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
}
.logo-container { display: inline-block; }
.logo-container img { max-height: 48px; width: auto; }

body {
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    font-family: 'Jost', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Full-width layout with 48px side margins */
.status-page-wrapper .layout-content,
.status-page-wrapper .container,
.status-page-wrapper main {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 48px !important;
}

/* Custom wrapper layout ordering */
.custom-status-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

.about-section-container   { order: 1; margin-bottom: 20px; width: 100%; box-sizing: border-box; }
.overall-status-container   { order: 2; margin-bottom: 20px; width: 100%; }
.group-chooser-container    { order: 3; margin-bottom: 20px; width: 100%; }
.historical-uptime-container{ order: 4; margin-bottom: 10px; width: 100%; box-sizing: border-box; }
.components-section.custom-components { order: 5; margin-bottom: 0; width: 100%; }
.legend-container           { order: 6; margin-bottom: 20px; width: 100%; }

/* Scheduled maintenance rendered from API fallback */
.scheduled-maintenances-container { margin-top: 30px; width: 100%; }
.scheduled-maintenances-container h2 { font-size: 24px; font-weight: 600; margin: 0 0 15px 0; color: #24292e; }
.scheduled-maintenances-container .scheduled-maintenance {
    border: 1px solid #e1e4e8;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 10px;
}
.scheduled-maintenances-container .scheduled-maintenance h3 { margin: 0 0 8px 0; font-size: 16px; }
.scheduled-maintenances-container .scheduled-maintenance h3 a { color: #24292e; text-decoration: none; }
.scheduled-maintenances-container .scheduled-maintenance h3 a:hover { text-decoration: underline; }
.scheduled-maintenances-container .sched-date { color: #586069; font-size: 14px; }

/* Push incidents after custom content */
.unresolved-incidents,
.incidents-list,
.incident-container,
[class*="incidents"]:not(.custom-components) {
    order: 999 !important;
    margin-top: 30px;
}

/* ── Overall status banner ───────────────────────────────────────── */

.overall-status {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid;
    border-left-width: 4px;
    width: 100%;
    box-sizing: border-box;
}

.overall-status.operational    { background-color: #e8f5e9; border-color: #4caf50; }
.overall-status.degraded       { background-color: #fff3e0; border-color: #ff9800; }
.overall-status.partial-outage { background-color: #fff3e0; border-color: #ff9800; }
.overall-status.major-outage   { background-color: #ffebee; border-color: #f44336; }
.overall-status.maintenance    { background-color: #e3f2fd; border-color: #2196f3; }

.overall-status .status-content { flex: 1; }

.overall-status .status-text {
    font-size: 1.25rem;
    font-weight: 600;
    display: block;
    margin-bottom: 12px;
}

.incident-details        { margin-top: 12px; }
.affected-groups-title   { font-weight: 600; margin-bottom: 8px; font-size: 1rem; }

.affected-groups-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.affected-groups-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    padding: 6px 0;
}

.affected-groups-list li strong { font-weight: 600; }

/* ── Status indicator circles ────────────────────────────────────── */

.ncr-status {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 0;
    text-indent: -9999px;
    overflow: hidden;
}

.ncr-status.operational          { background-color: #4caf50; }
.ncr-status.degraded_performance { background-color: #ff9800; }
.ncr-status.partial_outage       { background-color: #ff9800; }
.ncr-status.major_outage         { background-color: #f44336; }
.ncr-status.under_maintenance    { background-color: #2196f3; }

.ncr-status::before,
.ncr-status::after {
    content: none !important;
    display: none !important;
}

/* ── Group chooser ───────────────────────────────────────────────── */

.ncr-group-chooser {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e1e4e8;
    width: 100%;
    box-sizing: border-box;
}

.ncr-group-chooser .ncr-group-label { font-weight: 600; margin-right: 1rem; }

.ncr-group-chooser .ncr-group-btn {
    padding: 12px 24px;
    background-color: #ffffff;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #24292e;
    font-family: 'Jost', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.ncr-group-chooser .ncr-group-btn:hover {
    background-color: #f6f8fa;
    border-color: #0366d6;
}

.ncr-group-chooser .ncr-group-btn.clicked {
    background-color: #0366d6;
    color: white;
    border-color: #0366d6;
}

/* ── Historical uptime link ──────────────────────────────────────── */

.ncr-historical-uptime { text-align: right; margin: 15px 0; padding: 10px 0; }
.ncr-historical-uptime a { color: #0366d6; text-decoration: none; font-size: 14px; }
.ncr-historical-uptime a:hover { text-decoration: underline; }

/* ── Group card ──────────────────────────────────────────────────── */

.ncr-group {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e4e8;
    padding: 20px;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.ncr-group-header {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e4e8;
    color: #24292e;
}

/* ── Collapsible sections ────────────────────────────────────────── */

.ncr-collapsible-section {
    margin-bottom: 15px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f6f8fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.collapsible-header:hover { background-color: #e1e4e8; }

/* Status-colored left border on collapsible header */
.collapsible-header.status-operational          { border-left: 6px solid #4caf50; }
.collapsible-header.status-degraded_performance { border-left: 6px solid #ff9800; }
.collapsible-header.status-partial_outage       { border-left: 6px solid #ff9800; }
.collapsible-header.status-major_outage         { border-left: 6px solid #f44336; }
.collapsible-header.status-under_maintenance    { border-left: 6px solid #2196f3; }

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #24292e;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #586069;
}

.toggle-icon.collapsed { transform: rotate(-90deg); }

.collapsible-content     { display: none; background-color: #ffffff; }
.collapsible-content.expanded { display: block; }

/* ── Components table ────────────────────────────────────────────── */

.ncr-components-table { display: table; width: 100%; border-collapse: collapse; }

.ncr-table-header {
    display: table-row;
    background-color: #f6f8fa;
    font-weight: 600;
    border-bottom: 2px solid #e1e4e8;
}

.ncr-table-row {
    display: table-row;
    border-bottom: 1px solid #e1e4e8;
    transition: background-color 0.15s ease;
}

.ncr-table-row:hover { background-color: #f6f8fa; }

.ncr-table-cell {
    display: table-cell;
    padding: 15px 20px;
    vertical-align: middle;
}

.component-name-header { width: 40%; text-align: left; color: #24292e; }
.region-header         { text-align: center; color: #24292e; font-size: 13px; }
.component-name        { font-weight: 500; color: #24292e; }
.status-cell           { text-align: center; }
.status-cell.empty     { opacity: 0.3; }

/* Status row highlighting */
.status-row-major_outage         { background-color: rgba(224, 83, 88, 0.05); }
.status-row-degraded_performance { background-color: rgba(228, 186, 27, 0.05); }
.status-row-partial_outage       { background-color: rgba(231, 166, 65, 0.05); }
.status-row-under_maintenance    { background-color: rgba(2, 119, 189, 0.05); }

/* ── Legend ───────────────────────────────────────────────────────── */

.ncr-legend {
    margin: 0;
    padding: 20px;
    background-color: #f6f8fa;
    border-radius: 4px;
    border: 1px solid #e1e4e8;
    width: 100%;
    box-sizing: border-box;
}

.legend-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.legend-items li {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #24292e;
    gap: 8px;
}

.no-components {
    padding: 40px 20px;
    text-align: center;
    color: #586069;
    font-style: italic;
}

/* ── Mobile ──────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .status-page-wrapper .layout-content,
    .status-page-wrapper .container,
    .status-page-wrapper main {
        padding: 0 15px !important;
    }

    .overall-status,
    .ncr-group-chooser,
    .ncr-group,
    .ncr-legend {
        padding: 15px;
    }

    .ncr-group-chooser {
        flex-direction: column;
        gap: 5px;
    }

    .ncr-group-chooser .ncr-group-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
    }

    .ncr-components-table,
    .ncr-table-header,
    .ncr-table-row,
    .ncr-table-cell {
        display: block;
    }

    .ncr-table-header { display: none; }

    .ncr-table-cell {
        text-align: left;
        padding: 10px 20px;
    }

    .region-header,
    .status-cell {
        text-align: left;
    }

    .legend-items {
        flex-direction: column;
        gap: 15px;
    }

    .overall-status {
        flex-direction: column;
        gap: 8px;
    }

    .overall-status .status-text { font-size: 1rem; }
    .ncr-historical-uptime       { text-align: center; }
    .collapsible-header           { font-size: 0.9rem; padding: 12px 16px; }
    .ncr-group-header             { font-size: 1.5rem; }
}

/* ── Print ───────────────────────────────────────────────────────── */

@media print {
    .ncr-group-chooser,
    .ncr-historical-uptime {
        display: none;
    }

    .collapsible-content {
        display: block !important;
    }

    .toggle-icon {
        display: none;
    }
}