/* Modal Styles - Responsive and No-Scroll Design */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden; /* Remove scroll from modal container */
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(5px);
}

.modal.show {
  display: flex !important;
}

.modal-content {
  background: linear-gradient(135deg, #344464 0%, #182949 100%);
  margin: 0;
  max-width: min(95vw, 600px);
  width: 95vw;
  max-height: 98vh;
  height: auto;
  border-radius: 20px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  color: #fff;
  border: 2px solid #d3a77b;
  animation: slideDown 0.4s ease;
  direction: rtl;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 25px 15px 25px;
  border-bottom: 1px solid rgba(211, 167, 123, 0.3);
  flex-shrink: 0;
  position: relative;
}

.modal-header h2 {
  margin: 0;
  color: #d3a77b;
  font-size: clamp(18px, 4vw, 24px);
  text-align: center;
  font-weight: 600;
}

.close-modal {
  position: absolute;
  top: 15px;
  left: 20px;
  font-size: 28px;
  color: #d3a77b;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(211, 167, 123, 0.1);
  z-index: 10;
}

.close-modal:hover {
  background: rgba(211, 167, 123, 0.2);
  transform: rotate(90deg);
}

.modal-body {
  padding: 15px 25px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d3a77b transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: #d3a77b;
  border-radius: 3px;
}

.modal-footer {
  padding: 15px 25px 20px 25px;
  text-align: center;
  border-top: 1px solid rgba(211, 167, 123, 0.3);
  flex-shrink: 0;
}

.modal-footer p {
  margin: 0;
  font-size: 14px;
  color: #d3a77b;
}

.modal-footer a {
  color: #4CAF50;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.modal-footer a:hover {
  color: #66BB6A;
  text-decoration: underline;
}

/* Form Styles */
.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #d3a77b;
  font-size: 14px;
}

.input-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid rgba(211, 167, 123, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.input-group input:focus {
  outline: none;
  border-color: #d3a77b;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(211, 167, 123, 0.2);
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 15px 0;
  text-transform: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #66BB6A, #4CAF50);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.divider {
  text-align: center;
  margin: 20px 0 15px 0;
  position: relative;
  color: rgba(211, 167, 123, 0.7);
  font-size: 14px;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(211, 167, 123, 0.3);
  z-index: 1;
}

.divider span {
  background: #344464;
  padding: 0 15px;
  position: relative;
  z-index: 2;
}

/* Subscription Styles */
.pricing h3 {
  color: #d3a77b;
  font-size: 18px;
  margin-bottom: 15px;
  text-align: center;
}

.subscription-options {
  margin-bottom: 20px;
}

.subscription-options label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  border: 2px solid rgba(211, 167, 123, 0.3);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.02);
}

.subscription-options label:hover {
  border-color: #d3a77b;
  background: rgba(211, 167, 123, 0.1);
  transform: translateY(-1px);
}

.subscription-options input[type="radio"] {
  margin-left: 10px;
  accent-color: #4CAF50;
}

.subscription-options input[type="radio"]:checked + span {
  color: #4CAF50;
  font-weight: 600;
}

.subscription-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.subscription-info {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 10px;
  margin-top: 15px;
  border: 1px solid rgba(211, 167, 123, 0.2);
}

/* Loading States */
.loading-plans {
  text-align: center;
  padding: 20px;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(211, 167, 123, 0.3);
  border-top: 2px solid #d3a77b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-height: 700px) {
  .modal-content {
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 15px 25px 10px 25px;
  }
  
  .modal-body {
    padding: 10px 25px;
  }
  
  .modal-footer {
    padding: 10px 25px 15px 25px;
  }
  
  .input-group {
    margin-bottom: 12px;
  }
  
  .input-group input {
    padding: 10px 12px;
  }
  
  .btn-primary {
    padding: 12px 20px;
    margin: 10px 0;
  }
}

@media (max-height: 600px) {
  .modal-content {
    max-height: 98vh;
    border-radius: 15px;
  }
  
  .modal-header h2 {
    font-size: 18px;
  }
  
  .input-group {
    margin-bottom: 10px;
  }
  
  .pricing h3 {
    font-size: 16px;
    margin-bottom: 10px;
  }
  
  .subscription-options label {
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  .modal-content {
    width: 98vw;
    max-width: 98vw;
    margin: 0;
  }
  
  .modal-header, .modal-body, .modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 480px) {
  .modal-header {
    padding: 15px 15px 10px 15px;
  }
  
  .modal-body {
    padding: 10px 15px;
  }
  
  .modal-footer {
    padding: 10px 15px 15px 15px;
  }
  
  .input-group input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 15px;
  }
  
  .close-modal {
    left: 15px;
    top: 12px;
    width: 30px;
    height: 30px;
    font-size: 24px;
  }
}

@media (max-width: 360px) {
  .modal-content {
    border-radius: 10px;
  }
  
  .modal-header, .modal-body, .modal-footer {
    padding-left: 12px;
    padding-right: 12px;
  }
}
