/*
 * Hora Events - General Form Styles
 * Shared styles for all registration forms across the plugin
 */

/* ==========================================================================
   BASE FORM STYLES
   ========================================================================== */

.hora-event-form,
.hora-form-fields,
.hora-checkout-form,
#hora-ticket-purchase-form {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #495057;
}

/* Form Container */
.hora-event-form {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

/* Form Title and Description */
.hora-event-form-title {
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: 600;
  color: #333;
  text-align: center;
  font-family: inherit;
}

.hora-event-form-description {
  margin-bottom: 30px;
  color: #666;
  text-align: center;
  line-height: 1.6;
  font-family: inherit;
}

/* ==========================================================================
    FORM FIELD STYLES
   ========================================================================== */

.hora-form-field,
.form-field {
  margin-bottom: 20px;
}

.hora-form-field:last-child,
.form-field:last-child,
.form-first-row:last-child,
.form-last-row:last-child {
  margin-bottom: 0;
}

.hora-tickets-main .woocommerce-billing-fields__field-wrapper {
  width: 100%;
  display: inline-block;
}

/* Field Labels */
.hora-form-field label,
.form-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #495057;
  font-size: 14px;
  font-family: inherit;
}

.hora-form-field .required,
.form-field .required,
.required {
  color: #dc3545;
  font-weight: 600;
}

/* Base Input Controls */
.hora-form-control,
.form-control,
.woocommerce-page form .form-row input.hora-form-control.form-control,
.woocommerce-page form .form-row select.hora-form-control.form-control,
.woocommerce-page form .form-row textarea.hora-form-control.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
}

.hora-form-control:focus,
.form-control:focus {
  outline: 0;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.hora-form-control:invalid,
.form-control:invalid,
.form-control[aria-invalid="true"],
.hora-form-control.error,
.form-control.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.hora-form-control:disabled,
.form-control:disabled {
  background-color: #e9ecef;
  opacity: 1;
  cursor: not-allowed;
}

/* ==========================================================================
   SPECIFIC INPUT TYPES
   ========================================================================== */

/* Select Styling */
select.hora-form-control,
select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
  appearance: none;
}

/* Textarea Styling */
textarea.hora-form-control,
textarea.form-control {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

/* Number and Date Inputs */
input[type="number"].hora-form-control,
input[type="date"].hora-form-control,
input[type="number"].form-control,
input[type="date"].form-control {
  appearance: none;
}

/* ==========================================================================
   CHECKBOX AND RADIO STYLES
   ========================================================================== */

/* Checkbox Styling */
.hora-checkbox-label,
.checkbox-label {
  display: flex;
  align-items: flex-start;
  font-weight: normal;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
}

.hora-checkbox-label input,
.checkbox-label input {
  margin-right: 8px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Checkbox Groups */
.hora-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hora-checkbox-group.hora-checkbox-inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 15px;
}

/* Toggle Switch Styling */
.hora-checkbox-toggle .hora-toggle-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: #ccc;
  border-radius: 24px;
  margin-right: 10px;
  transition: background-color 0.3s;
  cursor: pointer;
}

.hora-checkbox-toggle .hora-toggle-slider:before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.hora-checkbox-toggle input:checked ~ .hora-toggle-slider {
  background-color: #2196f3;
}

.hora-checkbox-toggle input:checked ~ .hora-toggle-slider:before {
  transform: translateX(20px);
}

.hora-checkbox-toggle input {
  display: none;
}

/* Radio Styling */
.hora-radio-label {
  display: flex;
  align-items: flex-start;
  font-weight: normal;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
}

.hora-radio-label input {
  width: auto;
  margin-right: 8px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Radio Groups */
.hora-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hora-radio-group.hora-radio-inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 15px;
}

/* ==========================================================================
   AUTOCOMPLETE STYLES
   ========================================================================== */

.hora-autocomplete-wrapper {
  position: relative;
}

.hora-autocomplete-input {
  position: relative;
}

.hora-autocomplete-input::-webkit-calendar-picker-indicator {
  display: none;
}

/* ==========================================================================
   FORM LAYOUT
   ========================================================================== */

/* Form Row */
form[data-event-register-form] .form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

form[data-event-register-form] .form-col,
form[data-event-register-form] .form-field {
  flex: 1;
}

.form-field.half {
  flex: 0 0 calc(50% - 10px);
}

.form-row-first {
  flex: 0 0 calc(50% - 10px);
}

.form-row-last {
  flex: 0 0 calc(50% - 10px);
}

.form-row-wide {
  flex: 1;
}

/* ==========================================================================
   SPECIAL FIELD TYPES
   ========================================================================== */

/* Header Fields */
.hora-form-header {
  margin: 0 0 15px;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #2196f3;
  padding-bottom: 8px;
  font-family: inherit;
}

.hora-form-header h1 {
  font-size: 28px;
}
.hora-form-header h2 {
  font-size: 24px;
}
.hora-form-header h3 {
  font-size: 20px;
}
.hora-form-header h4 {
  font-size: 18px;
}
.hora-form-header h5 {
  font-size: 16px;
}
.hora-form-header h6 {
  font-size: 14px;
}

/* Paragraph Fields */
.hora-form-paragraph {
  margin: 0 0 15px;
  line-height: 1.6;
  color: #666;
  font-family: inherit;
}

/* Field Description */
.field-description {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #6c757d;
  font-style: italic;
  font-family: inherit;
}

/* ==========================================================================
   OTHER FIELDS
   ========================================================================== */

.hora-other-input-wrapper {
  margin-top: 8px;
  margin-left: 24px;
  transition: all 0.3s ease;
}

.hora-other-input {
  width: 100%;
  max-width: 300px;
}

/* ==========================================================================
   FORM ACTIONS
   ========================================================================== */

.hora-event-form-actions,
.form-actions,
.form-submit {
  margin-top: 30px;
  text-align: center;
}

/* Buttons */
.btn,
.hora-btn {
  padding: 10px 20px;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  line-height: 1.5;
}

.btn:not(.hidden),
.hora-btn:not(.hidden) {
  display: inline-flex;
}

.btn-primary,
.hora-btn-primary {
  background-color: #2196f3;
  color: white;
}

.btn-primary:hover,
.hora-btn-primary:hover {
  background-color: #1976d2;
  color: white;
}

.btn-secondary,
.hora-btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover,
.hora-btn-secondary:hover {
  background-color: #545b62;
  color: white;
}

.btn-success,
.hora-btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover,
.hora-btn-success:hover {
  background-color: #218838;
  color: white;
}

.hora-reorder-btn {
  padding: 6px;
}

.btn svg {
  flex-shrink: 0;
}

/* Large Buttons */
.btn-lg,
.hora-btn-lg {
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 600;
  min-width: 200px;
}

/* ==========================================================================
   FORM SECTIONS
   ========================================================================== */

.form-section,
.ticket-details-section,
.billing-section,
.terms-section {
  margin-bottom: 30px;
  padding: 25px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.form-section h3,
.ticket-details-section h3,
.billing-section h3 {
  margin: 0 0 25px;
  font-size: 20px;
  color: #333;
  border-bottom: 2px solid #2196f3;
  padding-bottom: 10px;
  font-family: inherit;
}

/* Ticket Type Sections */
.ticket-type-section {
  margin-bottom: 25px;
  padding: 20px;
  background: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.ticket-type-section h4 {
  margin: 0 0 20px;
  font-size: 18px;
  color: #495057;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
  font-family: inherit;
}

.ticket-instance {
  margin-bottom: 20px;
  padding: 18px;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: 4px solid #2196f3;
}

.ticket-instance:last-child {
  margin-bottom: 0;
}

.ticket-instance h5 {
  margin: 0 0 15px;
  font-size: 16px;
  color: #333;
  font-weight: 600;
  font-family: inherit;
}

/* ==========================================================================
   ERROR STATES
   ========================================================================== */

.form-error {
  display: block;
  margin-top: 5px;
  color: #dc3545;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}

input.error,
select.error,
textarea.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Error Messages */
.hora-form-errors,
.form-errors {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  font-family: inherit;
}

.hora-form-errors ul,
.form-errors ul {
  margin: 0;
  padding-left: 20px;
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

.form-loading {
  margin-top: 15px;
  padding: 10px;
  color: #495057;
  font-style: italic;
  text-align: center;
  font-family: inherit;
}

.hora-events-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #2196f3;
  border-radius: 50%;
  animation: hora-spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes hora-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   MODAL STYLES
   ========================================================================== */

.hora-event-register-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  display: none;
  padding: 20px;
  box-sizing: border-box;
}

.hora-event-register-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hora-event-register-modal-dialog {
  position: relative;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.hora-event-register-modal-content {
  position: relative;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hora-event-register-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  z-index: 10;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.hora-event-register-modal-close:hover {
  background-color: #f1f1f1;
  color: #333;
}

/* ==========================================================================
   TERMS SECTION
   ========================================================================== */

.terms-section {
  text-align: center;
  background: #e9ecef;
  padding: 20px;
}

.terms-section .checkbox-label {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: #495057;
  text-align: left;
  font-family: inherit;
}

.terms-section a {
  color: #2196f3;
  text-decoration: none;
}

.terms-section a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
  form[data-event-register-form] .hora-event-form {
    padding: 20px;
  }

  form[data-event-register-form] .form-row {
    flex-direction: column;
    gap: 0;
  }

  form[data-event-register-form] .form-field.half,
  form[data-event-register-form] .form-row-first,
  form[data-event-register-form] .form-row-last {
    flex: 1;
  }

  .ticket-details-section,
  .billing-section,
  .terms-section {
    padding: 20px;
  }

  .ticket-type-section {
    padding: 15px;
  }

  .ticket-instance {
    padding: 15px;
  }

  form[data-event-register-form] .btn-lg,
  form[data-event-register-form] .hora-btn-lg {
    width: 100%;
    min-width: auto;
  }

  .hora-event-register-modal-dialog {
    max-width: 95%;
    margin: 0 auto;
  }

  .hora-checkbox-group.hora-checkbox-inline,
  .hora-radio-group.hora-radio-inline {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hora-event-form-title {
    font-size: 20px;
  }

  .form-section h3,
  .ticket-details-section h3,
  .billing-section h3 {
    font-size: 18px;
  }

  form[data-event-register-form] .btn,
  form[data-event-register-form] .hora-btn {
    width: 100%;
    min-width: auto;
  }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  .hora-event-register-modal {
    position: static;
    background: transparent;
    padding: 0;
  }

  .hora-event-register-modal-dialog,
  .hora-event-register-modal-content {
    max-width: none;
    box-shadow: none;
    border: none;
  }

  .hora-event-register-modal-close {
    display: none;
  }

  form[data-event-register-form] .btn,
  form[data-event-register-form] .hora-btn {
    border: 1px solid #333;
    background: white !important;
    color: black !important;
  }
}
