:root {
    --accent-color: #8186d5;

    --container-background: rgba(20, 29, 42, 1);

    --text-color: #ffffff;
    --text-muted: #ffffff;

    --container-shadow: rgba(0, 0, 0, 0.09) 0px 2px 1px, rgba(0, 0, 0, 0.09) 0px 4px 2px, rgba(0, 0, 0, 0.09) 0px 8px 4px, rgba(0, 0, 0, 0.09) 0px 16px 8px, rgba(0, 0, 0, 0.09) 0px 32px 16px;

    --table-border-color: #383a60;
}

.schedule-container {
    padding-bottom: 80px;
}

/* === HERO === */
.schedule-container .parallax-section1 {
    min-height: 300px;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    color: white;
}

.schedule-container .parallax-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

/* === SIDEBAR === */
.grades-sidebar {
    background: var(--container-background);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--container-shadow);
    text-align: center;
}

.sidebar-title {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.1rem;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
}

.grades-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.btn-grade {
    background: transparent;
    border: none;
    padding: 10px 0;
    text-align: center;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-grade:hover {
    color: var(--accent-color);
}

.btn-grade.active {
    color: var(--accent-color);
    font-weight: 600;
}

/* === SECTIONS === */
.sections-bar {
    background: radial-gradient(circle at 130% 300%, rgb(129, 134, 213), rgba(20, 29, 42, 1) 70%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--container-shadow);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-right: 30px;
}

.sections-title {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0;
    margin-right: 16px;
}

.sections-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-section {
    background: transparent;
    border: none;
    padding: 8px 0;
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-section:hover {
    color: var(--accent-color);
}

.btn-section.active {
    color: var(--accent-color);
    font-weight: 700;
}

/* === TABLE (Desktop) === */
.schedule-wrapper {
    background: var(--container-background);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--container-shadow);
    position: relative;
    min-height: 400px;
    margin-right: 30px;
}

.schedule-header h4 {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.2rem;
}

.schedule-header .text-primary {
    color: var(--accent-color) !important;
}

.schedule-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    border: 1px solid var(--table-border-color);
    table-layout: fixed;
    width: 100%;
}

.schedule-table thead th {
    background: var(--accent-color);
    color: white;
    text-align: center;
    font-weight: 600;
    padding: 14px 12px;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.95rem;
}

.schedule-table thead th:last-child {
    border-right: none;
}

.schedule-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.schedule-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.hour-column {
    width: 120px;
}

.day-column {
    width: calc((100% - 120px) / 5);
}

.hour-cell {
    background: rgba(255, 255, 255, 0.05);
    text-align: center;
    vertical-align: middle;
    border-right: 2px solid var(--accent-color) !important;
}

.hour-cell strong {
    color: var(--accent-color);
    font-size: 1.1rem;
}

.hour-cell small {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: block;
    margin-top: 2px;
}

.schedule-table tbody tr {
    transition: background 0.2s ease;
}

.schedule-table tbody tr:hover {
    background: rgba(224, 122, 60, 0.1);
}

.schedule-table tbody td {
    text-align: center;
    vertical-align: middle;
    padding: 14px 10px;
    border: 1px solid var(--table-border-color);
    color: var(--text-color);
}

.subject-cell {
    font-weight: 500;
}

.empty-cell {
    color: var(--text-muted);
}

/* === LOADING === */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 29, 35, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.loading-overlay .spinner-border {
    color: var(--accent-color) !important;
    width: 3rem;
    height: 3rem;
}

.loading-overlay {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-overlay.d-none {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   VISIBILITY: Desktop vs Mobile
   ============================================ */

.schedule-mobile {
    display: none;
}

.schedule-desktop {
    display: block;
}

@media (max-width: 1024px) {
    .schedule-desktop {
        display: none;
    }

    .schedule-mobile {
        display: block;
    }
}

/* ============================================
   MOBILE: Day Tabs
   ============================================ */

.day-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 5px;
}

.day-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 7px;
    font-weight: 500;
    font-size: 1.15rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    opacity: 0.6;
}

.day-tab:hover {
    opacity: 0.85;
    background: rgba(129, 134, 213, 0.1);
}

.day-tab.active {
    background: var(--accent-color);
    color: #ffffff;
    font-weight: 500;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(129, 134, 213, 0.35);
}

/* ============================================
   MOBILE: Day Panels
   ============================================ */

.day-panel {
    display: none;
}

.day-panel.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

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

.day-panel-title {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--table-border-color);
}

/* ============================================
   MOBILE: Period List Items
   ============================================ */

.period-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.period-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border-left: 3px solid var(--accent-color);
    transition: background 0.2s ease;
}

.period-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.period-item.period-empty {
    border-left-color: var(--table-border-color);
    opacity: 0.45;
}

.period-number {
    background: var(--accent-color);
    color: #ffffff;
    font-weight: 700;
    font-size: 1.15rem;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.period-empty .period-number {
    background: var(--table-border-color);
}

.period-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.period-subject {
    color: var(--text-color);
    font-weight: 500;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.period-empty .period-subject {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
    font-style: italic;
}

.period-time {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.95rem;
}

/* ============================================
   RESPONSIVE fine-tuning
   ============================================ */

@media (max-width: 1024px) {
    .grades-sidebar {
        margin-bottom: 20px;
    }

    .grades-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }

    .btn-grade {
        padding: 8px 12px;
        width: 100%;
        text-align: center;
    }

    .sections-bar {
        flex-direction: column;
        align-items: flex-start;
        margin-right: 0;
    }

    .sections-title {
        margin-bottom: 12px;
    }

    .sections-buttons {
        gap: 30px;
    }

    .schedule-wrapper {
        padding: 16px;
        margin-right: 0;
    }

    .schedule-container {
        padding-bottom: 50px;
    }

    .schedule-container .parallax-section1 {
        background-attachment: scroll;
    }
}

@media (max-width: 400px) {
    .day-tab {
        font-size: 0.85rem;
        padding: 8px 2px;
    }

    .period-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .period-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .period-subject {
        font-size: 0.9rem;
    }
}