/* ==========================================================================
   FORM VALIDATION STYLES
   Orchestrated By Heaven Wedding Website
   ========================================================================== */

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

.form-group {
    position: relative;
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--color-charcoal);
}

.form-label.required::after {
    content: '*';
    color: var(--color-error);
    margin-left: var(--space-xs);
}

/* ==========================================================================
   INPUT STYLES
   ========================================================================== */

.form-control {
    display: block;
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    line-height: 1.5;
    color: var(--color-charcoal);
    background-color: var(--color-white);
    border: 2px solid var(--color-beige-soft);
    border-radius: var(--radius-md);
    transition: 
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.form-control::placeholder {
    color: var(--color-gray);
    opacity: 0.7;
}

.form-control:hover {
    border-color: var(--color-gold-lighter);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 84, 0.15);
}

/* Valid state */
.form-control.valid {
    border-color: var(--color-success);
    background-color: rgba(40, 167, 69, 0.02);
}

.form-control.valid:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

/* Error state */
.form-control.error {
    border-color: var(--color-error);
    background-color: rgba(220, 53, 69, 0.02);
}

.form-control.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* Disabled state */
.form-control:disabled {
    background-color: var(--color-beige-soft);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ==========================================================================
   SELECT STYLES
   ========================================================================== */

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23D4A854' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    background-size: 1.25rem;
    padding-right: 3rem;
    cursor: pointer;
}

/* ==========================================================================
   TEXTAREA STYLES
   ========================================================================== */

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ==========================================================================
   CHECKBOX & RADIO STYLES
   ========================================================================== */

.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
    appearance: none;
    border: 2px solid var(--color-beige-soft);
    background-color: var(--color-white);
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-check-input[type="checkbox"] {
    border-radius: var(--radius-sm);
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:hover {
    border-color: var(--color-gold);
}

.form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 168, 84, 0.15);
}

.form-check-input:checked {
    background-color: var(--color-gold);
    border-color: var(--color-gold);
}

.form-check-input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
}

.form-check-input[type="radio"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Ccircle cx='12' cy='12' r='5'%3E%3C/circle%3E%3C/svg%3E");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.form-check-label {
    font-size: var(--font-size-base);
    color: var(--color-charcoal);
    cursor: pointer;
    user-select: none;
}

/* ==========================================================================
   FIELD ERROR MESSAGE
   ========================================================================== */

.field-error {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-error);
    min-height: 1.25em;
    transition: all 0.2s ease;
}

.field-error:empty {
    min-height: 0;
    margin-top: 0;
}

/* ==========================================================================
   FORM HELPER TEXT
   ========================================================================== */

.form-hint {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-gray);
}

/* ==========================================================================
   INPUT WITH ICON
   ========================================================================== */

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .form-control {
    padding-left: 3rem;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-gray);
    pointer-events: none;
}

.input-icon-wrapper .form-control:focus + .input-icon,
.input-icon-wrapper .form-control:focus ~ .input-icon {
    color: var(--color-gold);
}

/* ==========================================================================
   FIELD VALIDATION ICONS
   ========================================================================== */

.validation-icon-wrapper {
    position: relative;
}

.validation-icon-wrapper .form-control {
    padding-right: 3rem;
}

.validation-icon-wrapper::after {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.validation-icon-wrapper.has-valid::after {
    content: '✓';
    color: var(--color-success);
    opacity: 1;
}

.validation-icon-wrapper.has-error::after {
    content: '✕';
    color: var(--color-error);
    opacity: 1;
}

/* ==========================================================================
   RSVP FORM SPECIFIC STYLES
   ========================================================================== */

.rsvp-form {
    max-width: 600px;
    margin: 0 auto;
}

.rsvp-form-section {
    padding: var(--space-xl);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-xl);
}

.rsvp-form-section-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    color: var(--color-navy);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-gold-lighter);
}

/* Guest counter */
.guest-counter {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.guest-counter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--color-gold);
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-gold);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guest-counter-btn:hover {
    background: var(--color-gold);
    color: var(--color-white);
}

.guest-counter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.guest-counter-value {
    min-width: 3rem;
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-navy);
}

/* ==========================================================================
   BUTTON LOADING STATE
   ========================================================================== */

.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    top: 50%;
    left: 50%;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: btn-spinner 0.75s linear infinite;
}

.btn-primary.loading::after,
.btn-gold.loading::after {
    border-color: var(--color-white);
    border-right-color: transparent;
}

@keyframes btn-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   FLOATING LABELS
   ========================================================================== */

.form-floating {
    position: relative;
}

.form-floating .form-control {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating .form-control::placeholder {
    color: transparent;
}

.form-floating .form-label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: var(--space-md) var(--space-lg);
    pointer-events: none;
    transform-origin: left top;
    transition: all 0.2s ease;
    color: var(--color-gray);
}

.form-floating .form-control:focus ~ .form-label,
.form-floating .form-control:not(:placeholder-shown) ~ .form-label {
    transform: scale(0.85) translateY(-0.5rem);
    color: var(--color-gold);
}

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

@media (max-width: 768px) {
    .rsvp-form-section {
        padding: var(--space-lg);
    }
    
    .form-row {
        flex-direction: column;
    }
}
