/* ========================================================= */
/* === COMPONENTS — MODALS GLOBALS ========================= */
/* ========================================================= */

.modal-overlay,
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 2rem 1.5rem;
  max-width: 500px;
  width: 90%;
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-lg);
  position: relative;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.modal-content h2 {
  text-align: center;
  margin-bottom: 12px;
  font-size: 20px;
  color: var(--color-title);
}

.modal-meta-item {
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  color: var(--color-text);
}

.modal-meta-item .offer-privacy-hint {
  margin-left: 8px;
}

.modal-meta-item--label {
  margin-bottom: 8px;
}

.modal-accordion {
  width: 100%;
  margin: 0 0 12px;
  border-radius: 18px;
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.82);
  overflow: hidden;
}

.modal-accordion__summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-text);
}

.modal-accordion__summary::-webkit-details-marker {
  display: none;
}

.modal-accordion__summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
  margin-top: -3px;
}

.modal-accordion[open] .modal-accordion__summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.modal-accordion__content {
  padding: 0 16px 16px;
}

.academic-detail-list {
  display: grid;
  gap: 10px;
}

.academic-detail-scroll-wrap {
  position: relative;
  width: 100%;
}

.academic-detail-scrollable {
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(248,250,252,0.94), rgba(241,245,249,0.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.88);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.academic-detail-scrollable::-webkit-scrollbar {
  display: none;
}

.academic-detail-card {
  border-radius: 14px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.academic-detail-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: grid;
  gap: 3px;
}

.academic-detail-summary::-webkit-details-marker {
  display: none;
}

.academic-detail-summary-title {
  font-weight: 800;
  color: var(--color-title);
}

.academic-detail-summary-meta {
  font-size: 0.92rem;
  color: var(--color-subtext);
}

.academic-detail-body {
  padding: 0 14px 12px;
}

.academic-detail-meta {
  color: var(--color-text);
  line-height: 1.45;
}

.academic-detail-meta + .academic-detail-meta {
  margin-top: 3px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--color-subtext);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--color-title);
}

.titol-modal {
  display: inline-block;
  border-bottom: 3px solid var(--color-daurat);
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

.descripcio-scroll-wrap {
  position: relative;
  width: 100%;
  margin-top: 0.2rem;
}

.descripcio-scrollable {
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
  padding: 0.95rem 1.15rem 0.95rem 1rem;
  margin-top: 0;
  border-radius: var(--radius-s);
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-line;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
}

.descripcio-scrollable::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}

.descripcio-scrollbar {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(233, 215, 165, 0.2), rgba(217, 180, 74, 0.16));
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

.descripcio-scroll-wrap.is-scrollable .descripcio-scrollbar {
  opacity: 1;
}

.descripcio-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f2e5bc 0%, #e2c978 55%, #c9a443 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.modal-options {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="dark"] .modal-overlay,
[data-theme="dark"] .modal {
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
}

[data-theme="dark"] .modal-content {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  animation: modalAppearDark 0.25s ease;
}

[data-theme="dark"] .modal-content h2 {
  color: var(--color-title);
}

[data-theme="dark"] .modal-meta-item {
  color: #e5e7eb;
}

[data-theme="dark"] .titol-modal {
  border-bottom: 3px solid var(--color-daurat);
  color: var(--color-daurat);
}

[data-theme="dark"] .modal-close {
  color: var(--color-subtext);
}

[data-theme="dark"] .modal-close:hover {
  color: #ffffff;
}

[data-theme="dark"] .modal-accordion {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.96));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

[data-theme="dark"] .modal-accordion__summary {
  color: #f8fafc;
}

[data-theme="dark"] .modal-accordion__content {
  color: #e5e7eb;
}

[data-theme="dark"] .academic-detail-scrollable {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 18, 32, 0.98));
  border-color: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

[data-theme="dark"] .academic-detail-card {
  background: rgba(15, 23, 42, 0.86);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .academic-detail-summary-title {
  color: #f8fafc;
}

[data-theme="dark"] .academic-detail-summary-meta,
[data-theme="dark"] .academic-detail-meta {
  color: #cbd5e1;
}

[data-theme="dark"] .descripcio-scrollable {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 18, 32, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  scrollbar-width: none;
}

[data-theme="dark"] .descripcio-scrollbar {
  background: linear-gradient(180deg, rgba(242, 229, 188, 0.14), rgba(217, 180, 74, 0.18));
}

[data-theme="dark"] .descripcio-scrollbar-thumb {
  background: linear-gradient(180deg, #f3e7c3 0%, #e2c978 55%, #c9a443 100%);
}

[data-theme="dark"] .modal-options button {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

@keyframes modalAppearDark {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
