/* === Modal Backdrop === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
}

/* === Modal === */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 1001;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* === Header === */
.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal__header--counter {
  border-bottom-color: rgba(239, 68, 68, 0.3);
}

.modal__header--steelman {
  border-bottom-color: rgba(34, 197, 94, 0.3);
}

.modal__header--loading {
  border-bottom-color: var(--border);
}

.modal__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal__header--counter .modal__title {
  color: var(--con);
}

.modal__header--steelman .modal__title {
  color: var(--green);
}

.modal__subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.modal__close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color var(--transition);
}

.modal__close:hover {
  color: var(--text);
}

/* === Body === */
.modal__body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal__body--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 1rem;
  color: var(--text-muted);
}

/* === Spinner === */
.modal-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--neutral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* === Sections === */
.modal-section {
  margin-bottom: 1.5rem;
}

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

.modal-section__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.modal-section__content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}

.modal-section__content--bold {
  font-weight: 600;
}

.modal-section__content--mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-xs);
  border-left: 2px solid var(--border);
}

/* === Killer Quote === */
.killer-quote {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--con);
  background: rgba(239, 68, 68, 0.04);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  line-height: 1.6;
}

.modal-section--killer {
  background: rgba(239, 68, 68, 0.02);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

/* === Steelman Comparison === */
.steelman-comparison {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.steelman-comparison__item {
  flex: 1;
}

.steelman-comparison__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.steelman-comparison__arrow {
  font-size: 1.5rem;
  color: var(--green);
  flex-shrink: 0;
}

/* Modal Strength Bars */
.modal-strength-bar {
  position: relative;
  height: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  overflow: hidden;
}

.modal-strength-bar__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease-out;
}

.modal-strength-bar--original .modal-strength-bar__fill {
  background: var(--text-dim);
}

.modal-strength-bar--improved .modal-strength-bar__fill {
  background: linear-gradient(90deg, var(--green), #4ade80);
}

.modal-strength-bar__label {
  position: absolute;
  right: 0;
  top: -18px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* === Footer === */
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-copy {
  padding: 0.5rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-copy:hover {
  border-color: var(--neutral);
  background: var(--neutral-glow);
}

.modal__close-btn {
  padding: 0.5rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.modal__close-btn:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

/* === Technique Badge in Modal === */
.modal-section .technique-badge {
  margin-bottom: 0.5rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .modal {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: translateY(20px);
  }

  .modal.active {
    transform: translateY(0);
  }

  .steelman-comparison {
    flex-direction: column;
  }

  .steelman-comparison__arrow {
    transform: rotate(90deg);
  }

  .steelman-comparison__item {
    width: 100%;
  }
}
