/* Report Suite — shared styles */

:root {
    --color-bg: #f4f6f9;
    --color-surface: #ffffff;
    --color-text: #1a2332;
    --color-text-muted: #5c6b7a;
    --color-border: #dde3ea;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #059669;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-accent: #eff6ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.06);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --max-width: 1100px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
}

.logo-text {
    font-size: 1.125rem;
}

.site-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
}

.site-nav a:hover {
    color: var(--color-primary);
}

/* Main */

.site-main {
    flex: 1;
    padding: 2.5rem 0 3rem;
}

/* Hero */

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero p {
    margin: 0 auto;
    max-width: 540px;
    color: var(--color-text-muted);
    font-size: 1.0625rem;
}

/* Parser cards */

.parser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.parser-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.15s, transform 0.15s;
}

.parser-card:hover:not(.parser-card--disabled) {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.parser-card--disabled {
    opacity: 0.75;
}

.parser-card__badge {
    display: inline-block;
    align-self: flex-start;
    padding: 0.2rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.parser-card__badge--active {
    background: #d1fae5;
    color: var(--color-success);
}

.parser-card__badge--soon {
    background: #fef3c7;
    color: var(--color-warning);
}

.parser-card h2 {
    margin: 0;
    font-size: 1.25rem;
}

.parser-card p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    flex: 1;
}

.parser-card__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.parser-card__link:hover {
    background: var(--color-primary-hover);
}

.parser-card--disabled .parser-card__link {
    background: var(--color-border);
    color: var(--color-text-muted);
    pointer-events: none;
}

/* Page header */

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.page-header p {
    margin: 0;
    color: var(--color-text-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.back-link:hover {
    color: var(--color-primary);
}

/* Upload zone */

.upload-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.upload-zone:hover,
.upload-zone--dragover {
    border-color: var(--color-primary);
    background: var(--color-accent);
}

.upload-zone__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-zone__title {
    margin: 0 0 0.375rem;
    font-weight: 600;
}

.upload-zone__hint {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.upload-zone input[type="file"] {
    display: none;
}

.upload-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

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

.file-name--selected {
    color: var(--color-text);
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg);
}

/* Alerts */

.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.alert--error {
    background: #fef2f2;
    color: var(--color-danger);
    border: 1px solid #fecaca;
}

.alert--warning {
    background: #fffbeb;
    color: var(--color-warning);
    border: 1px solid #fde68a;
}

.alert--hidden {
    display: none;
}

/* Loading */

.loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.upload-panel--hidden {
    display: none;
}

.results-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.loading--visible {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Results */

.results-panel {
    display: none;
}

.results-panel--visible {
    display: block;
}

.results-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    min-width: 140px;
}

.summary-stat__label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

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

.warnings-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.warnings-list li {
    padding: 0.5rem 0.75rem;
    background: #fffbeb;
    border-left: 3px solid var(--color-warning);
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

/* Legacy rota table helpers (unused by current grid view) */

.net-hours-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.net-hours-box__value {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.shift-counts-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.shift-counts-row {
    display: grid;
    grid-template-columns: 72px repeat(7, 1fr);
    gap: 0.25rem;
    align-items: center;
}

.shift-counts-row--header {
    margin-bottom: 0.35rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--color-border);
}

.shift-counts-row--header .shift-counts-cell--day {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.2;
}

.shift-counts-date {
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 0.1rem;
}

.shift-counts-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    padding-right: 0.25rem;
}

.shift-counts-row--full .shift-counts-label {
    color: var(--color-primary);
}

.shift-counts-row--part .shift-counts-label {
    color: var(--color-warning);
}

.shift-counts-cell {
    text-align: center;
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 0.35rem 0.15rem;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

.shift-counts-row--full .shift-counts-cell {
    color: var(--color-primary);
}

.shift-counts-row--part .shift-counts-cell {
    color: var(--color-warning);
}

@media (max-width: 600px) {
    .shift-counts-row {
        grid-template-columns: 56px repeat(7, 1fr);
        gap: 0.15rem;
    }

    .shift-counts-label {
        font-size: 0.6rem;
    }

    .shift-counts-row--header .shift-counts-cell--day {
        font-size: 0.58rem;
    }
}

.table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.rota-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: clamp(0.625rem, 0.85vw, 0.75rem);
}

.rota-table .col-name {
    width: 14%;
}

.rota-table .col-hours {
    width: 4.5%;
}

.rota-table .col-day {
    width: 11.6%;
}

.rota-table th,
.rota-table td {
    padding: 0.4rem 0.25rem;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
    hyphens: auto;
}

.rota-table th {
    background: var(--color-bg);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
}

.rota-table td:first-child,
.rota-table th:first-child {
    text-align: left;
    font-weight: 500;
}

.rota-table .col-name-cell {
    font-size: clamp(0.6rem, 0.8vw, 0.72rem);
}

.rota-table .col-day-header .day-date {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.62rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text-muted);
}

.rota-table tbody tr:hover {
    background: var(--color-accent);
}

.cell-off {
    color: var(--color-text-muted);
    font-style: italic;
}

.cell-holiday {
    color: var(--color-warning);
    font-weight: 500;
}

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

.rota-table th.col-hours,
.rota-table td.col-hours {
    background: #f8fafc;
    font-size: 0.65rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

/* Debug panel */

.debug-panel {
    margin-top: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.debug-panel summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    user-select: none;
}

.debug-panel pre {
    margin: 0;
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 300px;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
}

/* Coming soon */

.coming-soon {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.coming-soon__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.coming-soon h2 {
    margin: 0 0 0.75rem;
}

.coming-soon p {
    margin: 0 auto 1.5rem;
    max-width: 420px;
    color: var(--color-text-muted);
}

/* Footer */

.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1.25rem 0;
}

.site-footer p {
    margin: 0;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Toast */

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--color-text);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 1000;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

/* Print */

@media print {
    .site-header,
    .site-footer,
    .upload-panel,
    .back-link,
    .parser-toolbar,
    .btn {
        display: none !important;
    }

    .page-parser .site-main {
        padding: 0;
        background: #fff;
    }

    .site-main {
        padding: 0;
    }

    .results-panel {
        display: block !important;
    }

    .parser-sheet {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

@media (max-width: 600px) {
    .site-main {
        padding: 1.5rem 0 2rem;
    }
}
