:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

html, body {
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Elimină definitiv a doua bară de derulare (pe pagină) */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Aplicație LTHC */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 6px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-v-divider {
    width: 1px;
    height: 30px;
    background-color: #e2e8f0;
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
}
.brand-wrapper:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.brand-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-custom-logo {
    height: 44px;
    width: auto;
    max-height: 44px;
    max-width: none;
    object-fit: contain;
    display: block;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #1e3a8a 0%, #0284c7 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.brand-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Navigare Module LTHC (Modul Orare cu submeniu) */
.app-modules-nav {
    display: flex;
    align-items: center;
}

.module-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.module-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--primary);
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.module-tab-btn:hover {
    filter: brightness(1.08);
}

.module-arrow {
    font-size: 9px;
    transition: transform 0.2s ease;
    opacity: 0.85;
}

.module-dropdown-wrapper.open .module-arrow {
    transform: rotate(180deg);
}

.module-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    z-index: 1100;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 290px;
    padding: 6px;
    display: none;
    animation: fadeInMenu 0.15s ease-out;
}

.module-dropdown-wrapper.open .module-menu-dropdown {
    display: block;
}

.module-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.module-menu-item:hover {
    background-color: #f1f5f9;
}

.module-menu-item.active {
    background-color: var(--primary-light);
}

.module-menu-item .m-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.module-menu-item .m-text {
    display: flex;
    flex-direction: column;
}

.module-menu-item .m-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.module-menu-item.active .m-title {
    color: var(--primary);
}

.module-menu-item .m-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.module-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ==========================================================================
   ECRAN APLICAȚIE & MODUL DE AUTENTIFICARE DEDICAT (FULLSCREEN LOGIN GATE)
   ========================================================================== */

.app-screen-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.auth-fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
}

.auth-card {
    background: #ffffff;
    border-radius: 18px;
    width: 100%;
    max-width: 440px;
    padding: 38px 32px 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    animation: modalFadeIn 0.25s ease-out;
    box-sizing: border-box;
    text-align: center;
}

.auth-card-header {
    margin-bottom: 24px;
}

.auth-logo-box {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    font-size: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px -3px rgba(79, 70, 229, 0.35);
    margin-bottom: 14px;
}

.auth-custom-logo {
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
    margin: 0 0 4px 0;
}

.auth-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 12px 0;
    font-weight: 500;
}

.auth-badge {
    display: inline-block;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 9999px;
    border: 1px solid #e0e7ff;
}

.auth-form {
    margin-bottom: 16px;
}

.auth-form-group {
    margin-bottom: 16px;
    text-align: left;
}

.auth-form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 12px;
    font-size: 15px;
    pointer-events: none;
    color: #94a3b8;
}

.auth-input-field {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 38px;
    background-color: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input-field:focus {
    background-color: #ffffff;
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.auth-error-alert {
    padding: 10px 14px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 12.5px;
    margin-bottom: 16px;
    text-align: left;
    font-weight: 500;
}

.btn-auth-submit {
    width: 100%;
    height: 46px;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-auth-submit:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
    transform: translateY(-1px);
}

.auth-demo-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Buton Conectare în Antet */
.btn-header-login {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    font-size: 12.5px;
    padding: 7px 16px;
    border-radius: 9999px;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-header-login:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

/* Grup Navigare Utilizator (Stil Diakonia) */
.user-nav-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 3px 6px 3px 8px;
    border-radius: 9999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.user-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 2px 4px;
    border-radius: 9999px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
.user-profile-chip:hover .user-name {
    color: var(--primary);
}

.user-avatar-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.user-profile-chip:hover .user-avatar-badge {
    transform: scale(1.05);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-right: 4px;
    cursor: pointer;
}

.user-name {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease;
}

.user-role {
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    text-transform: capitalize;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-logout {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    color: #dc2626;
    padding: 4px 10px;
    border-radius: 9999px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-logout:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.auth-icon-bubble {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.btn-quick-fill {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-quick-fill:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.stats-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stats-bar .btn {
    padding: 6px 13px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stats-bar .btn:hover {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.stat-chip {
    background-color: #f1f5f9;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
}

.stat-chip span {
    color: var(--primary);
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

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

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

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: #f1f5f9;
}

/* Main Container - Full Screen Layout cu Scroll Exclusiv pe Grilă */
.main-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Control Panel / Filter bar */
.controls-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    position: relative;
    z-index: 95;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* Mode Switcher Tabs */
.view-tabs {
    display: flex;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.view-tab {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-tab.active {
    background-color: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Select Dropdowns */
.select-styled {
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: white;
    color: var(--text-main);
    font-weight: 500;
    outline: none;
    min-width: 190px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.select-styled:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Timetable Grid */
.timetable-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.timetable-header-info {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.current-target-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-target-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.timetable-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.timetable-table th,
.timetable-table td {
    border: 1px solid var(--border);
    vertical-align: top;
}

.timetable-table th {
    background-color: #f8fafc;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    text-align: center;
}

.timetable-table th.time-col-header {
    width: 140px;
}

.period-cell {
    background-color: #f8fafc;
    padding: 12px 10px;
    text-align: center;
    user-select: none;
    vertical-align: middle;
}

.period-time-direct {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.3px;
    white-space: nowrap;
    display: inline-block;
    padding: 4px 6px;
}

.period-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.period-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

.slot-cell {
    padding: 8px;
    min-height: 96px;
    height: 96px;
    background-color: #ffffff;
    transition: background-color 0.2s;
    position: relative;
}

.slot-cell:hover {
    background-color: #fcfcfc;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
}

/* Individual Lesson Card */
.lesson-card {
    background: #ffffff;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    user-select: none;
}

.lesson-card:active {
    cursor: grabbing;
}

.lesson-card.dragging {
    opacity: 0.35;
    transform: scale(0.95);
    cursor: grabbing;
}

.lesson-card.locked {
    cursor: not-allowed;
}

/* Drag and Drop Slot Highlights */
.slot-cell.drag-over {
    outline: 2px dashed #4f46e5 !important;
    background-color: #f1f5f9 !important;
}

/* Toast Notifications */
.app-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999999;
    background: #1e293b;
    color: white;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-lg);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
    font-size: 13px;
}

.app-toast.visible,
.app-toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.app-toast-undo {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: background 0.2s;
}

.app-toast-undo:hover {
    background: #4338ca;
}

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

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
}

.card-subject {
    font-weight: 700;
    font-size: 13px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-week-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
}

.card-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #475569;
    flex-wrap: wrap;
    gap: 4px;
}

.card-teacher, .card-class {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.card-room-badge {
    background-color: #f1f5f9;
    color: #475569;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.card-group-badge {
    background-color: #fef3c7;
    color: #92400e;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-val {
    font-weight: 500;
    color: var(--text-main);
    text-align: right;
}

.card-locked-badge {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.lesson-card.locked {
    background: #fffdfd;
    border-right: 2px dashed #fca5a5;
    border-bottom: 2px dashed #fca5a5;
}

/* Modal Wide for Teacher Availability */
.modal-content.modal-wide {
    max-width: 950px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-scrollable {
    overflow-y: auto;
    padding-right: 6px;
    margin-top: 12px;
}

.avail-search-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.avail-search-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
}

.avail-search-input:focus {
    border-color: var(--primary);
}

.avail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.avail-table th, .avail-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.avail-table th {
    background-color: #f8fafc;
    font-weight: 700;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 10;
}

.teacher-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    display: inline-block;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #10b981;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.days-checkboxes {
    display: flex;
    gap: 6px;
}

.day-box {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    cursor: pointer;
}

.day-box input {
    cursor: pointer;
}

.day-box.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Combinations & Solver UI */
.comb-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin: 14px 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.comb-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
}

.comb-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.comb-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.comb-badge-direct {
    background-color: #dcfce7;
    color: #15803d;
}

.comb-badge-swap {
    background-color: #dbeafe;
    color: #1e40af;
}

.comb-desc {
    font-size: 13px;
    color: #334155;
    flex: 1;
}

.btn-apply-comb {
    background-color: #10b981;
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.btn-apply-comb:hover {
    background-color: #059669;
}

/* Print Styles - Fără culori, tabel clasic delimitat complet, fără chenare mici per oră */
@media print {
    .app-header, 
    .controls-card, 
    .btn, 
    .stat-chip, 
    .toast-notification, 
    .modal-overlay, 
    .grid-helper-tip,
    #brandHomeLink {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .main-container {
        padding: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Formatare orar individual la printare / export PDF */
    .timetable-wrapper {
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    .timetable-header-info {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-bottom: 2px solid #000000 !important;
        padding-bottom: 8px !important;
        margin-bottom: 12px !important;
    }

    .current-target-title {
        font-size: 18px !important;
        font-weight: 700 !important;
        color: #000000 !important;
    }

    .current-target-meta {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #000000 !important;
    }

    /* Tabel clasic cu toate liniile continue delimitând clar zilele și orele */
    .timetable-table {
        width: 100% !important;
        border-collapse: collapse !important;
        border: 2px solid #000000 !important;
        table-layout: fixed !important;
        margin: 0 !important;
    }

    .timetable-table th, 
    .timetable-table td {
        border: 1px solid #000000 !important;
        color: #000000 !important;
        background: #ffffff !important;
        padding: 8px 6px !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    .timetable-table th {
        font-weight: 700 !important;
        font-size: 13px !important;
        background-color: #f1f5f9 !important;
        text-transform: uppercase !important;
        border-bottom: 2px solid #000000 !important;
    }

    .timetable-table td.period-cell {
        background-color: #ffffff !important;
        border-right: 2px solid #000000 !important;
        width: 120px !important;
        min-width: 120px !important;
        text-align: center !important;
    }

    .period-time-direct {
        font-size: 13.5px !important;
        font-weight: 700 !important;
        color: #000000 !important;
        white-space: nowrap !important;
        display: block !important;
    }

    /* ELIMINARE CHENARE MICI: orele sunt direct în celulă fără chenare sau cutii */
    .timetable-wrapper .cards-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .timetable-wrapper .lesson-card {
        background: transparent !important;
        color: #000000 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 2px 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .timetable-wrapper .lesson-card * {
        color: #000000 !important;
        background: transparent !important;
    }

    .timetable-wrapper .card-subject {
        font-weight: 700 !important;
        font-size: 13px !important;
        color: #000000 !important;
        line-height: 1.2 !important;
    }

    .timetable-wrapper .card-meta {
        font-size: 11px !important;
        font-weight: 500 !important;
        color: #222222 !important;
        line-height: 1.2 !important;
    }
}



/* ==========================================================================
   STILURI aSc MASTER GRID, DROPDOWN NAVIGARE ȘI TOOLTIP INSTANTANEU
   ========================================================================== */

/* Dropdown Meniu aSc */
.asc-dropdown-container {
    position: relative;
    display: inline-block;
}

.asc-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background-color: #ffffff;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.1);
    transition: all 0.2s ease;
}

.asc-dropdown-btn:hover {
    background-color: var(--primary-light);
}

.asc-dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.asc-dropdown-container.open .asc-dropdown-arrow {
    transform: rotate(180deg);
}

.asc-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1050 !important;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 310px;
    padding: 6px;
    display: none;
}

.asc-dropdown-container.open .asc-dropdown-menu {
    display: block;
    animation: fadeInMenu 0.15s ease-out;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.asc-dropdown-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 10px 4px 10px;
}

.asc-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.asc-dropdown-item:hover {
    background-color: #f1f5f9;
}

.asc-dropdown-item.active {
    background-color: var(--primary-light);
}

.asc-dropdown-item .item-icon {
    font-size: 20px;
}

.asc-dropdown-item .item-text {
    display: flex;
    flex-direction: column;
}

.asc-dropdown-item .item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.asc-dropdown-item.active .item-title {
    color: var(--primary);
}

.asc-dropdown-item .item-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.asc-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* Sfat Ajutor */
.grid-helper-tip {
    font-size: 12px;
    color: #475569;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Master Grid Wrapper & Container - Flex Child cu o singură bară de derulare activă */
.master-grid-wrapper {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-top: 2px;
}

.master-grid-container {
    flex: 1;
    min-height: 250px;
    height: calc(100vh - 126px);
    max-height: calc(100vh - 126px);
    width: 100%;
    overflow-y: scroll !important; /* Forțează bara de derulare verticală să fie activă și vizibilă */
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #f1f5f9;
}

.master-grid-container::-webkit-scrollbar {
    width: 9px;
    height: 8px;
}

.master-grid-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.master-grid-container::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
    border: 2px solid #f1f5f9;
}

.master-grid-container::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Tab-uri Setări Administrator & Utilizator */
.settings-tab-btn, .user-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.settings-tab-btn.active, .user-tab-btn.active {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.settings-tab-btn:hover:not(.active), .user-tab-btn:hover:not(.active) {
    background-color: #f1f5f9;
    color: var(--text-main);
}

/* Buton Rotiță Setări Aplicație (Administrator) */
.btn-icon-gear {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1.5px solid var(--border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    margin-left: 4px;
}
.btn-icon-gear:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: rotate(45deg);
}

/* Buton Rotiță Setări Utilizator în Chip */
.btn-user-gear {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all 0.2s;
    padding: 0;
    margin: 0 2px;
}
.btn-user-gear:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(45deg);
}

/* Paletă Culori de Accent */
.color-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.color-preset-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.color-preset-item:hover {
    border-color: var(--c);
    background: #f8fafc;
}

.color-preset-item.active {
    border-color: var(--c);
    background: #f1f5f9;
    box-shadow: 0 0 0 2px var(--c);
}

.color-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Badge Ore Dropdown */
.asc-total-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
}

/* Master Table Layout - border-collapse: separate previne orice intermitență a liniilor de zi */
.master-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
    user-select: none;
    border: none;
}

.master-table th,
.master-table td {
    border-top: none;
    border-left: none;
    border-bottom: 1px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
    box-sizing: border-box;
}

/* Sticky Thead */
.master-table thead {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #f8fafc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

/* Antet Colț Stânga Sus */
.master-corner-header {
    width: 65px;
    min-width: 60px;
    max-width: 70px;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 40 !important;
    background: #cbd5e1 !important;
    color: #0f172a;
    font-weight: 800;
    font-size: 11px;
    text-align: center;
    padding: 5px 3px;
    border-right: 2.5px solid #1e293b !important;
    border-bottom: 2px solid #1e293b !important;
}

/* Antet Zile (Luni..Vineri) */
.master-day-header {
    background: #e2e8f0;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    padding: 5px 2px;
    border-bottom: 1.5px solid #64748b;
    letter-spacing: 0.5px;
}

/* Antet Ore (8..14) */
.master-period-header {
    width: calc((100% - 65px) / 35);
    background: #f1f5f9;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    padding: 4px 1px;
    border-bottom: 2px solid #1e293b;
}

/* Ora 14 (a 7-a oră din zi) evidențiată ca în aSc */
.period-14-header {
    background-color: #fef08a !important;
    color: #854d0e !important;
}

/* Delimitator Gros Continuu între Zile (coloanele 7, 14, 21, 28, 35) */
.master-table th.day-end-col,
.master-table td.day-end-col {
    border-right: 3px solid #0f172a !important;
}

/* Coloana Stângă Fixă (Clasă / Profesor / Sală) */
.master-row-header {
    width: 65px;
    min-width: 60px;
    max-width: 70px;
    position: sticky;
    left: 0;
    z-index: 25;
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 800;
    font-size: 11px;
    text-align: center;
    padding: 2px 3px;
    border-right: 2.5px solid #1e293b !important;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 2px 0 3px rgba(0,0,0,0.04);
}

.master-table tbody tr {
    height: 28px;
    max-height: 28px;
}

.master-table tbody tr:hover .master-row-header {
    background: #cbd5e1;
}

/* Celulă Master Grid */
.master-cell {
    height: 28px;
    max-height: 28px;
    padding: 0 1px;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
}

/* Celulă Neocupată (Liberă) */
.master-empty-cell {
    background-color: #f8fafc;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    transition: background-color 0.15s;
}

.master-empty-cell:hover {
    background-color: #e2e8f0;
}

.master-empty-cell.drag-over {
    background-color: #bbf7d0 !important;
    box-shadow: inset 0 0 0 2px #16a34a !important;
}

/* Celulă Ocupată */
.master-occupied-cell {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
    transition: filter 0.15s, transform 0.1s;
    cursor: grab;
}

.master-occupied-cell:hover {
    filter: brightness(0.92);
    z-index: 6;
}

.master-occupied-cell.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.master-occupied-cell.drag-over {
    box-shadow: inset 0 0 0 2px #f59e0b !important;
    filter: brightness(0.85);
}

.master-occupied-cell.drag-conflict {
    box-shadow: inset 0 0 0 2px #ef4444 !important;
}

/* Card Blocat - Instruire Practică (IP) */
.master-occupied-cell.is-locked {
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.06), rgba(0,0,0,0.06) 5px, transparent 5px, transparent 10px);
    cursor: not-allowed !important;
}

.cell-lock-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 8px;
    line-height: 1;
    opacity: 0.7;
}

/* Celulă Împărțită pe Grupe (Split Cell cu Container Flexibil Intern) */
.master-split-cell {
    padding: 0 !important;
    height: 28px;
    max-height: 28px;
    vertical-align: middle;
    box-sizing: border-box;
}

.split-cell-wrapper {
    display: flex;
    flex-direction: row; /* Desfășurare pe orizontală: două coloane 50%/50% pe întreaga înălțime a celulei */
    width: 100%;
    height: 100%;
    min-height: 27px;
}

.split-card-item {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 1px;
    box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.15);
    cursor: grab;
    transition: filter 0.15s;
    box-sizing: border-box;
}

.split-card-item:hover {
    filter: brightness(0.9);
}

.split-card-item.is-locked {
    cursor: not-allowed !important;
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.06), rgba(0,0,0,0.06) 4px, transparent 4px, transparent 8px);
}

/* ==========================================================================
   POPUP INSTANTANEU HOVER (ZERO DELAY FLOATING TOOLTIP)
   ========================================================================== */

.instant-tooltip {
    position: fixed;
    display: none;
    z-index: 999999;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 12px;
    box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.45);
    max-width: 310px;
    min-width: 200px;
    transition: none !important;
}

.tt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tt-badge-day {
    font-weight: 700;
    color: #93c5fd;
    font-size: 11px;
}

.tt-badge-locked {
    background-color: #ef4444;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.tt-badge-active {
    background-color: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.tt-badge-free {
    background-color: #3b82f6;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.tt-title {
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.tt-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #cbd5e1;
    margin-bottom: 4px;
}

.tt-meta-row strong {
    color: #f8fafc;
}

.tt-icon {
    font-size: 13px;
}

.tt-footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.3;
}
