/* ============================================
   STITCH DESIGN SYSTEM - Auto4travel Forms
   ============================================ */

:root {
    --canvas-white: #FAFAF9;
    --pure-surface: #FFFFFF;
    --charcoal-ink: #18181B;
    --muted-steel: #71717A;
    --whisper-border: #E4E4E7;
    --forest-accent: #129853;
    --forest-dark: #0F7A43;
    --forest-mist: #E8F5EE;
    --signal-red: #DC2626;
    --signal-red-soft: #FEF2F2;
    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
}

@font-face {
    font-family: 'Geist';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.2.0/dist/fonts/geist-sans/Geist-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
    font-style: normal;
}

.a4t-page {
    font-family: var(--font-sans);
    background: var(--canvas-white);
    color: var(--charcoal-ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: var(--space-2xl);
}

.a4t-page * { margin: 0; padding: 0; box-sizing: border-box; }

/* Header */
.a4t-demo-header {
    background: var(--charcoal-ink);
    color: var(--pure-surface);
    padding: var(--space-2xl) var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.a4t-demo-header-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.a4t-demo-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: var(--space-sm);
}

.a4t-demo-header p {
    color: var(--muted-steel);
    font-size: 1rem;
    max-width: 65ch;
}

.a4t-demo-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.a4t-demo-section {
    margin-bottom: var(--space-2xl);
}

.a4t-demo-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-steel);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--whisper-border);
}

/* Form Card */
.a4t-form-card {
    max-width: 640px;
    margin: 0 auto;
    background: var(--pure-surface);
    border: 1px solid var(--whisper-border);
    border-radius: 16px;
    padding: var(--space-2xl);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02), 0 4px 16px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}

.a4t-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--forest-accent);
}

@media (max-width: 768px) {
    .a4t-form-card {
        padding: var(--space-xl);
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-width: 100%;
    }
}

/* Form Header */
.a4t-form-header {
    margin-bottom: var(--space-xl);
}

.a4t-form-header h3 {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--charcoal-ink);
    margin-bottom: var(--space-sm);
}

.a4t-form-header p {
    font-size: 1rem;
    color: var(--muted-steel);
    max-width: 50ch;
    line-height: 1.5;
}

/* Form Fields */
.a4t-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-lg);
}

.a4t-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    animation: fadeSlideUp 0.5s var(--spring-smooth) both;
    min-width: 0;
}

.a4t-form-group:nth-child(1) { animation-delay: 0.05s; }
.a4t-form-group:nth-child(2) { animation-delay: 0.10s; }
.a4t-form-group:nth-child(3) { animation-delay: 0.15s; }
.a4t-form-group:nth-child(4) { animation-delay: 0.20s; }
.a4t-form-group:nth-child(5) { animation-delay: 0.25s; }
.a4t-form-group:nth-child(6) { animation-delay: 0.30s; }
.a4t-form-group:nth-child(7) { animation-delay: 0.35s; }

.a4t-form-group--full {
    grid-column: 1 / -1;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.a4t-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-steel);
    user-select: none;
}

.a4t-label span {
    text-transform: none;
    font-weight: 400;
    color: #A1A1AA;
}

.a4t-input,
.a4t-textarea {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    padding: 14px 16px;
    border: 1.5px solid var(--whisper-border);
    border-radius: 12px;
    background: var(--pure-surface);
    color: var(--charcoal-ink);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    width: 100%;
    min-width: 0;
    min-height: 56px;
}

.a4t-input:hover { border-color: #D4D4D8; }

.a4t-input:focus,
.a4t-textarea:focus {
    outline: none;
    border-color: var(--forest-accent);
    box-shadow: 0 0 0 3px var(--forest-mist);
}

.a4t-input::placeholder,
.a4t-textarea::placeholder {
    color: #A1A1AA;
    font-weight: 400;
}

.a4t-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.a4t-input--mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

@media (max-width: 768px) {
    .a4t-form {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
}

/* Consent Checkbox */
.a4t-consent {
    grid-column: 1 / -1;
    padding: var(--space-md);
    background: var(--forest-mist);
    border: 1px solid rgba(18, 152, 83, 0.12);
    border-radius: 12px;
    animation: fadeSlideUp 0.5s var(--spring-smooth) 0.30s both;
}

.a4t-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.a4t-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.a4t-checkbox__box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--whisper-border);
    border-radius: 6px;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    background: var(--pure-surface);
}

.a4t-checkbox__box svg {
    width: 12px;
    height: 12px;
    stroke: var(--pure-surface);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
}

.a4t-checkbox input:checked + .a4t-checkbox__box {
    background: var(--forest-accent);
    border-color: var(--forest-accent);
}

.a4t-checkbox input:checked + .a4t-checkbox__box svg {
    opacity: 1;
    transform: scale(1);
}

.a4t-checkbox input:focus + .a4t-checkbox__box {
    box-shadow: 0 0 0 3px var(--forest-mist);
    border-color: var(--forest-accent);
}

.a4t-checkbox__text {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #3F3F46;
    font-weight: 500;
    overflow-wrap: break-word;
}

.a4t-checkbox__text a {
    color: var(--forest-accent);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(18, 152, 83, 0.25);
    transition: border-color var(--transition-fast);
}

.a4t-checkbox__text a:hover {
    border-bottom-color: var(--forest-accent);
}

/* Buttons */
.a4t-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
    text-decoration: none;
    line-height: 1;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.a4t-btn--primary {
    background: var(--forest-accent);
    color: var(--pure-surface);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.a4t-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18, 152, 83, 0.2);
    background: #108A49;
}

.a4t-btn--primary:active {
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(18, 152, 83, 0.15);
}

.a4t-btn--outline {
    background: transparent;
    color: var(--forest-accent);
    border: 1.5px solid var(--forest-accent);
    font-weight: 600;
}

.a4t-btn--outline:hover {
    background: var(--forest-mist);
    transform: translateY(-1px);
}

.a4t-btn--full {
    width: 100%;
    padding: 18px;
    font-size: 1rem;
    grid-column: 1 / -1;
    animation: fadeSlideUp 0.5s var(--spring-smooth) 0.40s both;
}

.a4t-btn svg { flex-shrink: 0; }

/* Popup System */
.a4t-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.a4t-popup[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.a4t-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(24, 24, 27, 0.45);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.a4t-popup__content {
    position: relative;
    background: var(--pure-surface);
    border-radius: 16px;
    padding: var(--space-2xl);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.08);
    transform: scale(0.96) translateY(16px);
    transition: transform 0.35s var(--spring-bounce);
    border: 1px solid var(--whisper-border);
    min-width: 0;
}

.a4t-popup[aria-hidden="false"] .a4t-popup__content {
    transform: scale(1) translateY(0);
}

.a4t-popup__content--wide { max-width: 560px; }

.a4t-popup__close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 44px;
    height: 44px;
    border: 1px solid var(--whisper-border);
    background: #F4F4F5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #52525B;
    transition: all var(--transition-base);
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.a4t-popup__close:hover {
    background: #E4E4E7;
    color: #18181B;
    transform: rotate(90deg) scale(1.05);
}

.a4t-popup__close:active {
    transform: rotate(90deg) scale(0.95);
}

.a4t-popup__header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--whisper-border);
}

.a4t-popup__header h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--charcoal-ink);
    margin-bottom: var(--space-xs);
}

.a4t-popup__header p {
    font-size: 0.9375rem;
    color: var(--muted-steel);
    font-weight: 500;
    line-height: 1.4;
}

.a4t-popup__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--forest-mist);
    color: var(--forest-accent);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 700;
    margin-top: var(--space-sm);
    border: 1px solid rgba(18, 152, 83, 0.15);
}

.a4t-popup__tag svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .a4t-popup__content {
        padding: var(--space-xl);
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        margin-top: auto;
        align-self: flex-end;
        transform: translateY(100%);
        transition: transform 0.35s var(--spring-bounce);
    }
    .a4t-popup[aria-hidden="false"] .a4t-popup__content {
        transform: translateY(0);
    }
    .a4t-popup {
        align-items: flex-end;
        padding: 0;
    }
}

/* Validation & States */
.a4t-input.a4t-input--error {
    border-color: var(--signal-red);
    background: var(--signal-red-soft);
}

.a4t-input.a4t-input--error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.a4t-error-msg {
    font-size: 0.75rem;
    color: var(--signal-red);
    font-weight: 600;
    margin-top: var(--space-xs);
    display: none;
}

.a4t-input.a4t-input--error ~ .a4t-error-msg {
    display: block;
    animation: fadeSlideUp 0.2s ease;
}

/* Success State */
.a4t-success {
    text-align: center;
    padding: var(--space-xl) 0;
}

.a4t-success__icon {
    width: 64px;
    height: 64px;
    background: var(--forest-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    color: var(--pure-surface);
    box-shadow: 0 4px 16px rgba(18, 152, 83, 0.25);
    animation: successPop 0.5s var(--spring-bounce);
}

.a4t-success__icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

@keyframes successPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.a4t-success__title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--charcoal-ink);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.01em;
}

.a4t-success__text {
    color: var(--muted-steel);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Scrollbar */
.a4t-popup__content::-webkit-scrollbar { width: 6px; }
.a4t-popup__content::-webkit-scrollbar-track { background: transparent; }
.a4t-popup__content::-webkit-scrollbar-thumb { background: var(--whisper-border); border-radius: 3px; }
.a4t-popup__content::-webkit-scrollbar-thumb:hover { background: #D4D4D8; }

/* Demo Buttons Row */
.a4t-demo-buttons {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Price Calculator */
.a4t-price-calc {
    background: var(--forest-mist);
    border: 1px solid rgba(18, 152, 83, 0.15);
    border-radius: 12px;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.a4t-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9375rem;
}

.a4t-price-label {
    color: var(--muted-steel);
    font-weight: 500;
}

.a4t-price-value {
    color: var(--charcoal-ink);
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.a4t-price-total {
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(18, 152, 83, 0.15);
}

.a4t-price-total .a4t-price-label {
    color: var(--charcoal-ink);
    font-weight: 700;
    font-size: 1rem;
}

.a4t-price-total .a4t-price-value {
    color: var(--forest-accent);
    font-size: 1.125rem;
}

/* Shake animation for consent */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.a4t-consent.a4t-shake {
    animation: shake 0.4s ease;
}

/* Captcha container */
.a4t-captcha {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
