/* Base styles - AutoMate brand */
:root {
    --color-primary: #a43f13;
    --color-primary-light: #db8d75;
    --color-secondary: #416e76;
    --color-healthy: #A1DC41;
    --color-healthy-dark: #507D07;
    --color-degraded: #E5611F;
    --color-degraded-dark: #AE410A;
    --color-unhealthy: #E52421;
    --color-unhealthy-dark: #AE0D0A;
    --color-nodata: #e5e7eb;
    --color-bg: #ffffff;
    --color-card-bg: #fafafa;
    --color-border: #e5e7eb;
    --color-text: #0d0c0c;
    --color-text-muted: #675f5f;
    --color-text-secondary: #857b7b;
    --container-width: 720px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: 0;
}

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

/* Header */
.status-header {
    padding: 1rem 0;
}

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

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

.header-logo {
    height: 28px;
    width: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: white;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: var(--color-card-bg);
    border-color: var(--color-primary-light);
}

.header-btn svg {
    color: var(--color-primary);
}

.header-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 0;
}

/* Status Banner */
.status-banner {
    border-radius: 14px;
    margin: 2rem 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    color: white;
}

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

.banner-icon { flex-shrink: 0; }

.banner-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.banner-badge {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
}

.banner-operational { background: var(--color-healthy); }
.banner-degraded { background: var(--color-degraded); }
.banner-partial { background: #f97316; }
.banner-major { background: var(--color-unhealthy); }
.banner-maintenance { background: var(--color-secondary); }

.banner-description {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.banner-description-bar {
    width: 3px;
    height: 1.25rem;
    border-radius: 2px;
}

.banner-operational .banner-description-bar { background: var(--color-healthy); }
.banner-degraded .banner-description-bar { background: var(--color-degraded); }
.banner-partial .banner-description-bar { background: #f97316; }
.banner-major .banner-description-bar { background: var(--color-unhealthy); }
.banner-maintenance .banner-description-bar { background: var(--color-secondary); }

/* Module Cards */
.modules-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.module-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.module-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.module-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.dot-healthy { background: var(--color-healthy); }
.dot-degraded { background: var(--color-degraded); }
.dot-unhealthy { background: var(--color-unhealthy); }
.dot-unknown { background: var(--color-nodata); }

.module-name {
    font-weight: 500;
    font-size: 1rem;
}

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

/* Timeline Bar */
.timeline-bar {
    margin-top: 0.5rem;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.timeline-segments {
    display: flex;
    gap: 1px;
    height: 28px;
}

.timeline-segment-wrapper {
    flex: 1;
    position: relative;
}

.timeline-segment {
    width: 100%;
    height: 28px;
    border-radius: 2px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.timeline-segment:hover {
    opacity: 0.7;
}

.seg-healthy { background: var(--color-healthy); }
.seg-degraded { background: var(--color-degraded); }
.seg-unhealthy { background: var(--color-unhealthy); }
.seg-nodata { background: var(--color-nodata); }
.seg-maintenance { background: var(--color-secondary); }

/* Tooltip */
.timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    white-space: nowrap;
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: white;
}

.timeline-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--color-border);
}

.tooltip-status {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.tooltip-healthy { color: var(--color-healthy); }
.tooltip-degraded { color: var(--color-degraded); }
.tooltip-unhealthy { color: var(--color-unhealthy); }
.tooltip-nodata { color: var(--color-text-muted); }
.tooltip-maintenance { color: var(--color-secondary); }

.tooltip-duration {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.4rem;
}

.tooltip-date {
    font-size: 0.85rem;
    color: var(--color-text);
    margin-bottom: 0.3rem;
}

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

.tooltip-incident {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
}

.tooltip-incident-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.2rem;
}

.tooltip-incident-severity {
    font-weight: 600;
    font-size: 0.8rem;
}

.tooltip-incident-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.tooltip-related-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    display: block;
}

.tooltip-related-link:hover {
    text-decoration: underline;
}

/* Module Incident Notice */
.module-card--incident {
    border-color: var(--color-degraded);
}

.module-card--resolved {
    border-color: var(--color-healthy);
}

.module-incident-notice {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.module-incident-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.module-incident-item + .module-incident-item {
    border-top: 1px solid var(--color-border);
}

.incident-status-bar {
    width: 3px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
}

.bar-minor { background: var(--color-degraded); }
.bar-major { background: #f97316; }
.bar-critical { background: var(--color-unhealthy); }
.bar-resolved { background: var(--color-healthy); }

.incident-notice-content {
    flex: 1;
    min-width: 0;
}

.incident-notice-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.2rem;
}

.incident-notice-status {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.notice-minor { color: var(--color-degraded); }
.notice-major { color: #f97316; }
.notice-critical { color: var(--color-unhealthy); }
.notice-resolved { color: var(--color-healthy-dark); }

.incident-notice-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.incident-notice-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text);
}

.incident-notice-update {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0.25rem 0 0;
    line-height: 1.4;
}

/* Active Incidents */
.active-incidents-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.active-incidents-section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

/* Incident Entry */
.incident-entry {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}

.incident-entry:last-child { border-bottom: none; }

.incident-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.incident-severity {
    font-weight: 600;
    font-size: 0.95rem;
}

.severity-minor { color: var(--color-degraded); }
.severity-major { color: #f97316; }
.severity-critical { color: var(--color-unhealthy); }

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

.incident-description,
.incident-update-text {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
    line-height: 1.5;
}

/* History Page */
.history-page {
    padding: 2rem 0;
}

.year-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.year-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.year-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.year-btn:hover:not(.active) {
    background: var(--color-card-bg);
    border-color: var(--color-primary-light);
}

/* Month Block */
.month-block {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.month-header:hover { background: rgba(0, 0, 0, 0.02); }

.month-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-icon {
    transition: transform 0.2s;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

.month-name {
    font-weight: 500;
    font-size: 1rem;
}

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

.month-body {
    padding: 0 1.5rem 1rem;
}

.no-incidents {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* Day Group */
.day-group {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    border-left: 3px solid var(--color-healthy);
    padding-left: 1rem;
    margin-left: 0.5rem;
}

.day-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 80px;
}

.day-indicator {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    display: none;
}

.day-number {
    font-weight: 600;
    font-size: 0.875rem;
}

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

.day-incidents { flex: 1; }
.day-no-incidents { opacity: 0.5; }

.indicator-healthy { background: var(--color-healthy); }
.indicator-minor { background: var(--color-degraded); }
.indicator-major { background: #f97316; }
.indicator-critical { background: var(--color-unhealthy); }

/* Language Switcher */
.language-switcher {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.lang-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
}

.lang-btn.active {
    background: var(--color-primary);
    color: white;
}

.lang-btn:not(.active):hover {
    background: var(--color-card-bg);
}

/* Loading */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 4rem 0;
}

/* Incident Detail Page */
.incident-detail {
    padding: 2rem 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: opacity 0.15s;
}

.back-link:hover { opacity: 0.7; }

.incident-detail-header {
    margin-bottom: 1.5rem;
}

.incident-detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.incident-detail-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.incident-detail-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-active { background: color-mix(in srgb, var(--color-degraded) 15%, white); color: var(--color-degraded-dark); }
.status-monitoring { background: color-mix(in srgb, #1F82E5 15%, white); color: #0A5CAE; }
.status-resolved { background: color-mix(in srgb, var(--color-healthy) 15%, white); color: var(--color-healthy-dark); }

.incident-detail-date,
.incident-detail-duration {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.incident-detail-modules {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.incident-module-tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.incident-detail-description {
    padding: 1rem 1.25rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text);
}

.incident-detail-description p { margin: 0; }

/* Incident Timeline */
.incident-timeline {
    margin-top: 2rem;
}

.incident-timeline h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.timeline-entry {
    display: flex;
    gap: 1rem;
    min-height: 60px;
}

.timeline-dot-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.dot-active { background: var(--color-degraded); }
.dot-monitoring { background: #1F82E5; }
.dot-resolved { background: var(--color-healthy); }
.dot-created { background: var(--color-text-muted); }

.timeline-line {
    width: 2px;
    flex: 1;
    background: var(--color-border);
    margin: 4px 0;
}

.timeline-content {
    flex: 1;
    padding-bottom: 1.5rem;
}

.timeline-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.timeline-entry-status {
    font-size: 0.85rem;
    font-weight: 600;
}

.notice-resolved { color: var(--color-healthy-dark); }
.notice-monitoring { color: #0A5CAE; }

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

.timeline-entry-message {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Clickable incident links */
a.incident-notice-title,
a.incident-severity {
    text-decoration: none;
    transition: opacity 0.15s;
}

a.incident-notice-title:hover,
a.incident-severity:hover {
    opacity: 0.7;
    text-decoration: underline;
}

a.incident-notice-title { color: var(--color-text); }

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

/* Admin Layout */
.admin-body {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    gap: 2rem;
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    min-width: 0;
}

/* Subscribe button - hide text on mobile */
@media (max-width: 640px) {
    .subscribe-btn { display: none; }
    .status-container { padding: 0 0.75rem; }
    .module-card { padding: 1rem; }
    .banner-content { padding: 1rem; }
    .admin-body { flex-direction: column; }
    .admin-sidebar { width: 100%; }
}
