/* ===== LEGEND ===== */
.legend-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(12, 17, 27, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.legend-years-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid;
}

.legend-dot.ld1 {
    background: linear-gradient(145deg, #4fc3f7, #0277bd);
    border-color: var(--year1-dark);
    box-shadow: 0 2px 10px var(--year1-glow);
}

.legend-dot.ld2 {
    background: linear-gradient(145deg, #81c784, #1b5e20);
    border-color: var(--year2-dark);
    box-shadow: 0 2px 10px var(--year2-glow);
}

.legend-dot.ld3 {
    background: linear-gradient(145deg, #ce93d8, #6a1b9a);
    border-color: var(--year3-dark);
    box-shadow: 0 2px 10px var(--year3-glow);
}

.legend-dot.ld4 {
    background: linear-gradient(145deg, #ff8a65, #bf360c);
    border-color: var(--year4-dark);
    box-shadow: 0 2px 10px var(--year4-glow);
}

.legend-text {
    font-size: 0.82rem;
    font-weight: 700;
}

.legend-text-ar {
    font-size: 0.72rem;
    color: var(--muted);
}

.legend-status-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
    margin-top: 4px;
}

.legend-status-title {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.legend-status-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.legend-status-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-status-badge.st-completed {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.legend-status-badge.st-available {
    background: rgba(79, 195, 247, 0.15);
    color: #4fc3f7;
    border: 1px solid rgba(79, 195, 247, 0.3);
}

.legend-status-badge.st-locked {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.45);
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.legend-click-hint {
    font-size: 0.65rem;
    color: var(--muted);
    opacity: 0.7;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 4px;
    width: 100%;
}

/* ===== TOOLTIP ===== */
.tooltip {
    position: absolute;
    background: rgba(20, 25, 35, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.75rem;
    color: var(--text);
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    max-width: 280px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    direction: rtl;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip .tt-name {
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.tooltip .tt-en {
    font-size: 0.7rem;
    color: var(--muted);
    direction: ltr;
    text-align: left;
    margin-bottom: 4px;
}

.tooltip .tt-code {
    font-size: 0.65rem;
    color: var(--muted);
    direction: ltr;
}

.tooltip .tt-prereq {
    font-size: 0.68rem;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tooltip .tt-prereq span {
    color: #ffab40;
    font-weight: 700;
}

.tooltip .tt-status {
    font-size: 0.68rem;
    font-weight: 700;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tooltip .tt-status-completed {
    color: #81c784;
}

.tooltip .tt-status-available {
    color: #4fc3f7;
}

.tooltip .tt-status-locked {
    color: #ef5350;
}

/* ===== MODAL (Elective List) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

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

.modal {
    background: linear-gradient(145deg, #1a2033, #141925);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px 35px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    direction: rtl;
}

.modal h2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.modal .modal-sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 18px;
}

.modal-close {
    float: left;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 100, 100, 0.3);
}

.modal-list {
    list-style: none;
}

.modal-list li {
    padding: 12px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.modal-list li:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
}

.modal-list li.completed-item {
    background: rgba(76, 175, 80, 0.07);
    border-color: rgba(76, 175, 80, 0.3);
}

.modal-list li.selected-item {
    background: rgba(255, 171, 64, 0.09);
    border-color: rgba(255, 171, 64, 0.4);
}

.modal-item-info {
    flex: 1;
}

.modal-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.modal-slot-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: rgba(255, 171, 64, 0.1);
    border: 1px dashed rgba(255, 171, 64, 0.4);
    border-radius: 10px;
    font-size: 0.76rem;
    color: #ffe082;
}

.badge-completed {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.4);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    display: inline-block;
}

.badge-selected {
    background: rgba(255, 171, 64, 0.2);
    color: #ffe082;
    border: 1px solid rgba(255, 171, 64, 0.4);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    display: inline-block;
}

.badge-other {
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    display: inline-block;
}

.btn-modal-action {
    padding: 6px 12px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-modal-action:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-modal-complete.active {
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    border-color: #81c784;
    color: #fff;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.btn-modal-select.active {
    background: linear-gradient(135deg, #e65100, #ff8f00);
    border-color: #ffe082;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 143, 0, 0.3);
}

.btn-clear-slot {
    background: rgba(239, 83, 80, 0.15);
    border-color: rgba(239, 83, 80, 0.4);
    color: #ef5350;
    font-size: 0.68rem;
}

.btn-clear-slot:hover {
    background: rgba(239, 83, 80, 0.3);
}

.modal-list .li-name {
    font-weight: 700;
    font-size: 0.82rem;
}

.modal-list .li-code {
    font-size: 0.7rem;
    color: var(--muted);
    direction: ltr;
    font-weight: 600;
}

.modal-list .li-hrs {
    font-size: 0.65rem;
    color: var(--muted);
    opacity: 0.7;
}

.modal-list .li-prereq {
    font-size: 0.62rem;
    color: #ffab40;
    margin-top: 3px;
}

/* ===== ZOOM CONTROLS (Positioned on Left) ===== */
.zoom-controls {
    position: fixed;
    left: 25px;
    bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    pointer-events: auto;
    z-index: 1000;
}

.zoom-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 17, 27, 0.9);
    backdrop-filter: blur(12px);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.zoom-level {
    text-align: center;
    font-size: 0.72rem;
    color: #4fc3f7;
    font-weight: 800;
    background: rgba(12, 17, 27, 0.92);
    border: 1px solid rgba(79, 195, 247, 0.3);
    border-radius: 8px;
    padding: 3px 8px;
    min-width: 44px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== PAN HINT ===== */
.pan-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px 30px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 2000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s ease 2s;
    text-align: center;
}

.pan-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.pan-hint .hint-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* ===== SEARCH BAR ===== */
.search-container {
    position: fixed;
    top: 20px;
    left: 30px;
    z-index: 2000;
    width: 280px;
    direction: rtl;
}

.search-input-wrap {
    display: flex;
    align-items: center;
}

/* ===== MOBILE RESPONSIVE OVERRIDES ===== */
@media (max-width: 768px) {
    .search-container {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        z-index: 1900 !important;
    }
    .zoom-controls {
        position: fixed !important;
        left: 12px !important;
        bottom: 12px !important;
        z-index: 1400 !important;
    }
}