/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

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

:root {
    --primary: #2a6fa5;
    --primary-dark: #1e4e76;
    --secondary: #6c757d;
    --success: #28a745;
    --error: #dc3545;
    --warning: #ffc107;
    --gray-light: #e9ecef;
    --gray: #ced4da;
    --dark: #343a40;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 40px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
    background: #f4f7fc;
    color: #1e2a3e;
    line-height: 1.5;
    padding: 1rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.app-grid,
.timetable-page {
    display: grid;
    gap: 1.5rem;
}

.timetable-page {
    margin: 1rem auto;
}

.panel {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.panel-head {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.panel-head h2, .panel-head h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.muted {
    color: #5a6e7c;
    font-size: 0.85rem;
}

.small {
    font-size: 0.8rem;
}

.sample-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #fff8e7, #ffefc0);
    border-left: 5px solid #f5a623;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-md);
    margin: 0 0 1.2rem 0;
    color: #7a5a1a;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.sample-banner i {
    font-size: 1.2rem;
    color: #e67e22;
}

.sample-banner strong {
    color: #b45f06;
}

.current-subject-container {
    background: linear-gradient(135deg, #e6f7ff 0%, #d4edff 100%);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    margin: 1rem 0 1rem;
    border-left: 5px solid #2a6fa5;
    box-shadow: var(--shadow-sm);
}

.current-subject-label {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #2a6fa5;
    display: block;
    margin-bottom: 0.5rem;
}

.current-subject-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a4a7a;
    line-height: 1.2;
}

.current-time-info {
    font-size: 0.85rem;
    color: #4a6fa5;
    margin-top: 0.5rem;
}

.timetable-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-light);
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.timetable-wrapper {
    overflow-x: auto;
    margin: 0 0 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.timetable-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.timetable-table td,
.timetable-table th {
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.timetable-table th,
.timetable-table td {
    padding: 0.85rem 0.5rem;
    text-align: center;
    border: 1px solid var(--gray-light);
    vertical-align: middle;
    transition: background 0.15s ease;
}

.timetable-table th {
    background: linear-gradient(135deg, #2a6fa5, #4a8fc5);
    color: white;
    font-weight: 600;
    position: relative;
}

.timetable-table td {
    cursor: pointer;
    background-color: #fff;
}

.timetable-table td:hover {
    background-color: #f0f9ff;
    box-shadow: inset 0 0 0 1px var(--primary);
}

.timetable-table td.current-period-col,
.timetable-table th.current-period-col {
    background-color: #fff3e0;
    position: relative;
}

.timetable-table th.current-period-col {
    background: linear-gradient(135deg, #e67e22, #f39c12);
}

.day-header {
    position: relative;
}

.remove-day-icon,
.remove-period-icon {
    margin-left: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s;
}

.remove-day-icon:hover,
.remove-period-icon:hover {
    color: #ffcccc;
}

.period-cell {
    position: relative;
    text-align: left !important;
    white-space: nowrap;
    cursor: pointer;
}

.period-cell .remove-period-icon {
    float: right;
    color: var(--gray);
    margin-top: 0.2rem;
}

.period-cell .remove-period-icon:hover {
    color: var(--error);
}

.config-section {
    display: grid;
    gap: 1.5rem;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-light);
    color: var(--dark);
}

.btn-primary {
    background: linear-gradient(135deg, #2a6fa5, #1e5a8a);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e5a8a, #144b73);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #1e2a3e;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

label.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
}

.tools-note {
    margin-top: 1rem;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 1.8rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h3 {
    margin-bottom: 1.2rem;
    color: #2a6fa5;
}

.modal-field {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal-field label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #2c3e50;
}

.modal-field input {
    padding: 0.7rem;
    border: 1px solid var(--gray);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: 0.2s;
}

.modal-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(42, 111, 165, 0.2);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.modal-close {
    float: right;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    color: #888;
    transition: 0.2s;
}

.modal-close:hover {
    color: #333;
}

@media (max-width: 640px) {
    .current-subject-value {
        font-size: 1.4rem;
    }

    .timetable-table th,
    .timetable-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }

    .period-cell .remove-period-icon {
        float: none;
        display: inline-block;
        margin-left: 0.5rem;
    }

    .modal-content {
        padding: 1.2rem;
        width: 95%;
    }
}