/* ============================================
   Therapy Room Usage - Styles
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #222;
    background: #f4f5f7;
    line-height: 1.5;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- Error --- */
.error {
    color: #b00020;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* --- Login Card --- */
.card {
    background: #fff;
    border: 1px solid #ddd;
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 420px;
    margin: 3rem auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card h2 {
    margin-top: 0;
}

.card label {
    font-weight: 600;
    font-size: 0.9rem;
}

.card input {
    width: 100%;
    padding: 0.5rem;
    margin: 0.25rem 0 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.card button {
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
}

/* --- Top Bar --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.topbar h1 {
    margin: 0;
    font-size: 1.4rem;
}

.topbar a {
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
}

.topbar a:hover {
    text-decoration: underline;
}

/* --- Sync Info --- */
.sync-info {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    min-width: 600px;
}

th,
td {
    border: none;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #fafafa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #555;
}

tr:last-child td {
    border-bottom: none;
}

/* --- Muted Text --- */
.muted {
    color: #888;
    font-size: 0.9rem;
}

/* --- Section Title --- */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-bar label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.filter-bar select,
.filter-bar button {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.filter-bar button {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
    cursor: pointer;
    font-weight: 600;
}

.filter-bar button:hover {
    background: #1565c0;
}

/* --- Horizontal Rule --- */
hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 2rem 0;
}

/* --- Column Widths (Event Details Table) --- */
.w-date {
    width: 100px;
    white-space: nowrap;
}

.w-time {
    width: 60px;
    white-space: nowrap;
}

.w-title {
    min-width: 160px;
}

.w-desc {
    min-width: 200px;
}

/* --- Report Table Specific --- */
.report-table th:first-child,
.report-table td:first-child {
    width: 100px;
}

/* Quota column is now the last column */
.report-table th:last-child,
.report-table td:last-child {
    width: 110px;
    text-align: center;
}

/* --- Current Month Highlight --- */
.month-current {
    background-color: #e3f2fd !important;
}

th.month-current {
    background-color: #bbdefb !important;
}

/* --- Detail Error --- */
details {
    margin-bottom: 1rem;
    cursor: pointer;
}

details summary {
    font-weight: bold;
    color: #b00020;
}

details pre {
    background: #f8f8f8;
    border: 1px solid #ddd;
    padding: 0.75rem;
    margin-top: 0.5rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* ============================================
   Mobile Styles
   ============================================ */

@media (max-width: 768px) {
    .page {
        padding: 0.75rem;
    }

    .topbar h1 {
        font-size: 1.15rem;
    }

    .card {
        margin: 2rem 0.5rem;
        padding: 1.25rem;
    }

    .filter-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-bar > div {
        width: 100%;
    }

    .filter-bar select,
    .filter-bar button {
        width: 100%;
        padding: 0.6rem 0.75rem;
        font-size: 1rem;
    }

    .filter-bar label {
        display: block;
        margin-bottom: 0.15rem;
    }

    .table-wrapper {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        border-radius: 0;
    }

    table {
        min-width: 500px;
    }

    th,
    td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .sync-info {
        font-size: 0.8rem;
    }

    .report-table th:first-child,
    .report-table td:first-child {
        width: auto;
        min-width: 70px;
    }

    .report-table th:last-child,
    .report-table td:last-child {
        width: auto;
        min-width: 80px;
    }

    /* Show only last, current, next month on tablet */
    .month-edge {
        display: none;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 0.5rem;
    }

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

    .topbar h1 {
        font-size: 1.05rem;
    }

    .card {
        margin: 1.5rem 0.25rem;
        padding: 1rem;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    .card input {
        padding: 0.6rem;
        font-size: 1rem;
    }

    .card button {
        padding: 0.7rem;
        font-size: 1rem;
    }

    .table-wrapper {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    th,
    td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .w-date {
        width: auto;
        min-width: 75px;
    }

    .w-time {
        width: auto;
        min-width: 45px;
    }

    .w-title {
        min-width: 120px;
    }

    .w-desc {
        min-width: 140px;
    }

    .filter-bar select,
    .filter-bar button {
        padding: 0.7rem 0.75rem;
        font-size: 1rem;
    }

    .filter-bar button {
        padding: 0.7rem;
    }

    hr {
        margin: 1.5rem 0;
    }
}
