/* =====================================================
   EasyTrack — Public form site
   Style aligned with ch.tracker.app.manager (Inter font, blue gradient)
   ===================================================== */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #93C5FD;
    --success: #22c55e;
    --danger: #ef4444;

    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 8px 20px -8px rgba(15, 23, 42, 0.15);
    --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, 0.25);
}

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

html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 60%, #f1f5f9 100%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.brand-logotype {
    height: 36px;
    width: auto;
    display: block;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Language switcher */
.lang-switcher { position: relative; }
.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-lg);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.lang-btn .lang-current-flag { font-size: 1rem; line-height: 1; }
.lang-btn svg { opacity: 0.6; }

.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 170px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 6px;
    display: none;
    z-index: 100;
}
.lang-menu.open { display: block; animation: lang-fade 0.15s ease; }
@keyframes lang-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.lang-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: none;
    border: none;
    border-radius: 8px;
    text-align: left;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.lang-item .lang-flag { font-size: 1.05rem; line-height: 1; }
.lang-item:hover { background: #f3f4f6; color: var(--text); }
.lang-item.active { background: rgba(59, 130, 246, 0.1); color: var(--primary); font-weight: 600; }

@media (max-width: 480px) {
    .topbar-link { display: none; }
}

/* ---------- Hero / Layout ---------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3.5rem;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 980px) {
    .container { grid-template-columns: 380px 1fr; align-items: start; }
}

.hero {
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-2xl);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    width: 240px; height: 240px;
    bottom: -60px; right: -60px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}
.hero h1 {
    font-size: 1.65rem;
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.hero p {
    font-size: 0.95rem;
    opacity: 0.92;
    margin-bottom: 1.25rem;
}

.hero-perks {
    list-style: none;
    display: flex; flex-direction: column;
    gap: 0.625rem;
    position: relative; z-index: 1;
}
.hero-perks li {
    display: flex; align-items: center; gap: 0.625rem;
    font-size: 0.875rem;
    opacity: 0.95;
}
.hero-perks li svg {
    width: 18px; height: 18px; flex-shrink: 0;
    background: rgba(255,255,255,0.18);
    border-radius: 6px;
    padding: 3px;
}

/* ---------- Form card ---------- */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}
.form-card-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
}
.form-card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}
.form-card-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.form-card-body { padding: 1.5rem 1.75rem; }

.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 1.5rem 0 0.75rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.section-title:first-child { margin-top: 0; }
.section-title .num {
    width: 22px; height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
}

/* Inputs */
.field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
    margin-bottom: 0.875rem;
}
@media (min-width: 640px) {
    .field-row.cols-2 { grid-template-columns: 1fr 1fr; }
    .field-row.cols-3 { grid-template-columns: 2fr 2fr 1fr 1fr; }
}

.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.field input,
.field textarea {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font: inherit;
    font-size: 0.9rem;
    background: white;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-muted); }
.field input:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.field .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.field input.is-invalid,
.field textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

/* Vehicles */
.vehicles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.vehicle-item {
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    position: relative;
}
.vehicle-item .vehicle-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.5rem;
}
.vehicle-item .vehicle-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.vehicle-item .vehicle-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    display: inline-flex; align-items: center; gap: 0.25rem;
}
.vehicle-item .vehicle-remove:hover { color: var(--danger); background: #fee2e2; }
.vehicle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}
@media (min-width: 640px) {
    .vehicle-grid { grid-template-columns: 2fr 2fr 1fr 1.4fr; }
}

.vehicle-add {
    display: inline-flex; align-items: center; gap: 0.5rem;
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-lg);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    justify-content: center;
}
.vehicle-add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59,130,246,0.05);
}

/* Buttons */
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.btn {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.5rem;
    transition: all 0.15s;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(59,130,246,0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--primary); }

.legal {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Alerts */
.alert {
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #166534; }

/* Success state */
.success-state {
    text-align: center;
    padding: 3rem 1.5rem 4rem;
}
.success-state .icon {
    width: 84px; height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 32px rgba(34,197,94,0.3);
}
.success-state .icon svg { width: 42px; height: 42px; }
.success-state h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.success-state p { color: var(--text-secondary); max-width: 480px; margin: 0 auto 1.5rem; }

/* Footer */
.footer {
    margin-top: auto;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.footer span { color: var(--primary); font-weight: 600; }

/* spinner */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
