/* Styles for the Doorlyst "Book A Call" Modal Form */

/* Initial hidden state for the modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state for the modal overlay */
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal container for the form */
.modal-container {
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  border-radius: 24px;
  padding: 40px;
  width: 90%;
  max-width: 650px;
  height: 85vh;
  max-height: 850px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25),
              0 5px 20px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(40px) scale(0.95);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Baloo 2", sans-serif;
  color: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Active state for the modal container */
.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  flex-shrink: 0;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(255, 42, 60, 0.1);
}

.modal-header h3 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
  color: #1a1a1a;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #1a1a1a 0%, #4a4a4a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.close-button {
  background: rgba(0, 0, 0, 0.04);
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.close-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #FF2A3C 0%, #d82536 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.close-button:hover {
  color: #fff;
  background: rgba(255, 42, 60, 0.1);
  transform: rotate(90deg) scale(1.05);
}

.close-button:hover::before {
  opacity: 1;
}

.close-button:active {
  transform: rotate(90deg) scale(0.95);
}

/* Scrollable body for form fields */
.modal-body-scrollable {
  position: absolute;
  top: 115px;
  left: 40px;
  right: 40px;
  bottom: 100px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 15px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 42, 60, 0.3) rgba(0, 0, 0, 0.05);
}

/* WebKit scrollbar styling */
.modal-body-scrollable::-webkit-scrollbar {
  width: 6px;
}

.modal-body-scrollable::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
}

.modal-body-scrollable::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 42, 60, 0.4) 0%, rgba(255, 42, 60, 0.6) 100%);
  border-radius: 10px;
  transition: background 0.3s ease;
}

.modal-body-scrollable::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 42, 60, 0.6) 0%, rgba(255, 42, 60, 0.8) 100%);
}


/* Form group styling */
.form-group {
  margin-bottom: 28px;
  opacity: 0;
  animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Staggered animation for form fields */
.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.15s; }
.form-group:nth-child(3) { animation-delay: 0.2s; }
.form-group:nth-child(4) { animation-delay: 0.25s; }
.form-group:nth-child(5) { animation-delay: 0.3s; }
.form-group:nth-child(6) { animation-delay: 0.35s; }
.form-group:nth-child(7) { animation-delay: 0.4s; }
.form-group:nth-child(8) { animation-delay: 0.45s; }

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  color: #2a2a2a;
  letter-spacing: -0.2px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  font-family: "Baloo 2", sans-serif;
  font-size: 1rem;
  background: #fff;
  color: #1a1a1a;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.form-group input[type="text"]:hover,
.form-group input[type="email"]:hover,
.form-group input[type="tel"]:hover,
.form-group input[type="date"]:hover,
.form-group input[type="time"]:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: rgba(255, 42, 60, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="date"]:focus,
.form-group input[type="time"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #FF2A3C;
  box-shadow: 0 0 0 4px rgba(255, 42, 60, 0.12),
              0 8px 24px rgba(255, 42, 60, 0.15);
  outline: none;
  transform: translateY(-2px);
  border-radius: 14px;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Date and Time inputs - Red accent styling */
.form-group input[type="date"],
.form-group input[type="time"] {
  cursor: pointer;
  accent-color: #FF2A3C !important;
  color-scheme: light;
  border-radius: 14px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Force red accent color in all browsers */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  accent-color: #FF2A3C !important;
}

/* Style selected date/time values */
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper {
  accent-color: #FF2A3C !important;
}

/* Style the calendar picker indicator icon */
.form-group input[type="date"]::-webkit-calendar-picker-indicator,
.form-group input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(27%) sepia(98%) saturate(2791%) hue-rotate(346deg) brightness(94%) contrast(101%);
  opacity: 0.8;
  transition: all 0.3s ease;
  width: 20px;
  height: 20px;
}

.form-group input[type="date"]:hover::-webkit-calendar-picker-indicator,
.form-group input[type="time"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
  transform: scale(1.1);
}

.form-group input[type="date"]:focus::-webkit-calendar-picker-indicator,
.form-group input[type="time"]:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
  transform: scale(1.15);
}

/* Style the date text segments for red accent */
.form-group input[type="date"]::-webkit-datetime-edit-text,
.form-group input[type="time"]::-webkit-datetime-edit-text {
  color: #4a4a4a;
  padding: 0 2px;
}

.form-group input[type="date"]::-webkit-datetime-edit-month-field,
.form-group input[type="date"]::-webkit-datetime-edit-day-field,
.form-group input[type="date"]::-webkit-datetime-edit-year-field,
.form-group input[type="time"]::-webkit-datetime-edit-hour-field,
.form-group input[type="time"]::-webkit-datetime-edit-minute-field,
.form-group input[type="time"]::-webkit-datetime-edit-ampm-field {
  color: #1a1a1a;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.form-group input[type="date"]::-webkit-datetime-edit-month-field:focus,
.form-group input[type="date"]::-webkit-datetime-edit-day-field:focus,
.form-group input[type="date"]::-webkit-datetime-edit-year-field:focus,
.form-group input[type="time"]::-webkit-datetime-edit-hour-field:focus,
.form-group input[type="time"]::-webkit-datetime-edit-minute-field:focus,
.form-group input[type="time"]::-webkit-datetime-edit-ampm-field:focus {
  background: rgba(255, 42, 60, 0.15);
  color: #FF2A3C;
  outline: none;
}

/* Firefox date/time input styling */
.form-group input[type="date"]::-moz-focus-inner,
.form-group input[type="time"]::-moz-focus-inner {
  border: 0;
}

/* Additional styling for when date/time has a value */
.form-group input[type="date"]:valid,
.form-group input[type="time"]:valid {
  color: #1a1a1a;
}

/* Specific focus styling for date inputs to prevent border breaking */
.form-group input[type="date"]:focus,
.form-group input[type="time"]:focus {
  border: 2px solid #FF2A3C !important;
  border-radius: 14px !important;
  box-shadow: 0 0 0 4px rgba(255, 42, 60, 0.12),
              0 8px 24px rgba(255, 42, 60, 0.15) !important;
  outline: none !important;
  transform: translateY(-2px) translateX(2px);
  margin-left: 1px;
}

/* Radio button styling for Real Estate Type */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.radio-group label {
  background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
  padding: 13px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(0, 0, 0, 0.06);
  font-weight: 500;
  font-size: 0.95rem;
  color: #4a4a4a;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.radio-group label::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #FF2A3C 0%, #d82536 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.radio-group label:hover {
  border-color: rgba(255, 42, 60, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.radio-group input[type="radio"] {
  display: none;
}

.radio-group input[type="radio"]:checked + label {
  background: linear-gradient(135deg, #FF2A3C 0%, #d82536 100%);
  color: #fff;
  border-color: #FF2A3C;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(255, 42, 60, 0.35);
  font-weight: 600;
}

.radio-group input[type="radio"]:checked + label::before {
  opacity: 1;
}

/* Conditional fields */
.hidden-field {
  display: none;
}

/* Investment size dropdown and custom input */
.investment-options {
  display: flex;
  gap: 10px;
  align-items: center;
}

.investment-options select {
  flex-grow: 1;
}

.investment-custom-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: "Baloo 2", sans-serif;
  font-size: 1rem;
}

/* Date and time picker styling */
.datetime-group {
  display: flex;
  gap: 18px;
}

.datetime-group input[type="date"],
.datetime-group input[type="time"] {
  flex: 1;
}

/* Form action buttons */
.modal-footer {
  position: absolute;
  bottom: 40px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 0;
  flex-shrink: 0;
  padding-top: 25px;
  border-top: 2px solid rgba(255, 42, 60, 0.08);
}

.modal-button {
  padding: 15px 35px;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  font-family: "Baloo 2", sans-serif;
  letter-spacing: -0.2px;
}

.modal-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-button:hover::before {
  opacity: 1;
}

.modal-button.cancel {
  background: linear-gradient(135deg, #f0f0f0 0%, #e5e5e5 100%);
  color: #4a4a4a;
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.modal-button.cancel:hover {
  background: linear-gradient(135deg, #e8e8e8 0%, #dddddd 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.modal-button.cancel:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.modal-button.submit {
  background: linear-gradient(135deg, #FF2A3C 0%, #d82536 100%);
  color: #fff;
  border: 2px solid #FF2A3C;
  box-shadow: 0 8px 24px rgba(255, 42, 60, 0.35);
  position: relative;
  overflow: hidden;
}

.modal-button.submit::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.modal-button.submit:hover {
  background: linear-gradient(135deg, #d82536 0%, #c01d2d 100%);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(255, 42, 60, 0.45);
}

.modal-button.submit:active {
  transform: translateY(-2px) scale(0.98);
}

.modal-button.submit:active::after {
  width: 300px;
  height: 300px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .modal-container {
    padding: 30px 25px;
    max-width: 95%;
    height: 90vh;
    border-radius: 20px;
  }

  .modal-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
  }

  .modal-header h3 {
    font-size: 1.75rem;
  }

  .close-button {
    font-size: 1.75rem;
    width: 38px;
    height: 38px;
  }

  .modal-body-scrollable {
    top: 95px;
    left: 25px;
    right: 25px;
    bottom: 90px;
  }

  .datetime-group {
    flex-direction: column;
    gap: 12px;
  }

  .investment-options {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-footer {
    bottom: 30px;
    left: 25px;
    right: 25px;
    padding-top: 20px;
  }

  .modal-button {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .radio-group label {
    padding: 12px 18px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .modal-container {
    padding: 25px 20px;
    border-radius: 18px;
    max-width: calc(100% - 20px);
    margin: 10px;
  }

  .modal-header h3 {
    font-size: 1.5rem;
  }

  .modal-body-scrollable {
    top: 85px;
    left: 20px;
    right: 20px;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 10px;
    bottom: 25px;
    left: 20px;
    right: 20px;
  }

  .modal-button {
    width: 100%;
    padding: 14px 24px;
  }

  .radio-group {
    gap: 8px;
  }

  .radio-group label {
    flex: 1 1 calc(50% - 4px);
    text-align: center;
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

/* Additional mobile optimizations for very small screens */
@media (max-width: 390px) {
  .modal-container {
    padding: 20px 16px;
    max-width: calc(100% - 16px);
    margin: 8px;
    height: 88vh;
  }

  .modal-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
  }

  .modal-header h3 {
    font-size: 1.4rem;
  }

  .modal-body-scrollable {
    top: 80px;
    left: 16px;
    right: 16px;
    bottom: 85px;
    padding-right: 10px;
  }

  .modal-footer {
    bottom: 20px;
    left: 16px;
    right: 16px;
    padding-top: 16px;
  }

  .form-group {
    margin-bottom: 24px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .form-group label {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .radio-group label {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .modal-button {
    padding: 13px 20px;
    font-size: 0.95rem;
  }
}

/* Emergency fixes for ultra-small screens */
@media (max-width: 320px) {
  .modal-container {
    padding: 16px 12px;
    max-width: calc(100% - 12px);
    margin: 6px;
    height: 86vh;
  }

  .modal-header h3 {
    font-size: 1.3rem;
  }

  .modal-body-scrollable {
    top: 75px;
    left: 12px;
    right: 12px;
    bottom: 80px;
  }

  .modal-footer {
    bottom: 16px;
    left: 12px;
    right: 12px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .radio-group label {
    padding: 8px 6px;
    font-size: 0.75rem;
  }

  .modal-button {
    padding: 12px 18px;
    font-size: 0.9rem;
  }
}

/* Loading state for submit button */
.modal-button.submit.loading {
  pointer-events: none;
  position: relative;
}

.modal-button.submit.loading::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success animation */
@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.modal-button.submit.success {
  animation: successPulse 0.6s ease;
}
