/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.is-open {
  display: flex;
}

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

/* Modal Container */
.modal-container {
  background: rgba(15, 15, 20, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
  position: relative;
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  .modal-container {
    background: rgba(15, 15, 20, 0.9);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }
}

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

/* Modal Header */
.modal-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  flex: 1;
  padding-right: var(--spacing-sm);
}

/* Modal Body */
.modal-body {
  padding: var(--spacing-md);
}

.modal-detail {
  margin-bottom: var(--spacing-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-detail:last-child {
  margin-bottom: 0;
}

.modal-detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.modal-detail-value {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

.modal-detail-value a {
  color: rgb(var(--accent-rgb) / 0.92);
  text-decoration: none;
  transition: color 0.15s ease;
}

.modal-detail-value a:hover {
  color: rgb(var(--accent-rgb) / 1);
  text-decoration: underline;
}

/* Event Badge */
.modal-event-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: rgba(100, 140, 255, 0.35);
  border-left: 3px solid rgba(100, 140, 255, 0.8);
  border-radius: 3px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

/* Light Mode */
[data-theme="light"] .modal-overlay,
body:has(#theme-toggle-checkbox:checked) .modal-overlay {
  background: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .modal-container,
body:has(#theme-toggle-checkbox:checked) .modal-container {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  [data-theme="light"] .modal-container,
  body:has(#theme-toggle-checkbox:checked) .modal-container {
    background: rgba(255, 255, 255, 0.92);
  }
}

[data-theme="light"] .modal-header,
body:has(#theme-toggle-checkbox:checked) .modal-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .modal-title,
body:has(#theme-toggle-checkbox:checked) .modal-title {
  color: rgba(15, 23, 42, 0.92);
}

[data-theme="light"] .modal-detail-label,
body:has(#theme-toggle-checkbox:checked) .modal-detail-label {
  color: rgba(15, 23, 42, 0.55);
}

[data-theme="light"] .modal-detail-value,
body:has(#theme-toggle-checkbox:checked) .modal-detail-value {
  color: rgba(15, 23, 42, 0.8);
}

[data-theme="light"] .modal-event-badge,
body:has(#theme-toggle-checkbox:checked) .modal-event-badge {
  background: rgb(var(--accent-rgb) / 0.18);
  border-left: 3px solid rgb(var(--accent-rgb) / 0.72);
  color: rgba(15, 23, 42, 0.9);
}

/* Event Item in Day List */
.modal-event-item {
  cursor: pointer;
  padding: 0.75rem;
  background: rgba(100, 140, 255, 0.1);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  transition: background 0.15s ease;
}

.modal-event-item:hover {
  background: rgba(100, 140, 255, 0.2);
}

[data-theme="light"] .modal-event-item,
body:has(#theme-toggle-checkbox:checked) .modal-event-item {
  background: rgb(var(--accent-rgb) / 0.1);
}

[data-theme="light"] .modal-event-item:hover,
body:has(#theme-toggle-checkbox:checked) .modal-event-item:hover {
  background: rgb(var(--accent-rgb) / 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .modal-container {
    max-width: 95%;
    max-height: 85vh;
  }

  .modal-header {
    padding: var(--spacing-sm);
  }

  .modal-body {
    padding: var(--spacing-sm);
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-detail-value {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .modal-container {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .modal-title {
    font-size: 1rem;
  }
}
