/* ========================================
   XECHO REUSABLE MODAL COMPONENT
   Professional design with Montserrat & Inter fonts
======================================== */

/* Import Montserrat and Inter fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ========================================
   ANIMATIONS
======================================== */

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOutOverlay {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalGlow {
  0%, 100% {
    box-shadow: var(--modal-box-shadow, 
      0px 32px 64px rgba(0, 0, 0, 0.7),
      0px 16px 32px rgba(0, 0, 0, 0.5),
      inset 0px 2px 4px rgba(116, 185, 255, 0.1));
  }
  50% {
    box-shadow: 
      0px 40px 80px rgba(0, 0, 0, 0.8),
      0px 20px 40px rgba(0, 0, 0, 0.6),
      inset 0px 2px 4px rgba(116, 185, 255, 0.15),
      0 0 30px rgba(37, 95, 244, 0.2);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   MODAL OVERLAY & CONTAINER
======================================== */

.modal-overlay,
.modalOverlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  z-index: 999999;
  background: linear-gradient(
    145deg,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(8, 8, 15, 0.9) 100%
  );
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  animation: fadeInOverlay 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-overlay.slideDown,
.modalOverlay.slideDown {
  animation: fadeOutOverlay 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-content,
.modalContent {
  position: relative;
  padding: 2.5rem;
  border-radius: 24px;
  background: var(--background-gradient-light, 
    linear-gradient(145deg, 
      rgba(13, 13, 13, 0.95) 0%, 
      rgba(26, 26, 26, 0.9) 100%));
  backdrop-filter: blur(30px) saturate(150%) brightness(1.05);
  -webkit-backdrop-filter: blur(30px) saturate(150%) brightness(1.05);
  border: 2px solid rgba(116, 185, 255, 0.2);
  box-shadow: var(--modal-box-shadow, 
    0px 32px 64px rgba(0, 0, 0, 0.7),
    0px 16px 32px rgba(0, 0, 0, 0.5),
    inset 0px 2px 4px rgba(116, 185, 255, 0.1));
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
  z-index: 999999;
  animation: modalGlow 8s ease-in-out infinite, scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 95, 244, 0.5) transparent;
}

.modal-content::-webkit-scrollbar,
.modalContent::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track,
.modalContent::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb,
.modalContent::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, 
    var(--color-accent, #255ff4), 
    var(--color-accent-light, #74b9ff));
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(37, 95, 244, 0.3);
}

.modal-content::before,
.modalContent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--color-accent, #255ff4) 20%, 
    var(--color-accent-light, #74b9ff) 50%, 
    var(--color-accent, #255ff4) 80%, 
    transparent 100%);
  border-radius: 24px 24px 0 0;
}

/* ========================================
   SIZE VARIANTS
======================================== */

.modal-content.demo-modal,
.sizeSmall {
  max-width: 400px;
  width: 90%;
}

.sizeMedium {
  max-width: 600px;
  width: 90%;
}

.sizeLarge {
  max-width: 900px;
  width: 90%;
}

.sizeXLarge {
  max-width: 1200px;
  width: 95%;
}

/* ========================================
   CLOSE BUTTON
======================================== */

.modal-close,
.closeButton {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-close:hover,
.closeButton:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: var(--color-accent, #255ff4);
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(37, 95, 244, 0.4);
}

.modal-close:focus,
.closeButton:focus {
  outline: 2px solid var(--color-accent, #255ff4);
  outline-offset: 2px;
}

.modal-close svg,
.closeButton svg {
  transition: transform 0.3s ease;
  width: 22px;
  height: 22px;
}

.modal-close:hover svg,
.closeButton:hover svg {
  transform: rotate(90deg);
}

/* ========================================
   HEADER SECTION
======================================== */

.modal-header,
.modalHeader {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2,
.modalTitle {
  font-family: 'Montserrat', var(--font-primary, sans-serif);
  font-size: 2.25rem;
  font-weight: 800;
  text-align: center;
  margin: 0;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ========================================
   BODY SECTION
======================================== */

.modal-body,
.modalBody {
  font-family: 'Inter', var(--font-secondary, sans-serif);
  color: #ffffff;
  line-height: 1.6;
}

.modal-body p,
.modalBody p {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: #ffffff;
  margin-bottom: 1.5rem;
  opacity: 0.95;
}

.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4,
.modal-body h5,
.modal-body h6,
.modalBody h1,
.modalBody h2,
.modalBody h3,
.modalBody h4,
.modalBody h5,
.modalBody h6 {
  font-family: 'Montserrat', var(--font-primary, sans-serif);
  color: #ffffff;
  margin-bottom: 1rem;
  font-weight: 600;
}

.modal-body ul,
.modal-body ol,
.modalBody ul,
.modalBody ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
  list-style: none;
  position: relative;
}

.modal-body li,
.modalBody li {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #ffffff;
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}

.modal-body ul li::before,
.modalBody ul li::before {
  content: '▶';
  position: absolute;
  left: 0;
  color: var(--color-accent, #255ff4);
  font-size: 0.8rem;
  top: 0.1rem;
}

.modal-body ol,
.modalBody ol {
  counter-reset: list-counter;
}

.modal-body ol li,
.modalBody ol li {
  counter-increment: list-counter;
}

.modal-body ol li::before,
.modalBody ol li::before {
  content: counter(list-counter) '.';
  position: absolute;
  left: 0;
  color: var(--color-accent, #255ff4);
  font-weight: 600;
  font-family: 'Montserrat', var(--font-primary, sans-serif);
}

.modal-body strong,
.modalBody strong {
  font-weight: 700;
  color: #ffffff;
  font-family: 'Montserrat', var(--font-primary, sans-serif);
}

.modal-body a,
.modalBody a {
  color: var(--color-accent, #255ff4);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border-bottom: 1px solid transparent;
}

.modal-body a:hover,
.modalBody a:hover {
  color: var(--color-accent-light, #74b9ff);
  border-bottom-color: var(--color-accent-light, #74b9ff);
}

/* ========================================
   INTRO SECTION
======================================== */

.modal-intro {
  text-align: center;
  margin-bottom: 30px;
}

.modal-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0271FC, #74b9ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-icon svg {
  width: 30px;
  height: 30px;
  color: white;
}

.modal-intro h3 {
  color: white;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 10px;
  font-family: 'Montserrat', var(--font-primary, sans-serif);
}

.modal-intro p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  font-family: 'Inter', var(--font-secondary, sans-serif);
}

/* ========================================
   FOOTER SECTION & ACTIONS
======================================== */

.modal-footer,
.modal-actions,
.modalFooter {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ========================================
   BUTTON STYLING (XECHO Platform Style)
======================================== */

.btn,
.modalButton {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(36, 35, 34, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.5rem 1rem;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-primary, 'Montserrat', sans-serif);
  font-size: 1rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  width: auto;
  height: auto;
  margin: 0.25rem;
  z-index: 1;
  min-width: 120px;
  text-decoration: none;
}

.btn:hover,
.modalButton:hover {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn:focus,
.modalButton:focus {
  outline: 2px solid var(--color-accent, #255ff4);
  outline-offset: 2px;
}

.btn:disabled,
.modalButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover,
.modalButton:disabled:hover {
  background: rgba(36, 35, 34, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  transform: none;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Button variants */
.btn.btn-primary,
.btn-primary,
.modalButton.primary {
  background: linear-gradient(135deg, var(--color-accent, #255ff4) 0%, var(--color-accent-light, #74b9ff) 100%);
  border: 1px solid var(--color-accent, #255ff4);
  color: #ffffff;
}

.btn.btn-primary:hover,
.btn-primary:hover,
.modalButton.primary:hover {
  background: linear-gradient(135deg, var(--color-accent-light, #74b9ff) 0%, var(--color-accent, #255ff4) 100%);
  box-shadow: 
    0 4px 12px rgba(37, 95, 244, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.btn-success,
.btn-success,
.modalButton.success {
  background: linear-gradient(135deg, var(--color-success, #00ff00) 0%, #27f727 100%);
  border: 1px solid var(--color-success, #00ff00);
  color: #000000;
  font-weight: 600;
}

.btn.btn-success:hover,
.btn-success:hover,
.modalButton.success:hover {
  background: linear-gradient(135deg, #27f727 0%, var(--color-success, #00ff00) 100%);
  box-shadow: 
    0 4px 12px rgba(39, 247, 39, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.btn-danger,
.btn-danger,
.modalButton.danger {
  background: linear-gradient(135deg, var(--color-error, #ff0000) 0%, #ff4444 100%);
  border: 1px solid var(--color-error, #ff0000);
  color: #ffffff;
  font-weight: 600;
}

.btn.btn-danger:hover,
.btn-danger:hover,
.modalButton.danger:hover {
  background: linear-gradient(135deg, #ff4444 0%, var(--color-error, #ff0000) 100%);
  box-shadow: 
    0 4px 12px rgba(255, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.btn-secondary,
.btn-secondary,
.modalButton.secondary {
  background: rgba(36, 35, 34, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.btn.btn-secondary:hover,
.btn-secondary:hover,
.modalButton.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-icon {
  width: 16px;
  height: 16px;
  margin-left: 8px;
}

/* ========================================
   FORM STYLES
======================================== */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: white;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 14px;
  font-family: 'Montserrat', var(--font-primary, sans-serif);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  font-family: 'Inter', var(--font-secondary, sans-serif);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent, #255ff4);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(37, 95, 244, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.form-group select option {
  background: #1a1a1a;
  color: white;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}

.form-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--color-accent, #255ff4);
}

.form-checkbox label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  cursor: pointer;
  font-family: 'Inter', var(--font-secondary, sans-serif);
}

.form-checkbox label a {
  color: var(--color-accent-light, #74b9ff);
  text-decoration: none;
}

.form-checkbox label a:hover {
  text-decoration: underline;
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

@media (max-width: 768px) {
  .modal-content,
  .modalContent {
    padding: 2rem 1.5rem;
    max-width: 95%;
    border-radius: 20px;
  }

  .modal-header h2,
  .modalTitle {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }

  .modal-body p,
  .modalBody p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
  }

  .modal-body ul,
  .modal-body ol,
  .modalBody ul,
  .modalBody ol {
    margin-left: 1.5rem;
  }

  .modal-body li,
  .modalBody li {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }

  .modal-close,
  .closeButton {
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
  }

  .modal-footer,
  .modal-actions,
  .modalFooter {
    flex-direction: column;
    gap: 0.75rem;
  }

  .btn,
  .modalButton {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    min-width: 100px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .sizeSmall,
  .sizeMedium,
  .sizeLarge,
  .sizeXLarge {
    width: 95%;
  }
}

@media (max-width: 480px) {
  .modal-content,
  .modalContent {
    padding: 1.5rem 1rem;
    max-height: 90vh;
    border-radius: 16px;
  }

  .modal-header h2,
  .modalTitle {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .modal-body p,
  .modalBody p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1rem;
  }

  .modal-body ul,
  .modal-body ol,
  .modalBody ul,
  .modalBody ol {
    margin-left: 1rem;
    margin-bottom: 1rem;
  }

  .modal-body li,
  .modalBody li {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    padding-left: 1rem;
  }

  .modal-header,
  .modalHeader {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
  }

  .modal-footer,
  .modal-actions,
  .modalFooter {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }

  .btn,
  .modalButton {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
    min-width: 90px;
    margin: 0.15rem;
  }

  .modal-close,
  .closeButton {
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
  }

  .modal-close svg,
  .closeButton svg {
    width: 18px;
    height: 18px;
  }
}

/* ========================================
   ACCESSIBILITY & PERFORMANCE
======================================== */

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-content,
  .modalOverlay,
  .modalContent {
    animation: none;
  }
  
  .modal-close:hover,
  .closeButton:hover,
  .btn:hover,
  .modalButton:hover {
    transform: none;
  }
  
  .modal-close:hover svg,
  .closeButton:hover svg {
    transform: none;
  }
}

.modal-content:focus,
.modal-close:focus,
.btn:focus,
.modalContent:focus,
.closeButton:focus,
.modalButton:focus {
  outline: 2px solid var(--color-accent, #255ff4);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .modal-content,
  .modalContent {
    border: 3px solid var(--color-accent, #255ff4);
    background: var(--background-gradient-xtradark, 
      linear-gradient(145deg, #000000 0%, #111111 100%));
  }
  
  .modal-header h2,
  .modal-body,
  .modal-body p,
  .modal-body li,
  .modal-body strong,
  .modalTitle,
  .modalBody,
  .modalBody p,
  .modalBody li,
  .modalBody strong {
    color: #ffffff;
  }
  
  .modal-close,
  .closeButton {
    border: 2px solid #ffffff;
    background: rgba(0, 0, 0, 0.8);
  }
}

/* Legacy animation support */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
} 