/* Main */
:root {
    --bg-color: #f9fafc;
    --surface-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --btn-bg: #3788d8;
    --btn-hover: #2c6faf;
    --fc-bg: #ffffff;
    --max-height-opt: 425px;
}
[data-theme='dark'] {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #333333;
    --btn-bg: #1e5b99;
    --btn-hover: #154273;
    --fc-bg: #1e1e1e;
}
body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    padding: 20px;
    transition:
            background 0.3s,
            color 0.3s;
}
.section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}
button {
    background: var(--btn-bg);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin: 4px;
    font-weight: 500;
}
button:hover {
    background: var(--btn-hover);
}
.success {
    background: #28a745;
}
.danger {
    background: #dc3545;
}
input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}
.course-btn {
    display: block;
    margin-bottom: 5px;
    background: var(--bg-color);
    color: var(--text-color);
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-color);
}

/* Popup stuff */

.legend-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 999;
}
.popup {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-color);
    color: var(--text-color);
    padding: 20px;
    border-radius: 8px;
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Sections */

.section-block {
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}
.sessions-list {
    margin-left: 20px;
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.9;
}

.section-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    margin-bottom: 10px;
    font-size: 0.85em;
}
.section-table th,
.section-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}
.section-table th {
    background: var(--bg-color);
    font-weight: 600;
}

/* fullcalendar override */
.fc-timegrid-slot {
    height: 70px !important;
}
.fc-timegrid-slot-label {
    vertical-align: middle !important;
}
.fc .fc-scrollgrid-section-header th,
.fc-theme-standard th {
    background-color: var(--fc-bg) !important;
}

.fc-timegrid-col-events {
    margin: 0 !important;
}

.fc-timegrid-event {
    border-radius: 0 !important;
    margin: 1px 0 0 0 !important;

    background-image: linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.15) 0%,
            rgba(0, 0, 0, 0.05) 100%
    ) !important;
    box-shadow: inset 1px 1px 0px rgba(255, 255, 255, 0.2) !important;
}
.fc-event-main {
    height: 100%;
    width: 100%;
    padding: 0 !important;
}
.fc-event-time {
    font-weight: 700;
    font-size: 1.9em;
    margin-bottom: 2px;
}
.fc-event-title {
    font-size: 1.2em;
    white-space: normal;
    line-height: 1.2;
}

/* theme switcher widget thingy */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

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

.theme-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    transition: 0.3s;
    border-radius: 6px;
}

.theme-switch .slider:before {
    position: absolute;
    content: '';
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-color);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

/* Active (dark mode) State */
.theme-switch input:checked + .slider {
    background-color: var(--btn-bg);
    border-color: var(--btn-bg);
}

.theme-switch input:checked + .slider:before {
    transform: translateX(22px);
    background-color: #ffffff;
}

/* custom color select component */
.custom-select {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    user-select: none;
}
.select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: border-color 0.2s;
}
.select-trigger:hover {
    border-color: var(--btn-bg);
}
.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1001;
    overflow: hidden;
}
.custom-select.open .select-options {
    display: block;
}
.option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s;
}
.option:hover {
    background: var(--bg-color);
}
.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0; /* q basado */
}
#editPopup {
    overflow: visible !important;
}

/* notif toast */
.notification {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    max-width: 0px; /* colapsado cuando inicia la pagina */
    padding: 0px;
    margin-left: 0px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    color: white;
    opacity: 0;
    /* refinado muchisimo xd */
    transition:
            max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.3s ease;
}
.notification.show {
    max-width: 600px; /* numero arbitrario para q exista nomas */
    padding: 8px 16px;
    margin-left: 10px;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.notification.success-bg {
    background-color: #28a745;
}
.notification.error-bg {
    background-color: #dc3545;
}

/* --- OPTIMIZER UI FIXES & SCROLLBAR ENGINEERING --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--btn-bg);
}

/* Kill horizontal scroll on the cart */
#optCart {
    overflow-x: hidden; 
    padding-right: 8px; 
}

/* Ensure sliders never break their containers */
input[type="range"] {
    box-sizing: border-box;
    width: 100%;
}

/* The Dead Section Chips */
.dead-section-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}
.dead-section-chip input {
    display: none; /* Hide the native checkbox, the label is the button */
}
.dead-section-chip.dead {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    text-decoration: line-through;
    opacity: 0.8;
}

/* --- TEACHER RANKING TABS & CHIPS --- */
.opt-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 15px;
    gap: 5px;
    padding-bottom: 5px;
}
.opt-tab {
    padding: 6px 12px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0.7;
}
.opt-tab.active {
    background: var(--btn-bg);
    color: white;
    border-color: var(--btn-bg);
    opacity: 1;
}
.copy-chip {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    display: inline-block;
}
.copy-chip.selected {
    background: #6f42c1;
    color: white;
    border-color: #6f42c1;
}
.copy-chip.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}
input[type="range"] {
  -webkit-appearance: none; /* For Chrome, Opera, Safari, Edge (Chromium) */
  appearance: none;
  background: transparent; /* Remove default background */
  width: 100%; /* Set a desired width */
  outline: none; /* Remove focus outline */
}

input[type="range"]:focus {
  outline: none; /* Ensure no outline on focus */
}



/* Webkit Browsers (Chrome, Safari, Edge, Opera) */
input[type="range"]::-webkit-slider-runnable-track {
  background: #d2d2d2; /* Light gray background for the track */
  height: 8.4px; /* Track height */
  border-radius: 1.3px;
  cursor: pointer;
}

/* Mozilla Firefox */
input[type="range"]::-moz-range-track {
  background: #d2d2d2;
  height: 8.4px;
  border-radius: 1.3px;
  cursor: pointer;
}

/* Internet Explorer/Old Edge (less common now but good for compatibility) */
input[type="range"]::-ms-track {
  background: transparent; /* Must be transparent in IE */
  border-color: transparent;
  color: transparent;
  width: 100%;
  height: 8.4px;
  cursor: pointer;
}

/* Webkit Browsers */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; /* Remove default thumb style */
  appearance: none;
  height: 20px;
  width: 16px;
  background: #1E1E1E; /* The orange thumb color */
  border: 1px solid #000;
  border-radius: 3px;
  cursor: pointer;
  margin-top: -6px; /* Vertically center the thumb on the track (36px - 8.4px) / 2 = 13.8px */
}

/* Mozilla Firefox */
input[type="range"]::-moz-range-thumb {
  height: 36px;
  width: 16px;
  background: #1E1E1E;
  border: 1px solid #000;
  border-radius: 3px;
  cursor: pointer;
}

/* Internet Explorer/Old Edge */
input[type="range"]::-ms-thumb {
  height: 36px;
  width: 16px;
  background: #1E1E1E   ;
  border: 1px solid #000;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 0; /* IE centers it differently */
}

/* Optimizador Layout */
.opt-layout-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-direction: row; /* Default para PC */
}

/* Breakpoint para celulares y tablets pequeñas */
@media (max-width: 768px) {
    .opt-layout-container {
        flex-direction: column;
    }
}