/**
 * NOLS Single Page Checkout - Modal Component
 *
 * Modal for displaying checkout errors with improved UX
 * Addresses sticky header visibility issues
 * Styled to match NOLS brand guidelines
 */

/* NOLS Brand Colors */
:root {
  --nols-mud-orange: #d16727;
  --nols-mud-orange-dark: #a7521f;
  --nols-black: #2b2b2b;
  --nols-rock-gray: #2e3537;
  --nols-sand: #f2eddb;
  --nols-sand-lighter: #f7f4e9;
  --nols-white: #ffffff;
  --nols-gray-medium: #8e9294;
  --nols-border: rgba(0, 0, 0, 0.13);
  --nols-shadow-md: 0px 4px 4px rgba(0, 0, 0, 0.2);
}

/* Modal Overlay */
.nols-spc-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.3s ease;
  justify-content: center;
  align-items: center;
}

.nols-spc-modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* Modal Container */
.nols-spc-modal {
  background: var(--nols-white);
  border-radius: 0;
  box-shadow: var(--nols-shadow-md);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95) translateY(-20px);
  transition: transform 0.3s ease;
  padding: 0;
}

.nols-spc-modal-overlay.active .nols-spc-modal {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.nols-spc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: none;
  background-color: var(--nols-mud-orange);
  color: var(--nols-white);
}

.nols-spc-modal-header.success {
  background-color: #4caf50;
}

.nols-spc-modal-header.warning {
  background-color: #faa61a;
}

.nols-spc-modal-header.info {
  background-color: #2b7bb9;
}

.nols-spc-modal-title {
  margin: 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nols-spc-modal-icon {
  font-size: 1.75rem;
  font-weight: 900;
}

.nols-spc-modal-close {
  background: transparent;
  border: none;
  color: var(--nols-white);
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.nols-spc-modal-close:hover {
  opacity: 0.8;
}

.nols-spc-modal-close:focus {
  outline: 2px solid var(--nols-white);
  outline-offset: 2px;
}

/* Modal Body */
.nols-spc-modal-body {
  padding: 1.75rem;
  color: var(--nols-rock-gray);
  font-family: Arial, Helvetica, Verdana, sans-serif;
}

.nols-spc-modal-message {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.6;
}

/* Multiple Messages */
.nols-spc-modal-messages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nols-spc-modal-messages li {
  padding: 0.75rem 0;
  padding-left: 1.5rem;
  border-bottom: 1px solid var(--nols-border);
  position: relative;
  line-height: 1.6;
}

.nols-spc-modal-messages li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.nols-spc-modal-messages li:before {
  content: "•";
  color: var(--nols-mud-orange);
  font-weight: bold;
  font-size: 1.25rem;
  position: absolute;
  left: 0;
  top: 0.65rem;
}

/* Modal Footer */
.nols-spc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--nols-border);
  background-color: var(--nols-white);
}

.nols-spc-modal-button {
  padding: 12px 30px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 4px solid transparent;
  border-radius: 0;
  cursor: pointer;
  box-sizing: border-box;
}

.nols-spc-modal-button-primary {
  background-color: var(--nols-mud-orange);
  color: var(--nols-white);
  border: 4px solid var(--nols-mud-orange);
}

.nols-spc-modal-button-primary:hover {
  background-color: var(--nols-sand);
  color: #434a4d;
  border: 4px solid var(--nols-sand);
}

.nols-spc-modal-button-secondary {
  background-color: transparent;
  color: var(--nols-mud-orange);
  border: 4px solid var(--nols-mud-orange);
}

.nols-spc-modal-button-secondary:hover {
  background-color: var(--nols-mud-orange);
  color: var(--nols-white);
  border: 4px solid var(--nols-mud-orange);
}

.nols-spc-modal-button:focus {
  outline: 2px solid var(--nols-mud-orange);
  outline-offset: 2px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .nols-spc-modal {
    width: 95%;
    max-height: 90vh;
  }

  .nols-spc-modal-header {
    padding: 1.25rem;
  }

  .nols-spc-modal-title {
    font-size: 1.25rem;
  }

  .nols-spc-modal-body {
    padding: 1.25rem;
  }

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

  .nols-spc-modal-button {
    width: 100%;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .nols-spc-modal-overlay,
  .nols-spc-modal {
    transition: none;
  }
}

/* Prevent body scroll when modal is open */
body.nols-spc-modal-open {
  overflow: hidden;
}
