﻿/* =========================================================
   TIMETABLE GRID — Ders Programı CSS
   variables.css'den beslenir
========================================================= */

.tg-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


.tg-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.tg-th {
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--dash-text-2);
    text-align: center;
    border-bottom: 1px solid var(--dash-border);
    background: var(--dash-surface-2);
    white-space: nowrap;
}

.tg-th--period {
    width: 112px;
    min-width: 112px;
}

.tg-th--day {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 132px;
}
.tg-period-cell {
    padding: 0;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid var(--dash-border);
    border-bottom: 1px solid var(--dash-border-light);
    background: var(--dash-surface-2);
    width: 112px;
    min-width: 112px;
    white-space: nowrap;
}
.tg-period-meta {
    min-height: 88px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.tg-period-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--dash-text-1);
    line-height: 1;
}

.tg-period-time {
    font-size: 11px;
    color: var(--dash-text-3);
    white-space: nowrap;
    line-height: 1.15;
    letter-spacing: -0.01em;
}


.tg-slot-cell {
    padding: 4px;
    vertical-align: top;
    border-bottom: 1px solid var(--dash-border-light);
    border-right: 1px solid var(--dash-border-light);
    min-height: 88px;
    height: 88px;
    min-width: 132px;
}

.tg-slot-cell--interactive {
    cursor: pointer;
    transition: background var(--t-fast);
}

    .tg-slot-cell--interactive:hover {
        background: var(--dash-surface-2);
    }

.tg-slot {
    height: 100%;
    min-height: 72px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--slot-color) 10%, white);
    border: 1px solid color-mix(in srgb, var(--slot-color) 25%, transparent);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.tg-slot-cell--interactive .tg-slot:hover {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--slot-color) 30%, transparent);
    transform: translateY(-1px);
}

.tg-slot__stripe {
    height: 4px;
    background: var(--slot-color);
    flex-shrink: 0;
}

.tg-slot__body {
    padding: 5px 7px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    min-width: 0; /* flex child'ın taşmamasını sağlar */
}

.tg-slot__subject {
    font-size: 12px;
    font-weight: 800;
    color: var(--dash-text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-width: 0;
}

.tg-slot__teachers {
    font-size: 11px;
    color: var(--dash-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tg-slot__room {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--dash-text-3);
    margin-top: 2px;
    min-width: 0;
    overflow: hidden;
}

    .tg-slot__room span:last-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.tg-slot__room-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--slot-color);
    flex-shrink: 0;
}

.tg-slot__substitute {
    font-size: 10px;
    color: var(--c-warning);
    font-weight: 700;
    font-style: italic;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tg-slot__week-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: var(--r-full);
    background: color-mix(in srgb, var(--slot-color) 18%, white);
    color: color-mix(in srgb, var(--slot-color) 80%, black);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tg-slot__status-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: var(--r-full);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tg-slot__status-badge--cancelled {
    background: var(--c-error-light);
    color: var(--c-error);
}

.tg-slot-empty {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1.5px dashed var(--dash-border);
    opacity: 0;
    transition: opacity var(--t-fast);
}

.tg-slot-cell--interactive:hover .tg-slot-empty {
    opacity: 1;
}

.tg-slot-cell--multi {
    height: auto;
}

.tg-slot-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 72px;
}

.tg-slot {
    height: auto;
    min-height: 72px;
}

.tg-slot--cancelled {
    opacity: 0.72;
}

.tg-slot--locked {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-primary) 30%, transparent);
}

.tg-slot__badge-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tg-slot__status-badge--substituted {
    background: var(--c-warning-light);
    color: var(--c-warning);
}

.tg-slot__status-badge--locked {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}
.tg-slot__status-badge--linked {
    background: var(--c-info-light);
    color: var(--c-info);
}
/* ── Overview tab bar ── */
.tg-class-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--dash-text-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--t-fast), border-color var(--t-fast);
    font-family: var(--font);
}

    .tg-class-tab:hover {
        color: var(--dash-text-1);
    }

.tg-class-tab--active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.tg-class-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--r-full);
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-size: 10px;
    font-weight: 700;
}

/* ── Dark mode ── */
.dash-shell.dark .tg-th,
.dash-shell.dark .tg-period-cell {
    background: var(--dash-dark-surface-2);
    border-color: var(--dash-dark-border);
    color: var(--dash-dark-text-2);
}

.dash-shell.dark .tg-period-num {
    color: var(--dash-dark-text-1);
}

.dash-shell.dark .tg-period-time {
    color: var(--dash-dark-text-3);
}

.dash-shell.dark .tg-slot-cell {
    border-color: var(--dash-dark-border);
}

.dash-shell.dark .tg-slot-cell--interactive:hover {
    background: var(--dash-dark-surface-2);
}

.dash-shell.dark .tg-slot {
    background: color-mix(in srgb, var(--slot-color) 18%, #0d1f1a);
    border-color: color-mix(in srgb, var(--slot-color) 30%, transparent);
}

.dash-shell.dark .tg-slot__subject {
    color: var(--dash-dark-text-1);
}

.dash-shell.dark .tg-slot__teachers {
    color: var(--dash-dark-text-2);
}

.dash-shell.dark .tg-slot__room {
    color: var(--dash-dark-text-3);
}

.dash-shell.dark .tg-slot-empty {
    border-color: var(--dash-dark-border);
}

.dash-shell.dark .tg-class-tab {
    color: var(--dash-dark-text-2);
}

    .dash-shell.dark .tg-class-tab:hover {
        color: var(--dash-dark-text-1);
    }

.dash-shell.dark .tg-class-tab--active {
    color: #e08a4f;
    border-bottom-color: #c4622d;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .tg-th--period,
    .tg-period-cell {
        min-width: 84px;
        width: 84px;
    }
    .tg-th--day,
    .tg-slot-cell {
        min-width: 96px;
    }

    .tg-slot__teachers,
    .tg-slot__room {
        display: none;
    }
    .tg-slot__subject {
        font-size: 11px;
    }

    .tg-period-time {
        font-size: 10px;
    }
}

@media (max-width: 600px) {
    .tg-th--period,
    .tg-period-cell {
        min-width: 72px;
        width: 72px;
    }

    .tg-th--day,
    .tg-slot-cell {
        min-width: 84px;
    }
    .tg-slot-cell {
        min-height: 72px;
        height: 72px;
    }
    .tg-period-meta {
        min-height: 72px;
        padding: 8px 6px;
    }
    .tg-period-num {
        font-size: 16px;
    }
    .tg-period-time {
        font-size: 9px;
    }
    .tg-slot {
        min-height: 52px;
    }

    .tg-period-time {
        font-size: 9px;
    }
}


.tg-th {
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--dash-text-2);
    text-align: center;
    border-bottom: 1px solid var(--dash-border);
    background: var(--dash-surface-2);
    white-space: nowrap;
}

.tg-th--period {
    width: 72px;
    min-width: 72px;
}

.tg-th--day {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tg-period-cell {
    padding: 8px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid var(--dash-border);
    border-bottom: 1px solid var(--dash-border-light);
    background: var(--dash-surface-2);
    min-width: 72px;
}

.tg-period-num {
    font-size: 15px;
    font-weight: 800;
    color: var(--dash-text-1);
    line-height: 1;
}

.tg-period-time {
    margin-top: 4px;
    font-size: 11px;
    color: var(--dash-text-3);
    white-space: nowrap;
}

.tg-slot-cell {
    padding: 4px;
    vertical-align: top;
    border-bottom: 1px solid var(--dash-border-light);
    border-right: 1px solid var(--dash-border-light);
    min-height: 80px;
    height: 80px;
}

.tg-slot-cell--interactive {
    cursor: pointer;
    transition: background var(--t-fast);
}

    .tg-slot-cell--interactive:hover {
        background: var(--dash-surface-2);
    }

.tg-slot {
    height: 100%;
    min-height: 72px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--slot-color) 10%, white);
    border: 1px solid color-mix(in srgb, var(--slot-color) 25%, transparent);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.tg-slot-cell--interactive .tg-slot:hover {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--slot-color) 30%, transparent);
    transform: translateY(-1px);
}

.tg-slot__stripe {
    height: 4px;
    background: var(--slot-color);
    flex-shrink: 0;
}

.tg-slot__body {
    padding: 6px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.tg-slot__subject {
    font-size: 12px;
    font-weight: 800;
    color: var(--dash-text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.tg-slot__teachers {
    font-size: 11px;
    color: var(--dash-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-slot__room {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--dash-text-3);
    margin-top: 2px;
}

.tg-slot__room-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--slot-color);
    flex-shrink: 0;
}

.tg-slot__substitute {
    font-size: 10px;
    color: var(--c-warning);
    font-weight: 700;
    font-style: italic;
    margin-top: 2px;
}

.tg-slot__week-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: var(--r-full);
    background: color-mix(in srgb, var(--slot-color) 18%, white);
    color: color-mix(in srgb, var(--slot-color) 80%, black);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tg-slot__status-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: var(--r-full);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tg-slot__status-badge--cancelled {
    background: var(--c-error-light);
    color: var(--c-error);
}

.tg-slot-empty {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1.5px dashed var(--dash-border);
    opacity: 0;
    transition: opacity var(--t-fast);
}

.tg-slot-cell--interactive:hover .tg-slot-empty {
    opacity: 1;
}

.tg-slot-cell--multi {
    height: auto;
}

.tg-slot-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 72px;
}

.tg-slot {
    height: auto;
    min-height: 72px;
}

.tg-slot--cancelled {
    opacity: 0.72;
}

.tg-slot--locked {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-primary) 30%, transparent);
}

.tg-slot__badge-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tg-slot__status-badge--substituted {
    background: var(--c-warning-light);
    color: var(--c-warning);
}

.tg-slot__status-badge--locked {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}
.tg-slot__status-badge--linked {
    background: var(--c-info-light);
    color: var(--c-info);
}
/* ── Overview tab bar ── */
.tg-class-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--dash-text-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--t-fast), border-color var(--t-fast);
    font-family: var(--font);
}

    .tg-class-tab:hover {
        color: var(--dash-text-1);
    }

.tg-class-tab--active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.tg-class-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--r-full);
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-size: 10px;
    font-weight: 700;
}

/* ── Dark mode ── */
.dash-shell.dark .tg-th,
.dash-shell.dark .tg-period-cell {
    background: var(--dash-dark-surface-2);
    border-color: var(--dash-dark-border);
    color: var(--dash-dark-text-2);
}

.dash-shell.dark .tg-period-num {
    color: var(--dash-dark-text-1);
}

.dash-shell.dark .tg-period-time {
    color: var(--dash-dark-text-3);
}

.dash-shell.dark .tg-slot-cell {
    border-color: var(--dash-dark-border);
}

.dash-shell.dark .tg-slot-cell--interactive:hover {
    background: var(--dash-dark-surface-2);
}

.dash-shell.dark .tg-slot {
    background: color-mix(in srgb, var(--slot-color) 18%, #0d1f1a);
    border-color: color-mix(in srgb, var(--slot-color) 30%, transparent);
}

.dash-shell.dark .tg-slot__subject {
    color: var(--dash-dark-text-1);
}

.dash-shell.dark .tg-slot__teachers {
    color: var(--dash-dark-text-2);
}

.dash-shell.dark .tg-slot__room {
    color: var(--dash-dark-text-3);
}

.dash-shell.dark .tg-slot-empty {
    border-color: var(--dash-dark-border);
}

.dash-shell.dark .tg-class-tab {
    color: var(--dash-dark-text-2);
}

    .dash-shell.dark .tg-class-tab:hover {
        color: var(--dash-dark-text-1);
    }

.dash-shell.dark .tg-class-tab--active {
    color: #e08a4f;
    border-bottom-color: #c4622d;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .tg-th--period, .tg-period-cell {
        min-width: 52px;
        width: 52px;
    }

    .tg-slot__teachers, .tg-slot__room {
        display: none;
    }

    .tg-slot__subject {
        font-size: 11px;
    }
}
