/* ===========================
   CSS Custom Properties
   =========================== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #161625;
    --bg-tertiary: #1e1e32;
    --bg-card: #1a1a2e;
    --bg-hover: #252540;
    --bg-glass: rgba(30, 30, 50, 0.7);

    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b82;
    --text-inverse: #0f0f1a;

    --accent-primary: #6366f1;
    --accent-primary-hover: #5558e6;
    --accent-primary-glow: rgba(99, 102, 241, 0.25);
    --accent-secondary: #8b5cf6;
    --accent-danger: #ef4444;
    --accent-danger-hover: #dc2626;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(99, 102, 241, 0.4);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--accent-primary-glow);

    --sidebar-width: 260px;
    --header-height: 64px;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.93rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    text-align: left;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent-primary-glow);
    color: var(--accent-primary);
}

.nav-btn.active svg {
    stroke: var(--accent-primary);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    min-height: 100vh;
}

.section {
    display: none;
    animation: fadeIn 0.35s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===========================
   View Switcher
   =========================== */
.view-switcher {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border-color);
}

.view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 12px var(--accent-primary-glow);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 4px 20px var(--accent-primary-glow);
    transform: translateY(-1px);
}

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

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--accent-danger-hover);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

/* ===========================
   Filter Bar
   =========================== */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    min-width: 220px;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23a0a0b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* ===========================
   Schedule Grid
   =========================== */
.schedule-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    margin-bottom: 24px;
}

.schedule-grid {
    display: grid;
    min-width: 900px;
}

.schedule-grid.cols-6 {
    grid-template-columns: 120px repeat(5, 1fr);
}

.schedule-grid.cols-7 {
    grid-template-columns: 120px repeat(6, 1fr);
}

.grid-header {
    background: var(--bg-tertiary);
    padding: 14px 12px;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.grid-header:last-child {
    border-right: none;
}

.grid-header.corner {
    background: var(--bg-secondary);
}

.grid-time {
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    text-align: center;
}

.grid-time .time-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.grid-time .time-range {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.grid-cell {
    padding: 6px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    min-height: 64px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

.grid-cell:hover {
    background: var(--bg-hover);
}

.grid-cell:last-child {
    border-right: none;
}

.grid-cell.selected {
    background: var(--accent-primary-glow);
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    border-radius: 2px;
}

/* Lesson Card in Grid Cell */
.lesson-card {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: white;
    position: relative;
    cursor: default;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.lesson-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    border-radius: inherit;
}

.lesson-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lesson-card .lc-lesson {
    font-weight: 700;
    font-size: 0.82rem;
    position: relative;
    z-index: 1;
}

.lesson-card .lc-info {
    font-size: 0.7rem;
    opacity: 0.85;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.lesson-card .lc-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 2;
    line-height: 1;
}

.lesson-card:hover .lc-remove {
    opacity: 1;
}

.lc-remove:hover {
    background: rgba(239, 68, 68, 0.8) !important;
}

/* ===========================
   Assignment Panel
   =========================== */
.assignment-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.assignment-panel h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.panel-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.assignment-form {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.assignment-form .form-group {
    flex: 1;
    min-width: 160px;
}

.selected-slot {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
    border: 1px solid var(--border-active);
}

.conflict-warning {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-danger);
    font-size: 0.85rem;
    font-weight: 500;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 4px;
}

/* ===========================
   Cards Grid
   =========================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.cards-grid-small {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent-primary));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.card-actions {
    display: flex;
    gap: 2px;
}

.card-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.card-detail svg {
    opacity: 0.5;
}

.card-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ===========================
   Empty State
   =========================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* ===========================
   Forms
   =========================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
}

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23a0a0b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

.form-input:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* Color Picker */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-primary), var(--shadow-glow);
}

/* ===========================
   Modal
   =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
    box-shadow: var(--shadow-lg);
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-small {
    max-width: 380px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--accent-danger);
    color: white;
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===========================
   Toast
   =========================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    animation: toastIn 0.4s ease, toastOut 0.3s ease 2.7s forwards;
    min-width: 260px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    background: linear-gradient(135deg, #059669, #10b981);
}

.toast.error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast.warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.toast.info {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ===========================
   General View Table
   =========================== */
.all-view-header {
    grid-column: 1 / -1;
    background: var(--accent-primary);
    color: white;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.all-view-header .teacher-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    body {
        background: white !important;
        color: #1a1a2e !important;
    }

    .sidebar,
    .assignment-panel,
    .filter-bar,
    .header-actions,
    .section-header .btn,
    .lc-remove,
    .toast-container,
    .modal,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 10px !important;
    }

    .section-header h2 {
        color: #1a1a2e !important;
        font-size: 1.4rem !important;
    }

    .section-subtitle {
        color: #666 !important;
    }

    .schedule-wrapper {
        border: 2px solid #333 !important;
        border-radius: 0 !important;
        background: white !important;
    }

    .schedule-grid {
        min-width: unset !important;
    }

    .grid-header {
        background: #f0f0f0 !important;
        color: #333 !important;
        border-color: #ccc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .grid-time {
        background: #f8f8f8 !important;
        color: #555 !important;
        border-color: #ccc !important;
    }

    .grid-cell {
        border-color: #ccc !important;
        background: white !important;
    }

    .lesson-card {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 0.7rem !important;
    }

    .lesson-card .lc-lesson {
        font-size: 0.75rem !important;
    }

    .lesson-card .lc-info {
        font-size: 0.65rem !important;
    }

    .filter-bar,
    .view-switcher {
        display: none !important;
    }

    /* Show print title */
    .print-title {
        display: block !important;
        text-align: center;
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 10px;
        color: #1a1a2e;
    }
}

.print-title {
    display: none;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .assignment-form {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
    }
}

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===========================
   Selection
   =========================== */
::selection {
    background: var(--accent-primary);
    color: white;
}

/* ===========================
   New UI Elements (Lock, Checkboxes)
   =========================== */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.grid-cell.closed-slot {
    background: repeating-linear-gradient(45deg,
            var(--bg-tertiary),
            var(--bg-tertiary) 10px,
            var(--bg-secondary) 10px,
            var(--bg-secondary) 20px) !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.grid-cell.closed-slot::after {
    content: 'Kapalı';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
}

body.lock-mode-active .grid-cell {
    cursor: cell;
}

body.lock-mode-active .grid-cell:hover {
    background: rgba(239, 68, 68, 0.1);
    box-shadow: inset 0 0 0 2px var(--accent-danger);
}

/* When lock mode is active and hovering a cell WITH a lesson card */
body.lock-mode-active .grid-cell:has(.lesson-card):hover {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 0 0 2px var(--accent-primary);
}

body.lock-mode-active .grid-cell:has(.lesson-card.locked):hover {
    background: rgba(245, 158, 11, 0.1);
    box-shadow: inset 0 0 0 2px var(--accent-warning);
}

#btn-lock-mode.active {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ===========================
   Locked Lesson Cards
   =========================== */
.lesson-card.locked {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: -2px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.lesson-card.locked::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
            transparent,
            transparent 6px,
            rgba(255, 255, 255, 0.04) 6px,
            rgba(255, 255, 255, 0.04) 12px);
    border-radius: inherit;
    pointer-events: none;
}

.lc-lock-icon {
    font-size: 0.7rem;
    margin-right: 3px;
    display: inline-block;
    animation: lockPulse 2s ease-in-out infinite;
}

@keyframes lockPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ===========================
   Settings Page
   =========================== */
.settings-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
}

.settings-form-card,
.settings-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.settings-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.settings-card-title svg {
    stroke: var(--accent-primary);
    flex-shrink: 0;
}

.settings-group {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.settings-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.settings-group .form-group {
    margin-bottom: 0;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 0;
}

.input-with-unit .form-input {
    flex: 1;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-unit {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 0 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    height: 40px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Settings Preview */
.preview-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.preview-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.morning-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.lunch-badge {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.afternoon-badge {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.total-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.preview-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

.preview-slots::-webkit-scrollbar {
    width: 4px;
}

.preview-slots::-webkit-scrollbar-track {
    background: transparent;
}

.preview-slots::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.preview-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    animation: slideInRow 0.15s ease;
}

@keyframes slideInRow {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.preview-slot.morning {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid #6366f1;
}

.preview-slot.lunch {
    background: rgba(245, 158, 11, 0.12);
    border-left: 3px solid #f59e0b;
}

.preview-slot.afternoon {
    background: rgba(139, 92, 246, 0.08);
    border-left: 3px solid #8b5cf6;
}

.ps-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.ps-time {
    flex: 1;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.ps-dur {
    color: var(--text-muted);
    font-size: 0.75rem;
    background: var(--bg-hover);
    padding: 2px 7px;
    border-radius: 4px;
}

/* ===========================
   Eksiklik Raporu
   =========================== */
.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.summary-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-subtext {
    font-size: 1rem;
    font-weight: normal;
    color: var(--text-muted);
}

.report-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.report-table th,
.report-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.report-table th {
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-table tr:hover td {
    background: var(--bg-hover);
}

.report-table td.text-center,
.report-table th.text-center {
    text-align: center;
}

.font-bold {
    font-weight: bold;
}

.text-danger {
    color: var(--accent-danger) !important;
}

.text-warning {
    color: var(--accent-warning) !important;
}

.text-success {
    color: var(--accent-success) !important;
}

/* ===========================
   All Classrooms View
   =========================== */
#all-classrooms-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.ac-classroom-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition-normal);
}

.ac-classroom-block:hover {
    box-shadow: var(--shadow-md);
}

.ac-classroom-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.ac-classroom-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: -0.01em;
}

.ac-classroom-dept {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--accent-primary-glow);
    color: var(--accent-primary);
    border: 1px solid var(--border-active);
}

.ac-classroom-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ac-table-wrapper {
    overflow-x: auto;
}

.ac-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.ac-table th,
.ac-table td {
    border: 1px solid var(--border-color);
    vertical-align: middle;
}

.ac-time-th {
    background: var(--bg-secondary);
    padding: 10px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    width: 90px;
    min-width: 80px;
}

.ac-day-th {
    background: var(--bg-tertiary);
    padding: 10px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 90px;
}

.ac-time-cell {
    background: var(--bg-secondary);
    padding: 6px 8px;
    text-align: center;
    vertical-align: middle;
}

.ac-time-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.ac-time-range {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.ac-cell {
    padding: 5px;
    height: 54px;
    text-align: center;
    vertical-align: middle;
    position: relative;
    transition: background var(--transition-fast);
}

.ac-cell-na {
    background: var(--bg-secondary);
    opacity: 0.4;
}

.ac-cell-closed {
    background: repeating-linear-gradient(45deg,
            var(--bg-tertiary),
            var(--bg-tertiary) 5px,
            var(--bg-secondary) 5px,
            var(--bg-secondary) 10px);
    opacity: 0.6;
}


.ac-lesson-card {
    border-radius: var(--radius-sm);
    padding: 5px 7px;
    color: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.ac-lesson-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent);
    border-radius: inherit;
}

.ac-lesson-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ac-lc-lesson {
    font-weight: 700;
    font-size: 0.78rem;
    position: relative;
    z-index: 1;
    line-height: 1.2;
}

.ac-lc-teacher {
    font-size: 0.65rem;
    opacity: 0.88;
    position: relative;
    z-index: 1;
    line-height: 1.2;
    font-weight: 400;
}

.ac-no-lesson {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===========================
   Master Table (Toplu Tablo) View
   =========================== */
.mt-table-wrapper {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.master-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 1000px;
}

.master-table th,
.master-table td {
    border: 1px solid var(--border-color);
    vertical-align: middle;
}

.master-table th {
    background: var(--bg-tertiary);
    padding: 12px 8px;
    color: var(--text-primary);
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.mt-th-day {
    width: 45px;
}

.mt-th-time {
    width: 90px;
}

.mt-day-cell {
    width: 45px;
    text-align: center;
    padding: 0;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
}

.mt-day-bg-0 {
    background-color: #fef08a;
}

/* Mon: Yellowish */
.mt-day-bg-1 {
    background-color: #bbf7d0;
}

/* Tue: Greenish */
.mt-day-bg-2 {
    background-color: #fbcfe8;
}

/* Wed: Pinkish */
.mt-day-bg-3 {
    background-color: #bfdbfe;
}

/* Thu: Blueish */
.mt-day-bg-4 {
    background-color: #fed7aa;
}

/* Fri: Orangeish */
.mt-day-bg-5 {
    background-color: #e9d5ff;
}

/* Sat: Purplish */
.mt-day-bg-6 {
    background-color: #cbd5e1;
}

/* Sun: Grayish */

.vertical-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: auto;
    letter-spacing: 2px;
}

.mt-time-cell {
    background: var(--bg-secondary);
    text-align: center;
    padding: 4px 6px;
    font-weight: 600;
    color: var(--text-muted);
}

.mt-data-cell {
    text-align: center;
    padding: 4px;
    font-weight: 700;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
    height: 48px;
    transition: filter 0.15s ease;
}

.mt-data-cell:hover {
    filter: brightness(1.1);
}

.mt-cell-closed {
    background: repeating-linear-gradient(45deg, var(--bg-tertiary), var(--bg-tertiary) 4px, var(--bg-secondary) 4px, var(--bg-secondary) 8px) !important;
}

.mt-break-row {
    background: rgba(255, 255, 255, 0.05);
}

.mt-break-cell {
    text-align: center;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 6px;
    background: repeating-linear-gradient(45deg, #fef08a11, #fef08a11 10px, transparent 10px, transparent 20px);
}

.mt-day-start-row>td {
    border-top: 3px solid var(--border-active) !important;
}

/* Master Table Reorder Header UI */
.mt-th-class {
    position: relative;
    padding: 0 !important;
}

.mt-th-class-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    height: 100%;
}

.mt-th-class-name {
    flex-grow: 1;
    text-align: center;
    padding: 0 4px;
    font-size: 0.85rem;
}

.mt-order-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mt-order-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    opacity: 1;
    transform: scale(1.1);
}

.mt-order-btn:active {
    transform: scale(0.95);
}

.mt-order-btn-placeholder {
    width: 24px;
    /* matching button width roughly */
    display: inline-block;
}