/**
 * Course Registration Shortcode Styles
 *
 * @package COEM_Base
 */

/* Outer wrapper: 2-column grid on desktop, stacked on mobile.
   Background image is expected to come from the Elementor section that
   wraps the shortcode, so the wrapper itself is intentionally transparent. */
.coem-course-registration {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 768px) {
  .coem-course-registration {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Info column (left) */
.coem-course-registration__title {
  margin-top: 0;
  margin-bottom: 16px;
}

.coem-course-registration__description {
  margin-bottom: 16px;
}

.coem-course-registration__login-prompt {
  margin-top: 16px;
}

.coem-course-registration__friend-prompt {
  margin-top: 24px;
}

.coem-course-registration__permission-denied {
  margin-top: 16px;
  color: #c62828;
}

.coem-course-registration__link {
  text-decoration: underline;
}

/* Price line shown above the paid form */
.coem-course-registration__price {
  font-size: 18px;
  margin: 0 0 16px 0;
}

/* Form Sections */
.form-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h4 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

/* Form Rows and Groups */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Address-block layouts only at desktop; below 992px the rows fall back to
   the default 50/50 (and to single column at the 768px breakpoint below). */
@media (min-width: 992px) {
  .form-row--33-66 {
    grid-template-columns: 1fr 2fr;
  }

  .form-row--3-cols {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group-small {
  grid-column: span 1;
  max-width: 150px;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
  width: 100%;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1);
}

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

.required {
  color: #d63638;
  margin-left: 2px;
}

/* Dynamic Fields */
/* Each course-defined field renders on its own full-width row, with the
   input/select/textarea inside also taking the full container width.
   Per-field CSS classes from coem_cms_coursefield.Css are preserved on the
   wrapper but don't drive layout (any column hints like "col-md-6" are
   neutralized by the explicit width rules below). */
.fields-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fields-wrapper .dynamic-field {
  /* !important required because legacy per-field CSS classes from
     coem_cms_coursefield.Css (e.g. "col-md-6", "col-sm-4") would otherwise
     win on specificity and force a half-width column.
     Keep display:flex so the label stays on top and the input below
     (mirrors .form-group). */
  width: 100% !important;
  max-width: none !important;
  flex: 1 1 100% !important;
  margin-bottom: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fields-wrapper .dynamic-field input[type="text"],
.fields-wrapper .dynamic-field input[type="email"],
.fields-wrapper .dynamic-field input[type="tel"],
.fields-wrapper .dynamic-field select,
.fields-wrapper .dynamic-field textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Date inputs render their value (dd/mm/yyyy) and a tiny picker icon, so
   stretching them to 100% leaves a lot of empty space. Keep them sized to
   their content with a sensible cap. */
.fields-wrapper .dynamic-field input[type="date"] {
  width: auto;
  max-width: 220px;
  box-sizing: border-box;
}

/* Checkbox: input and label inline (instead of label-on-top).
   Color is intentionally NOT set here so the surrounding theme rules for
   `label` (e.g. white text on a colored form column) take effect normally. */
.fields-wrapper .dynamic-field--checkbox .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}

.fields-wrapper .dynamic-field--checkbox .checkbox-label input[type="checkbox"] {
  margin: 0;
  width: auto;
}

.dynamic-field {
  margin-bottom: 20px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: normal;
}

.radio-label input[type="radio"] {
  margin: 0;
}

/* Disclaimers */
.form-disclaimers {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.form-group-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}

.form-group-checkbox:last-child {
  margin-bottom: 0;
}

.form-group-checkbox input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.form-group-checkbox label {
  margin: 0;
  font-weight: normal;
  line-height: 1.5;
}

.form-group-checkbox a {
  color: #0073aa;
  text-decoration: underline;
}

.form-group-checkbox a:hover {
  text-decoration: none;
}

/* Actions */
.form-actions {
  text-align: center;
  margin-top: 30px;
}

.form-actions .button {
  min-width: 200px;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.form-actions .button-primary {
  background: #0073aa;
  color: white;
  border: none;
}

.form-actions .button-primary:hover {
  background: #005a87;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.form-actions .button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Result Messages */
.form-result {
  margin-top: 20px;
  padding: 15px;
  border-radius: 6px;
  text-align: center;
}

.form-result.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-result.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Registration Closed — neutral default; the theme is expected to restyle
   it when sitting on a colored/image background. */
.coem-course-registration-closed {
  width: 100%;
  padding: 24px 20px;
  text-align: center;
}

.coem-course-registration-closed .error {
  color: #d63638;
  font-size: 16px;
  margin: 0;
}

/* Loading State */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0073aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .coem-course-registration {
    padding: 20px;
    margin: 20px 10px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .form-group-small {
    max-width: none;
  }

  .form-actions .button {
    width: 100%;
    min-width: auto;
  }
}

