/* ============================================
   COMPASS — Global Form Styles
   ============================================ */

/* --- Base Input --- */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    color: #022c22;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #94a3b8;
    font-weight: 300;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background-color: #ffffff;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* --- Select chevron --- */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%2310b981'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* --- Textarea --- */
.form-textarea {
    resize: none;
    min-height: 120px;
}

/* --- Label --- */
.form-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #022c22;
    margin-bottom: 0.375rem;
    margin-left: 0.125rem;
}

.form-label .required {
    color: #10b981;
}

/* --- Radio / Checkbox cards --- */
.form-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    color: #022c22;
    user-select: none;
}

.form-card:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.form-card:has(input:checked) {
    background-color: #ecfdf5;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.form-card input[type="radio"],
.form-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* --- File upload zone --- */
.form-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    min-height: 120px;
}

.form-upload:hover {
    background-color: #ecfdf5;
    border-color: #10b981;
}

.form-upload .upload-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: #ecfdf5;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    margin-bottom: 0.25rem;
}

.form-upload .upload-text {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 400;
}

.form-upload .upload-text strong {
    color: #10b981;
    font-weight: 600;
}

.form-upload .upload-hint {
    font-size: 0.75rem;
    color: #94a3b8;
}

.form-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* --- Submit button --- */
.form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1rem 2.5rem;
    background: #022c22; /* brand-dark */
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: 1.25rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px -5px rgba(2, 44, 34, 0.2);
    font-family: inherit;
}

.form-submit:hover {
    background: #10b981; /* brand-primary */
    box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.form-submit:active {
    transform: translateY(0);
}

/* --- HTMX loading state --- */
.form-submit.htmx-request {
    pointer-events: none;
    opacity: 0.7;
}

.form-submit .spinner {
    display: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.htmx-request .spinner {
    display: inline-block;
}

.htmx-request .btn-text {
    display: none;
}

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

/* --- Success banner --- */
.form-success {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: #ecfdf5;
    border: 1.5px solid #a7f3d0;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.form-success .success-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.form-success p {
    margin: 0;
    color: #065f46;
    font-weight: 500;
    line-height: 1.5;
}

.form-success p strong {
    font-weight: 700;
}

/* --- Intersection Observer reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.reveal-stagger > .reveal {
    transition-delay: calc(var(--i, 0) * 120ms);
}
