/* Modal and form styles */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--neo-surface);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 1000px;
  width: 100%;
  padding: 0;
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--neo-bg);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 8px var(--neo-shadow-dark), -4px -4px 8px var(--neo-shadow-light);
  transition: all .2s ease;
  z-index: 10;
}

.modal-close:hover {
  transform: rotate(90deg);
  background: var(--neo-accent);
  color: white;
}

/* Two-column layout */
.modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  overflow: hidden;
}

/* Package Details Section (Left) */
.modal-package-details {
  background: linear-gradient(135deg, var(--neo-primary), var(--neo-accent));
  padding: 40px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
}

.modal-package-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-package-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-package-title {
  font-size: 2rem;
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

.modal-package-subtitle {
  font-size: 1rem;
  margin: 0;
  opacity: 0.95;
  line-height: 1.5;
}

/* Features List */
.modal-package-features h4 {
  font-size: 1.1rem;
  margin: 0 0 16px 0;
  font-weight: 600;
  opacity: 0.9;
}

.modal-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-features-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
}

.modal-features-list li span {
  font-weight: 500;
}

.modal-feature-check-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.95;
  fill: currentColor;
}

/* Package Info Items */
.modal-package-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-info-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-info-icon {
  font-size: 28px;
  opacity: 0.95;
  flex-shrink: 0;
}

.modal-info-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.modal-info-label {
  font-size: 0.85rem;
  opacity: 0.85;
  font-weight: 500;
}

.modal-info-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-info-price .modal-info-value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Form Section (Right) */
.modal-form-section {
  padding: 40px;
  background: var(--neo-surface);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-form-section h3 {
  font-size: 1.75rem;
  margin-bottom: 24px;
  color: var(--neo-text);
  font-weight: 700;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: var(--neo-text);
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
  padding: 14px 18px;
  border-radius: 12px;
  border: 2px solid var(--glass-border);
  background: var(--neo-bg);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--neo-text);
  transition: all .2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--neo-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.modal-submit {
  margin-top: 8px;
  font-size: 1.05rem;
  padding: 16px 32px;
}

/* Responsive Design - Tablets */
@media (max-width: 1024px) and (min-width: 769px) {
  .modal {
    max-width: 90vw;
  }

  .modal-package-details {
    padding: 32px;
  }

  .modal-form-section {
    padding: 32px;
  }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
  .modal {
    max-width: 100vw;
    max-height: 95vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100%;
    overflow-y: auto;
  }

  /* Compact Package Details Section */
  .modal-package-details {
    background: linear-gradient(135deg, var(--neo-primary), var(--neo-accent));
    padding: 20px;
    gap: 16px;
    max-height: none;
    position: relative;
    overflow-y: visible;
  }

  /* Package Header - Always Visible */
  .modal-package-header {
    gap: 8px;
  }

  .modal-package-badge {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .modal-package-title {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  .modal-package-subtitle {
    font-size: 0.85rem;
    display: none; /* Hide subtitle on mobile to save space */
  }

  /* Features - Collapsible on Mobile */
  .modal-package-features {
    position: relative;
  }

  .modal-package-features h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    user-select: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.2s ease;
  }

  .modal-package-features h4:active {
    background: rgba(255, 255, 255, 0.15);
  }

  .modal-package-features h4::after {
    content: '▼';
    font-size: 1rem;
    opacity: 0.8;
    transition: transform 0.3s ease, opacity 0.2s ease;
    margin-left: 8px;
    line-height: 1;
  }

  .modal-package-features h4:hover::after {
    opacity: 1;
  }

  .modal-package-features.collapsed h4::after {
    transform: rotate(-90deg);
  }

  .modal-features-list {
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
  }

  .modal-package-features.collapsed .modal-features-list {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
  }

  .modal-features-list li {
    font-size: 0.85rem;
    font-weight: 500;
    gap: 8px;
  }

  .modal-features-list li span {
    font-weight: 500;
  }

  .modal-feature-check-icon {
    width: 20px;
    height: 20px;
  }

  /* Package Info - Compact Grid */
  .modal-package-info {
    padding: 16px;
    gap: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .modal-info-item {
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-info-item.modal-info-price {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 12px;
    margin-top: 4px;
  }

  .modal-info-icon {
    font-size: 24px;
  }

  .modal-info-content {
    gap: 2px;
  }

  .modal-info-label {
    font-size: 0.75rem;
  }

  .modal-info-value {
    font-size: 0.95rem;
  }

  .modal-info-price .modal-info-content {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .modal-info-price .modal-info-value {
    font-size: 1.5rem;
    font-weight: 700;
  }

  /* Form Section - Optimized */
  .modal-form-section {
    padding: 20px;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .modal-form-section h3 {
    font-size: 1.3rem;
    margin-bottom: 16px;
  }

  .modal form {
    gap: 16px;
  }

  .form-group {
    gap: 6px;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group textarea {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .form-group textarea {
    min-height: 80px;
  }

  .modal-submit {
    margin-top: 4px;
    font-size: 1rem;
    padding: 14px 24px;
    width: 100%;
  }

  /* Close Button - Better Positioning */
  .modal-close {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
  }

  .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
  }
}

/* Extra Small Mobile */
@media (max-width: 480px) {
  .modal-package-details {
    padding: 16px;
  }

  .modal-form-section {
    padding: 16px;
  }

  .modal-package-title {
    font-size: 1.2rem;
  }

  .modal-info-item {
    font-size: 0.8rem;
  }

  .modal-info-price .modal-info-value {
    font-size: 1.3rem;
  }
}

/* Small Viewport Height - Ensure scrollability */
@media (max-height: 700px) {
  .modal {
    max-height: 90vh;
    margin: auto;
  }

  .modal-overlay {
    align-items: center;
    padding: 2vh 20px;
  }
}

@media (max-height: 600px) {
  .modal {
    max-height: 95vh;
  }

  .modal-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-package-details,
  .modal-form-section {
    overflow-y: visible;
  }
}

/* Very Small Viewport Height */
@media (max-height: 500px) {
  .modal {
    max-height: 98vh;
  }

  .modal-overlay {
    padding: 1vh 10px;
  }

  .modal-package-details {
    padding: 12px;
    gap: 12px;
  }

  .modal-form-section {
    padding: 12px;
  }

  .modal-form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }

  .modal form {
    gap: 12px;
  }

  .form-group {
    gap: 4px;
  }

  .form-group input,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .form-group textarea {
    min-height: 60px;
  }

  .modal-submit {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
}
