/* Learn More Modal System */

/* Modal Overlay/Backdrop */
.learn-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.learn-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.learn-modal {
  background-color: var(--tz-card);
  border-radius: var(--tz-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--tz-card-border);
  z-index: 1000;
}

/* Modal Header */
.learn-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--tz-card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(45, 80, 22, 0.05), rgba(212, 175, 55, 0.03));
}

.learn-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--tz-primary);
  letter-spacing: 0.01em;
}

.learn-modal-close-btn {
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--tz-muted);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.learn-modal-close-btn:hover {
  background-color: rgba(45, 80, 22, 0.1);
  color: var(--tz-primary);
}

.learn-modal-close-btn:focus {
  outline: 2px solid var(--tz-focus);
  outline-offset: 2px;
}

/* Modal Body */
.learn-modal-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

/* Accordion Container */
.learn-modal-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Individual Level Item */
.learn-modal-level {
  border: 1px solid var(--tz-card-border);
  border-radius: var(--tz-radius-sm);
  overflow: hidden;
  transition: all 0.3s ease;
}

.learn-modal-level.level-1 {
  border-left: 4px solid var(--tz-primary);
}

.learn-modal-level.level-2 {
  border-left: 4px solid var(--tz-secondary);
  margin-left: 0.75rem;
}

.learn-modal-level.level-3 {
  border-left: 4px solid var(--tz-accent);
  margin-left: 1.5rem;
}

.learn-modal-level:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Level Title */
.learn-modal-level-title {
  padding: 1rem;
  cursor: pointer;
  background-color: var(--tz-card);
  border: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
  color: var(--tz-text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
  user-select: none;
}

.learn-modal-level-title:hover {
  background-color: rgba(45, 80, 22, 0.05);
}

.learn-modal-level-title:focus {
  outline: 2px solid var(--tz-focus);
  outline-offset: -2px;
}

/* Chevron icon */
.learn-modal-level-title .chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-left: auto;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.learn-modal-level.expanded .learn-modal-level-title .chevron {
  transform: rotate(180deg);
}

/* Info Icon */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 50%;
  background-color: var(--tz-primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: help;
  margin-right: 0.5rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.info-icon:hover {
  background-color: var(--tz-secondary);
  box-shadow: 0 2px 8px rgba(45, 80, 22, 0.3);
}

/* Level Content */
.learn-modal-level-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.learn-modal-level.expanded .learn-modal-level-content {
  max-height: 500px;
  padding: 0 1rem 1rem 1rem;
}

.learn-modal-level-content p {
  margin: 0;
  color: var(--tz-text);
  line-height: var(--tz-line);
  font-size: 0.95rem;
}

.learn-modal-level-content ul,
.learn-modal-level-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: var(--tz-text);
}

.learn-modal-level-content li {
  margin-bottom: 0.5rem;
  color: var(--tz-text);
}

/* Modal Footer */
.learn-modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--tz-card-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

.learn-modal-btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--tz-radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.learn-modal-btn-close {
  background-color: var(--tz-primary);
  color: #ffffff;
}

.learn-modal-btn-close:hover {
  background-color: color-mix(in srgb, var(--tz-primary) 85%, black 15%);
}

.learn-modal-btn-close:focus {
  outline: 2px solid var(--tz-focus);
  outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .learn-modal {
    width: 95vw;
    max-height: 90vh;
  }

  .learn-modal-header {
    padding: 1.25rem;
  }

  .learn-modal-header h2 {
    font-size: 1.25rem;
  }

  .learn-modal-body {
    padding: 1.25rem;
  }

  .learn-modal-level.level-2 {
    margin-left: 0.5rem;
  }

  .learn-modal-level.level-3 {
    margin-left: 1rem;
  }

  .learn-modal-footer {
    padding: 1.25rem;
    flex-direction: column;
  }

  .learn-modal-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .learn-modal {
    width: 98vw;
    border-radius: 12px 12px 0 0;
    bottom: 0;
  }

  .learn-modal-header {
    padding: 1rem;
  }

  .learn-modal-header h2 {
    font-size: 1.1rem;
  }

  .learn-modal-body {
    padding: 1rem;
  }

  .learn-modal-level-title {
    padding: 0.75rem;
    font-size: 0.95rem;
  }

  .learn-modal-level.level-2 {
    margin-left: 0.25rem;
  }

  .learn-modal-level.level-3 {
    margin-left: 0.5rem;
  }

  .learn-modal-footer {
    padding: 1rem;
  }
}

/* Scrollbar Styling for Modal */
.learn-modal::-webkit-scrollbar {
  width: 8px;
}

.learn-modal::-webkit-scrollbar-track {
  background: transparent;
}

.learn-modal::-webkit-scrollbar-thumb {
  background: rgba(45, 80, 22, 0.3);
  border-radius: 4px;
}

.learn-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 80, 22, 0.5);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .learn-modal-overlay,
  .learn-modal-level,
  .learn-modal-level-title,
  .learn-modal-level-content,
  .learn-modal-close-btn,
  .learn-modal-btn,
  .info-icon {
    transition: none;
  }
}
