.dept-card {
  background: linear-gradient(180deg, #ecfdf5 0%, #bbf7d0 100%) !important;
  color: #064e3b !important;
  border: 1px solid rgba(5, 150, 105, 0.25) !important;
  box-shadow: 0 1px 4px rgba(6, 95, 70, 0.06);
  position: relative;
}
.dept-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #059669;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.dept-card .lab-room {
  color: #065f46 !important;
}

.notice {
  background: linear-gradient(180deg, #ecfdf5 0%, #bbf7d0 100%);
  color: #064e3b;
  border: 1px solid rgba(5, 150, 105, 0.18);
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  display: inline-block;
}
.notice a {
  color: #065f46;
  font-weight: 600;
}

.dept-eee::before {
  background: #16a34a;
}

.custom-center-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M5 8L10 13L15 8" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
    no-repeat center right 1.25rem/1.5em;
  padding-right: 2.5rem !important;
}

:root {
  --app-theme: #f7fafc;
}

html,
body {
  background: var(--app-theme);
}
header {
  background: var(--app-theme);
  color: white;
  padding-top: calc(env(safe-area-inset-top) + 0.25rem);

  padding-bottom: 0;
}
.floating-search {
  background: transparent;
  padding-top: calc(env(safe-area-inset-top) + 0.25rem);
}

#appIcon {
  margin-bottom: 0 !important;
}

@media (max-width: 420px) {
  #appIcon {
    margin-bottom: -2px !important;
  }
  header {
    padding-bottom: 0;
  }
}

@media (max-width: 640px) {
  .custom-center-select {
    background-position: center right 1rem;
    padding-right: 2rem !important;
  }
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.floating-search {
  position: sticky;
  top: 8px;
  z-index: 11000;
  overflow: visible;
}

#customDayList,
#customSlotList,
.floating-search ul.absolute {
  z-index: 12000 !important;
  position: absolute;
  overflow: visible;
  will-change: transform;
}

.dropdown-portal {
  opacity: 0;
  transform: translateY(-6px) scale(0.995);
  transition:
    opacity 180ms ease,
    transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
  border-radius: 12px;
}
.dropdown-portal.dropdown-portal--open {
  opacity: 1;
  transform: translateY(0) scale(1.02);
}
.dropdown-portal.dropdown-portal--closing {
  opacity: 0;
  transform: translateY(-6px) scale(0.995);
}

.toast {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  width: auto;
  max-width: calc(100vw - 40px);
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  animation:
    slideIn 0.2s forwards,
    fadeOut 0.5s 2s forwards;
  display: inline-block;
  vertical-align: top;
  font-weight: 400;
  background: #374151;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-shadow {
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.08);
}
@keyframes slideIn {
  to {
    transform: translateX(0);
  }
}
@keyframes fadeOut {
  to {
    opacity: 0;
  }
}
.success {
  color: #fff;
  border-color: rgba(52, 211, 153, 0.35);
}
.error {
  color: #fff;
  border-color: rgba(239, 68, 68, 0.35);
}

.toast.copy {
  background: #111827;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
}

.toast strong {
  font-weight: 700;
}

.custom-select {
  position: relative;
}
.custom-select .options {
  display: none;
  position: absolute;
  background-color: white;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  width: 100%;
}
.custom-select .option {
  padding: 8px 12px;
  cursor: pointer;
}
.custom-select .option:hover {
  background-color: #f3f4f6;
}

@media (max-width: 640px) {
  input,
  button,
  select {
    font-size: 16px;
    height: 44px;
  }
  .table-container {
    margin: 0 -16px;
  }
}

@media (min-width: 1024px) {
  #customDayBtn,
  #customSlotBtn {
    height: 52px !important;
    min-height: 52px !important;
    line-height: 1 !important;
  }

  #customDayBtn #customDaySelected,
  #customSlotBtn #customSlotSelected,
  #customSlotBtn span,
  #customDayBtn span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #customDayBtn,
  #customSlotBtn {
    min-width: 260px;
    max-width: 320px;
    width: 100%;
  }

  .floating-search .flex-row-fixed {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
}

.section-input-container {
  position: relative;
  width: 100%;
}

.input-row {
  display: flex;
  flex-direction: row;
  width: 100%;
  margin-bottom: 8px;
  gap: 4px;
}
.input-row .course-code {
  flex: 2;
}
.input-row .section {
  flex: 1;
}
.input-row .add-course {
  flex: 1;
}

.dropdown {
  position: absolute;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 9999;
  max-height: 12rem;
  overflow-y: auto;
  width: 100%;
  color: #1f2937;
}
.dropdown-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #1f2937;
}

.dropdown-option.disabled {
  color: #9ca3af;
  cursor: default;
}

.dropdown::-webkit-scrollbar {
  width: 6px;
}
.dropdown::-webkit-scrollbar-track {
  background: #f3f4f6;
}
.dropdown::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 3px;
}

body {
  padding-bottom: 120px !important;
}

#capture-area {
  margin-bottom: 50px;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.mt-4.text-center {
  margin-top: 1rem;
  text-align: center;
}

@media (max-width: 640px) {
  .floating-search {
    transition:
      transform 0.28s ease,
      opacity 0.28s ease;
    will-change: transform, opacity;
  }
  .floating-search.hidden-on-scroll {
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
  }

  .floating-search,
  .dropdown,
  .copy-button,
  #site-footer {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
  }

  button,
  .copy-button {
    width: 100%;
    display: block;
    margin-bottom: 0.5rem;
  }
}

#pdf-fullscreen-modal {
  opacity: 1 !important;
  animation: none !important;
}

#pdf-fullscreen-img {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

#reset-zoom-btn {
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  z-index: 2001;
  font-size: 1rem;
  transition: background 0.2s;
}
#reset-zoom-btn:hover {
  background: transparent;
}

.copy-button {
  background: transparent;
  border: none;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px;
  transition:
    background 0.12s,
    color 0.12s;
}

.legend .legend-item {
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 150ms ease;
}
.legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 40%;
  display: inline-block;
}
.legend .computer-dot {
  background: #10b981;
}
.legend .lab-dot {
  background: #e0f2fe;
}
.legend .class-dot {
  background: #f1f5f9;
}

.legend .legend-item,
.legend .legend-dot,
.legend .legend-label {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.legend .legend-dot {
  border: none;
  box-shadow: none;
}
.legend .legend-label {
  border: none;
  box-shadow: none;
}

#freeLabsResult,
#result {
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}
#freeLabsResult.anim-start,
#result.anim-start {
  opacity: 0.65;
  transform: translateY(6px);
}
.copy-button:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}
.copy-button i {
  font-size: 0.95rem;
}

.field-value {
  font-weight: 400;
  color: inherit;
}
.copied-field {
  font-weight: 700 !important;
}

.lab-room {
  cursor: copy;
}
.lab-room:hover {
  font-weight: 800;
}

.temp-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.classroom-card {
  background: #f1f5f9;
  color: #1f2937;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.classroom-card .classroom-title {
  font-weight: 600;
  color: #0f172a;
}
.classroom-card .classroom-subtitle {
  font-size: 0.75rem;
  color: #4b5563;
  margin-top: 0.125rem;
}

.classrooms-container {
  display: block;
}
.classrooms-container.hidden {
  display: none !important;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 42px;
  height: 24px;
  left: 0;
  top: 0;
  opacity: 0;
  margin: 0;
  z-index: 3;
}

.slider {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  background-color: #e5e7eb;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: white;
  transition: transform 120ms ease;
  border-radius: 999px;
}

.switch input:checked + .slider {
  background-color: #10b981;
}
.switch input:checked + .slider:before {
  transform: translateX(18px);
}

.switch-label {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.82rem;
  color: #475569;
  vertical-align: middle;
  user-select: none;
}

.switch {
  padding-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 640px) {
  .switch-label {
    font-size: 0.78rem;
    margin-left: 0.3rem;
  }
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 6px;
}
.lab-dot {
  background: #dff1fe;
  border: 1px solid rgba(34, 150, 200, 0.14);
}
.class-dot {
  background: #f1f5f9;
  border: 1px solid #e6eef6;
}

.computer-dot {
  background: linear-gradient(180deg, #16a34a, #059669);
  border: 1px solid rgba(6, 95, 70, 0.12);
}

.offscreen-textarea {
  position: fixed !important;
  left: -9999px !important;
}

.switch-wrap {
  gap: 0.35rem;
  flex: 0 0 auto;
}

.switch-wrap {
  min-width: 96px;
  align-items: center;
}

.switch-wrap label[for="toggleClassrooms"] {
  cursor: pointer;
}

.switch,
.slider {
  z-index: 2;
}
.legend {
  line-height: 1.05;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.legend-dot {
  width: 10px;
  height: 10px;
  margin-right: 6px;
}

.compact-controls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.1rem 0.12rem;

  flex-wrap: wrap;
  overflow-x: visible;
  -webkit-overflow-scrolling: auto;
}

@media (max-width: 640px) {
  .compact-controls {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
}

@media (max-width: 640px) {
  .compact-controls {
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .compact-controls .legend {
    flex: 1 1 auto;
    min-width: 0;

    overflow-x: visible;
    -webkit-overflow-scrolling: auto;
    white-space: normal;
    padding-bottom: 4px;
  }

  .compact-controls .legend-item {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.75rem;
  }

  .switch-wrap {
    margin-right: 0.5rem;
  }
}

@media (max-width: 640px) {
  .compact-controls {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
  }

  .compact-controls .switch-wrap {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    margin-right: 0.5rem;
    gap: 0.25rem;
  }

  .compact-controls .switch-wrap label {
    white-space: nowrap;
    font-size: 0.95rem;
    margin-right: 0.25rem;
  }

  .compact-controls .switch {
    margin-left: 0.125rem;
    transform: scale(0.98);
  }

  .compact-controls .legend {
    flex-basis: 100%;
    width: 100%;
    white-space: normal;
    overflow: visible;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .compact-controls .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.75rem;
  }
}
.compact-controls .switch-wrap {
  gap: 0.2rem;
  white-space: nowrap;
}
.compact-controls .legend {
  gap: 0.25rem;
  font-size: 0.9rem;
  white-space: normal;
}
.compact-controls .legend-item {
  white-space: normal;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

@media (max-width: 640px) {
  #pdf-fullscreen-modal div {
    width: 95% !important;
    height: 80% !important;
    padding: 10px !important;
  }
  #pdf-fullscreen-img {
    max-width: 100%;
    max-height: 80%;
  }
  #reset-zoom-btn {
    padding: 10px 16px;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  #screenshot-fullscreen-modal div,
  #pdf-fullscreen-modal div {
    width: 90% !important;
    height: 80% !important;
    padding: 10px !important;
  }
}

@media (max-width: 640px) {
  .flex.flex-wrap.gap-3 {
    gap: 0.25rem !important;
  }
}

#welcome-info .welcome-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  color: #6b7280;
}
#welcome-info .welcome-note p {
  margin: 0;
  font-size: 0.95rem;
}
#welcome-info .welcome-note h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
}
#welcome-info {
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

@media (max-width: 640px) {
  #welcome-info .welcome-note {
    text-align: center;
  }
  #welcome-info ol.text-left {
    text-align: center;
  }
  #welcome-info ol.text-left li {
    text-align: center;
  }

  #ios-install-hint .flex {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  #ios-install-hint button#ios-install-close {
    margin-left: 0;
    align-self: center;
  }
}

.site-footer-link {
  color: #52525b;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.12s;
}
.site-footer-link:hover {
  color: #2563eb;
}

.auto-search-pulse {
  animation: autoSearchPulse 0.6s ease-in-out;
}
@keyframes autoSearchPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
  50% {
    transform: scale(0.98);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.12);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
}

@media (max-width: 640px) {
  .compact-controls {
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
  }

  .compact-controls .legend {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem;
    width: 100%;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    white-space: normal;
  }

  .compact-controls .legend-item {
    justify-content: center;
    margin-right: 0.5rem;
  }

  .compact-controls .switch-wrap {
    justify-content: center;
    margin-right: 0;
  }

  .switch {
    margin-left: 0;
  }

  .switch-label {
    display: inline-block;
    text-align: center;
  }

  .legend-dot {
    margin-right: 0.5rem;
    margin-left: 0;
  }
}
