/* ==========================================================================
   TAW Form — standalone stylesheet
   Stack-agnostic: no Tailwind, no framework dependency.
   All selectors are scoped under .taw-form or .taw-* namespaced classes.
   ========================================================================== */

/* ── Utility ────────────────────────────────────────────────────────────── */

.taw-hidden {
    display: none !important;
}

/* ── Form shell ─────────────────────────────────────────────────────────── */

.taw-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Grid ───────────────────────────────────────────────────────────────── */

.taw-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 639px) {
    .taw-form-grid .taw-form-field {
        grid-column: 1 / -1 !important;
    }
}

/* ── Field wrapper ──────────────────────────────────────────────────────── */

.taw-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* ── Labels ─────────────────────────────────────────────────────────────── */

.taw-field-label {
    font-weight: 600;
    color: #44403c;
    font-size: 0.9375rem;
}

.taw-required {
    color: #ef4444;
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */

.taw-input {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid #a8a29e;
    border-radius: 0.375rem;
    background: #fff;
    color: #1c1917;
    font-size: 0.9375rem;
    line-height: 1.5;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    appearance: auto;
}

.taw-input:focus {
    outline: none;
    border-color: #78716c;
    box-shadow: 0 0 0 2px rgba(120, 113, 108, 0.25);
}

.taw-input::placeholder {
    color: #a8a29e;
}

/* ── Radio & checkbox groups ────────────────────────────────────────────── */

.taw-option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1rem;
}

.taw-option-group--vertical {
    flex-direction: column;
    gap: 0.5rem;
}

.taw-option-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.9375rem;
    color: #1c1917;
}

.taw-check {
    cursor: pointer;
    border-radius: 0.25rem;
    border: 1px solid #a8a29e;
    accent-color: #1c1917;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* ── Field error ────────────────────────────────────────────────────────── */

.taw-field-error {
    font-size: 0.8125rem;
    color: #dc2626;
    line-height: 1.4;
}

/* ── Feedback banners ───────────────────────────────────────────────────── */

.taw-general-error {
    padding: 0.75rem 1rem;
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
}

.taw-success {
    padding: 0.75rem 1rem;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
}

/* ── Structural field types ─────────────────────────────────────────────── */

.taw-field-heading {
    padding: 0.625rem 0.875rem;
    background: #1c1917;
    color: #fff;
    border-radius: 0.375rem;
}

.taw-heading-label {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0;
}

.taw-heading-subtitle {
    font-size: 0.8rem;
    opacity: 0.65;
    font-style: italic;
    margin: 0.2rem 0 0;
}

.taw-divider {
    border: none;
    border-top: 1px solid #e7e5e4;
    margin: 0;
}

/* ── Form actions ───────────────────────────────────────────────────────── */

.taw-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.taw-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.5;
}

.taw-btn-primary {
    background: #1c1917;
    color: #d6d3d1;
    border-color: #1c1917;
}

.taw-btn-primary:hover:not(:disabled) {
    background: #44403c;
    border-color: #44403c;
}

.taw-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.taw-btn-secondary {
    background: transparent;
    color: #44403c;
    border-color: #a8a29e;
}

.taw-btn-secondary:hover {
    background: #f5f5f4;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */

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

.taw-btn-spinner {
    width: 1rem;
    height: 1rem;
    animation: taw-spin 1s linear infinite;
    flex-shrink: 0;
}

.taw-spinner-track { opacity: 0.25; }
.taw-spinner-fill  { opacity: 0.75; }

/* ── Step progress bar (mobile < 640px) ─────────────────────────────────── */

.taw-step-progress {
    display: none;
    margin-bottom: 1.5rem;
}

.taw-step-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.taw-step-progress-count {
    font-size: 0.75rem;
    color: #78716c;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.taw-step-progress-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1c1917;
    text-align: right;
}

.taw-step-progress-track {
    height: 4px;
    background: #e7e5e4;
    border-radius: 2px;
    overflow: hidden;
}

.taw-step-progress-fill {
    height: 100%;
    background: #1c1917;
    border-radius: 2px;
    width: 0%;
    transition: width .3s ease;
}

@media (max-width: 639px) {
    .taw-step-indicator { display: none !important; }
    .taw-step-progress  { display: block; }
}

/* ── Step indicator (desktop ≥ 640px) ───────────────────────────────────── */

.taw-step-indicator {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.taw-step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.taw-step-dot-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e7e5e4;
    color: #78716c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background .2s, color .2s;
}

.taw-step-dot.is-active .taw-step-dot-number {
    background: #1c1917;
    color: #fff;
}

.taw-step-dot.is-done .taw-step-dot-number {
    background: #57534e;
    color: #fff;
}

.taw-step-dot-label {
    font-size: 0.7rem;
    color: #78716c;
    text-align: center;
    max-width: 80px;
    line-height: 1.3;
}

.taw-step-dot.is-active .taw-step-dot-label {
    color: #1c1917;
    font-weight: 600;
}

.taw-step-connector {
    flex: 1;
    height: 2px;
    background: #e7e5e4;
    margin-top: 1rem;
    min-width: 1rem;
    transition: background .2s;
}

.taw-step-connector.is-done {
    background: #57534e;
}
