/*
 * [gic_registration]. Theme-friendly: inherits the theme's font and text color; the accent can be
 * set with --gic-primary-color (and --gic-hover-color) on any ancestor.
 */

/* Form Container */
.gic-registration-wrapper {
    --gic-reg-accent: var(--gic-hover-color, var(--gic-primary-color, #0b5f8a));
    --gic-reg-surface: var(--gic-surface, #fff);
    --gic-reg-text: var(--gic-text, #1f2933);
    --gic-reg-muted: var(--gic-muted, #52606d);
    --gic-reg-border: var(--gic-border, #8a96a3);
    --gic-reg-danger: var(--gic-danger, #b42318);
    --gic-reg-success: var(--gic-success, #166534);
    --gic-reg-radius: var(--gic-radius, 12px);

    max-width: 600px;
    margin: 0 auto;
    padding: 1.75rem;
    background: var(--gic-reg-surface);
    color: var(--gic-reg-text);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: var(--gic-reg-radius);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    font-family: inherit;
    line-height: 1.5;
}

.gic-registration-wrapper *,
.gic-registration-wrapper *::before,
.gic-registration-wrapper *::after {
    box-sizing: border-box;
}

.gic-registration-wrapper .gic-sr-only {
    position: absolute !important; /* themes sometimes position paragraphs */
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gic-registration-wrapper .gic-required-note {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    color: var(--gic-reg-muted);
}

.gic-registration-wrapper .gic-required-mark {
    color: var(--gic-reg-danger);
    font-weight: 700;
}

.gic-registration-wrapper .gic-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 0 1rem;
}

/* Form Groups */
.gic-registration-wrapper .gic-form-group {
    margin-bottom: 1.125rem;
    position: relative;
}

/* Labels */
.gic-registration-wrapper .gic-form-group label,
.gic-registration-wrapper .gic-form-group .gic-payment-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: inherit;
    font-size: 0.95rem;
}

/* Input Fields */
.gic-registration-wrapper .gic-form-group input,
.gic-registration-wrapper .gic-form-group select,
.gic-registration-wrapper .gic-form-group textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0 !important; /* some themes add a bottom margin to every input */
    border: 1px solid var(--gic-reg-border);
    border-radius: 8px;
    background: #fff;
    color: #1f2933;
    font-family: inherit;
    font-size: 1rem;
    font-size: max(16px, 1rem);
    line-height: 1.5;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.gic-registration-wrapper .gic-form-group input:focus {
    outline: none;
    border-color: var(--gic-reg-accent);
    box-shadow: 0 0 0 1px var(--gic-reg-accent);
}

.gic-registration-wrapper .gic-form-group input:focus-visible {
    outline: 3px solid var(--gic-reg-accent);
    outline-offset: 2px;
}

/* Error Messages */
.gic-error-message {
    color: var(--gic-reg-danger, #b42318);
    font-size: 0.875rem;
    margin-top: 0.35rem;
    display: block;
    font-weight: 600;
    background: #fef2f2;
    border-left: 3px solid var(--gic-reg-danger, #b42318);
    padding: 0.375rem 0.6rem;
    border-radius: 0 6px 6px 0;
}

.gic-error-message:empty {
    display: none;
}

.gic-error-message:not(:empty)::before {
    content: "! ";
    font-weight: 700;
}

.gic-registration-wrapper .gic-form-error:not(:empty) {
    margin: 0 0 1rem;
}

/* Invalid Input State: color plus the error text and aria-invalid */
.gic-invalid {
    border-color: var(--gic-reg-danger, #b42318) !important; /* beats theme input borders */
    border-width: 2px !important;
    background-color: #fffafa !important;
}

.gic-form-group.has-error input {
    border-color: var(--gic-reg-danger, #b42318);
}

/* Password Requirements */
.gic-password-requirements {
    color: var(--gic-reg-muted, #52606d);
    font-size: 0.875rem;
    margin-top: 0.4rem;
    display: block;
}

.gic-registration-wrapper .gic-password-requirements-intro {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.gic-registration-wrapper .gic-password-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gic-registration-wrapper .gic-password-checklist li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.gic-registration-wrapper .gic-password-checklist li::before {
    content: "";
    width: 0.9em;
    height: 0.9em;
    border: 2px solid currentColor;
    border-radius: 50%;
    flex-shrink: 0;
}

.gic-registration-wrapper .gic-password-checklist li.is-met {
    color: var(--gic-reg-success);
    font-weight: 600;
}

.gic-registration-wrapper .gic-password-checklist li.is-met::before {
    content: "\2713";
    border: 0;
    width: auto;
    height: auto;
    font-weight: 700;
}

/* Stripe Elements */
.gic-stripe-element {
    padding: 0.75rem;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #fff;
    margin-top: 0.5rem;
}

/* Submit Button */
.gic-registration-wrapper .gic-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    background: var(--gic-reg-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, filter 0.15s ease-in-out;
}

.gic-registration-wrapper .gic-button:hover:not(:disabled) {
    filter: brightness(0.9);
}

.gic-registration-wrapper .gic-button:disabled {
    cursor: progress;
    opacity: 0.75;
}

.gic-registration-wrapper .gic-button:focus-visible {
    outline: 3px solid var(--gic-reg-accent);
    outline-offset: 3px;
}

/* Required Field Indicator (decorative; required is also set on the inputs) */
.gic-form-group label:after,
.gic-form-group .gic-payment-label:after {
    content: ' *';
    color: var(--gic-reg-danger, #b42318);
}

.gic-registration-wrapper .gic-hp-field label:after {
    content: none;
}

/* Loading State */
.gic-button.loading {
    position: relative;
    color: transparent;
}

.gic-button.loading:after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s linear infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

.gic-registration-notice {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .gic-registration-wrapper {
        padding: 1.125rem;
        margin: 0.5rem 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gic-registration-wrapper *,
    .gic-registration-wrapper *::before,
    .gic-registration-wrapper *::after {
        transition: none !important;
    }

    .gic-button.loading:after {
        animation-duration: 2.4s;
    }
}

/* iOS Safari zooms the page when a field's text is under 16px. Every text-type field in Golf In
   Club's front end keeps the size it inherits but never goes below 16px, whatever the theme sets.
   (The waiver windows, .gic-wv, set their own sizes, all 16px or more.) */
:is(.gic-booking-wrapper, .gic-registration-wrapper, .gic-tee-calendar-wrapper, .gic-tee-schedule) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="image"]), select, textarea) {
    font-size: max(16px, 1em) !important;
}
