/* === MODAL BASE STYLES === */
.modal {
  display: none !important;
  position: fixed !important;
  z-index: 99999 !important;
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15,18,24,0.9) !important;
  backdrop-filter: blur(5px) !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  padding: 1rem !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
}

.modal.open {
  display: flex !important;
  animation: modalFadeIn 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@keyframes modalFadeIn { 
  from { 
    opacity: 0; 
    transform: scale(0.9); 
    backdrop-filter: blur(0px);
  } 
  to { 
    opacity: 1; 
    transform: scale(1); 
    backdrop-filter: blur(5px);
  } 
}

/* === MODAL CONTENT BASE === */
.modal-content {
  background: linear-gradient(135deg, #222C36 0%, #1e2832 100%); 
  color: #eaeaea; 
  border-radius: 20px; 
  box-shadow: 
    0 25px 80px rgba(0,0,0,0.5),
    0 0 0 1px rgba(107, 193, 255, 0.1);
  position: relative; 
  max-width: 95vw; 
  width: 100%;
  max-height: 95vh; 
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(1);
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@keyframes modalSlideIn {
  from { 
    transform: translateY(30px) scale(0.95); 
    opacity: 0; 
  }
  to { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

/* === CLOSE BUTTON === */
.close-modal {
  position: absolute; 
  top: 1rem; 
  right: 1rem; 
  background: rgba(0,0,0,0.7); 
  border: none; 
  color: #fff; 
  font-size: 1.5rem;
  cursor: pointer; 
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

.close-modal:hover {
  background: rgba(255,0,0,0.2);
  border-color: rgba(255,0,0,0.3);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 20px rgba(255,0,0,0.3);
}

.close-modal:focus {
  outline: 2px solid #6bc1ff;
  outline-offset: 2px;
}

/* === FORM MODAL (Mobile First) === */
.form-modal-content { 
  width: 100%; 
  max-width: 100%;
  flex-direction: column; 
  align-items: stretch; 
  padding: 1.5rem 1rem;
  overflow-y: auto;
  max-height: 90vh;
  margin: auto;
}

.form-modal-content h2 {
  color: #6bc1ff;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 700;
}

.form-modal-content .form-group {
  margin-bottom: 1.2rem;
}

.form-modal-content .form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #6bc1ff;
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.form-modal-content .form-control {
  width: 100%;
  padding: 0.9rem 1rem;
  background: rgba(107,193,255,0.05);
  border: 1.5px solid rgba(107,193,255,0.15);
  border-radius: 8px;
  color: #eaeaea;
  font-size: 16px; /* Prevent iOS zoom */
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-modal-content .form-control:focus {
  outline: none;
  border-color: #6bc1ff;
  background: rgba(107,193,255,0.1);
  box-shadow: 0 0 0 3px rgba(107,193,255,0.1);
}

.form-modal-content .form-control::placeholder {
  color: #888;
  opacity: 1;
}

.form-modal-content .submit-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #6bc1ff 0%, #4a90e2 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: clamp(1rem, 3vw, 1.1rem);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
  font-family: inherit;
}

.form-modal-content .submit-btn:hover {
  background: linear-gradient(135deg, #4a90e2 0%, #6bc1ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(107, 193, 255, 0.3);
}

.form-modal-content .submit-btn:active {
  transform: translateY(0);
}

/* === INFO MODAL (Mobile First) === */
.info-modal-content { 
  display: flex; 
  flex-direction: column;
  width: 100%; 
  max-width: 100%;
  min-height: auto;
  overflow: hidden;
}

.modal-info-img { 
  flex: none;
  width: 100%;
  height: 200px;
  background: #181b20; 
  border-radius: 20px 20px 0 0; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.modal-info-img::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(107,193,255,0.1) 0%, rgba(74,144,226,0.1) 100%);
  z-index: 1;
}

.modal-info-img img { 
  width: 100%; 
  height: 100%; 
  border-radius: 20px 20px 0 0; 
  object-fit: cover;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
}

.modal-info-img:hover img {
  transform: scale(1.05);
}

.modal-info-txt { 
  flex: 1; 
  padding: 1.5rem 1rem; 
  text-align: left;
  overflow-y: auto;
  max-height: 60vh;
  scrollbar-width: thin;
  scrollbar-color: #6bc1ff rgba(107,193,255,0.1);
}

.modal-info-txt::-webkit-scrollbar {
  width: 6px;
}

.modal-info-txt::-webkit-scrollbar-track {
  background: rgba(107,193,255,0.1);
  border-radius: 3px;
}

.modal-info-txt::-webkit-scrollbar-thumb {
  background: #6bc1ff;
  border-radius: 3px;
}

.modal-info-txt h2 {
  margin-top: 0;
  margin-bottom: 1.2rem;
  color: #6bc1ff;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 700;
  line-height: 1.2;
}

.modal-info-txt p {
  line-height: 1.6;
  margin-bottom: 1rem;
  color: #d0d0d0;
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.modal-info-txt ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.modal-info-txt li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
  color: #d0d0d0;
}

/* === SHARED MODAL ELEMENTS === */
.course-summary {
  background: rgba(107, 193, 255, 0.1);
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  border-left: 4px solid #6bc1ff;
}

.expert-notice-form {
  background: rgba(255, 193, 7, 0.15);
  padding: 1rem;
  border-radius: 10px;
  border-left: 4px solid #ffc107;
  margin-bottom: 1.5rem;
  text-align: center;
}

.expert-notice-form p {
  margin: 0;
  font-weight: 600;
  color: #ffc107;
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.location-item {
  background: rgba(107, 193, 255, 0.1);
  padding: 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border-left: 3px solid #6bc1ff;
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.course-price {
  background: rgba(40, 167, 69, 0.15);
  padding: 1rem;
  border-radius: 10px;
  border-left: 4px solid #28a745;
  text-align: center;
  margin: 1rem 0;
}

.course-price p {
  margin: 0;
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  color: #28a745;
  font-weight: 700;
}

/* === CHECKBOX GROUPS === */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  margin: 0;
  margin-top: 0.3rem;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: #6bc1ff;
}

.checkbox-group label {
  margin: 0;
  font-size: clamp(0.85rem, 3vw, 0.95rem);
  line-height: 1.4;
  color: #d0d0d0;
}

/* === FORM FEEDBACK === */
.form-feedback {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: clamp(0.9rem, 3vw, 1rem);
  text-align: center;
}

.form-feedback.success {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.form-feedback.error {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

/* === LOADING STATE === */
.form-loading {
  position: relative;
  overflow: hidden;
}

.form-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(107,193,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* === TABLET LANDSCAPE (768px+) === */
@media (min-width: 768px) {
  .modal {
    padding: 2rem !important;
  }
  
  .modal-content {
    max-width: 90vw;
    border-radius: 24px;
  }
  
  .close-modal {
    top: 1.5rem;
    right: 1.5rem;
    width: 45px;
    height: 45px;
    font-size: 1.6rem;
  }
  
  .form-modal-content {
    max-width: 550px;
    padding: 2.5rem 2rem;
    max-height: 85vh;
  }
  
  .info-modal-content {
    flex-direction: row;
    max-width: 800px;
    min-height: 500px;
  }
  
  .modal-info-img {
    flex: 0 0 40%;
    height: auto;
    min-height: 500px;
    border-radius: 24px 0 0 24px;
  }
  
  .modal-info-img img {
    border-radius: 24px 0 0 24px;
  }
  
  .modal-info-txt {
    padding: 2.5rem 2rem;
    max-height: 500px;
  }
  
  .course-summary,
  .expert-notice-form {
    padding: 1.2rem;
  }
  
  .location-item {
    padding: 1rem;
  }
}

/* === TABLET PORTRAIT (600px+) === */
@media (min-width: 600px) and (max-width: 767px) {
  .modal {
    padding: 1.5rem !important;
  }
  
  .modal-content {
    max-width: 92vw;
  }
  
  .form-modal-content {
    max-width: 500px;
    padding: 2rem 1.5rem;
  }
  
  .modal-info-img {
    height: 250px;
  }
  
  .modal-info-txt {
    padding: 2rem 1.5rem;
  }
}

/* === DESKTOP (900px+) === */
@media (min-width: 900px) {
  .modal {
    padding: 3rem !important;
  }
  
  .modal-content {
    max-width: 85vw;
  }
  
  .info-modal-content {
    max-width: 900px;
    min-height: 550px;
  }
  
  .modal-info-img {
    flex: 0 0 45%;
    min-height: 550px;
  }
  
  .modal-info-txt {
    padding: 3rem 2.5rem;
    max-height: 550px;
  }
  
  .form-modal-content {
    max-width: 600px;
    padding: 3rem 2.5rem;
  }
  
  .close-modal:hover {
    transform: rotate(90deg) scale(1.2);
  }
}

/* === LARGE DESKTOP (1200px+) === */
@media (min-width: 1200px) {
  .info-modal-content {
    max-width: 1000px;
    min-height: 600px;
  }
  
  .modal-info-img {
    min-height: 600px;
  }
  
  .modal-info-txt {
    max-height: 790px;
    font-size: 1.1rem;
  }
  
  .modal-info-txt h2 {
    font-size: 2rem;
  }
}

/* === SMALL MOBILE (max 480px) === */
@media (max-width: 480px) {
  .modal {
    padding: 0.5rem !important;
  }
  
  .modal-content {
    max-width: 98vw;
    max-height: 98vh;
    border-radius: 16px;
  }
  
  .close-modal {
    top: 0.8rem;
    right: 0.8rem;
    width: 35px;
    height: 35px;
    font-size: 1.4rem;
  }
  
  .form-modal-content {
    padding: 1.5rem 1rem;
    max-height: 95vh;
  }
  
  .modal-info-img {
    height: 180px;
    border-radius: 16px 16px 0 0;
  }
  
  .modal-info-img img {
    border-radius: 16px 16px 0 0;
  }
  
  .modal-info-txt {
    padding: 1.2rem 1rem;
    max-height: 65vh;
  }
  
  .course-summary,
  .expert-notice-form {
    padding: 0.8rem;
  }
  
  .location-item {
    padding: 0.7rem;
  }
  
  .form-control {
    padding: 0.8rem;
    font-size: 16px; /* Important for iOS */
  }
  
  .submit-btn {
    padding: 1rem;
  }
}

/* === EXTRA SMALL MOBILE (max 360px) === */
@media (max-width: 360px) {
  .modal {
    padding: 0.25rem !important;
  }
  
  .modal-content {
    max-width: 99vw;
    max-height: 99vh;
  }
  
  .close-modal {
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
  
  .form-modal-content {
    padding: 1.2rem 0.8rem;
  }
  
  .modal-info-txt {
    padding: 1rem 0.8rem;
  }
  
  .modal-info-img {
    height: 160px;
  }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-content,
  .close-modal,
  .modal-info-img img,
  .submit-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* === HIGH CONTRAST === */
@media (prefers-contrast: high) {
  .modal-content {
    border: 2px solid #ffffff;
  }
  
  .form-control {
    border: 2px solid #6bc1ff;
  }
  
  .close-modal {
    border: 2px solid #ffffff;
  }
}

/* === KEYBOARD NAVIGATION === */
.modal-content *:focus {
  outline: 2px solid #6bc1ff !important;
  outline-offset: 2px !important;
}

/* === TOUCH IMPROVEMENTS === */
@media (hover: none) and (pointer: coarse) {
  .close-modal {
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
  }
  
  .submit-btn {
    min-height: 48px;
  }
  
  .form-control {
    min-height: 48px;
  }
}