/* ============================================================
   Isuzu Dealer Lead Capture System - Redesigned Styles
   Mobile-First with background.png and clean white card forms
   ============================================================ */

/* Font Face - Futura */
@font-face {
    font-family: 'Futura';
    src: url('Futura Md BT Medium.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Futura';
    src: url('Futura Md BT Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables */
:root {
    --primary-red: #EB1D24;
    --primary-dark: #1a1a2e;
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --dark-gray: #333333;
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #999999;
    --success-green: #28a745;
    --warning-orange: #ff9800;
    --error-red: #dc3545;
    --border-light: #ddd;
    --border-red: #e8a0a0;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-light: 0 4px 16px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;
    --font-family: 'Futura', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-dark);
    min-height: 100vh;
    background: url('../images/background.png') no-repeat center center fixed;
    background-size: cover;
    overflow-x: hidden;
}

body.page-dashboard {
    background: url('../images/background.png') no-repeat center center fixed;
    background-size: cover;
}

a {
    color: var(--primary-red);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================================
   Logo Header (Centered Logo Only)
   ============================================================ */
.logo-header {
    text-align: center;
    padding: 30px 16px 10px;
}

.logo-header__img {
    width: 120px;
    height: auto;
}

.logo-header__tagline {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary-red);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* ============================================================
   Page Container
   ============================================================ */
.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
    padding: 20px 16px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* ============================================================
   Form Card (White Card)
   ============================================================ */
.form-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    margin-top: 10px;
}

/* ============================================================
   Section Title with Red Lines
   ============================================================ */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.section-title::before,
.section-title::after {
    content: '';
    width: 40px;
    height: 2px;
    background: var(--primary-red);
    flex-shrink: 0;
}

/* ============================================================
   Form Styles
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 8px;
    text-transform: none;
    letter-spacing: 0.3px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-red);
    border-radius: 25px;
    background: var(--white);
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(235, 29, 36, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-input--readonly {
    background: var(--light-gray);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-red);
    border-radius: 25px;
    background: var(--white);
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23EB1D24' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-select:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(235, 29, 36, 0.1);
}

.form-error {
    display: none;
    font-size: 0.75rem;
    color: var(--error-red);
    margin-top: 4px;
    padding-left: 16px;
}

.form-error.visible {
    display: block;
}

.form-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    width: auto;
    text-align: center;
}

.btn--primary {
    background: var(--primary-red);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(235, 29, 36, 0.4);
}

.btn--primary:hover {
    background: #c9171d;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(235, 29, 36, 0.5);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--secondary {
    background: transparent;
    color: var(--primary-red);
    border: 2px solid var(--primary-red);
}

.btn--secondary:hover {
    background: var(--primary-red);
    color: var(--white);
}

.btn--outline {
    background: transparent;
    color: var(--primary-red);
    border: 2px solid var(--primary-red);
}

.btn--outline:hover {
    background: var(--primary-red);
    color: var(--white);
}

.btn--small {
    padding: 10px 20px;
    font-size: 0.85rem;
}

.btn--disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Red Gradient Button (main CTA) */
.btn--gradient {
    font-family: 'Futura', sans-serif;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 14px 40px;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
    background: linear-gradient(to bottom, #d42a2a 0%, #8b1a1a 100%);
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(180, 30, 30, 0.4);
    min-width: 180px;
}

.btn--gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(180, 30, 30, 0.5);
}

.btn--gradient:active {
    transform: translateY(0);
}

/* ============================================================
   Toggle Buttons (Vehicle Make, Yes/No)
   ============================================================ */
.toggle-group {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border-red);
    border-radius: 25px;
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--dark-gray);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.toggle-btn + .toggle-btn {
    border-left: 1.5px solid var(--border-red);
}

.toggle-btn.active {
    background: #EB1D24;
    color: #ffffff;
    border-color: #EB1D24;
    position: relative;
    z-index: 1;
}

.toggle-btn:hover:not(.active) {
    background: rgba(235, 29, 36, 0.05);
}

/* ============================================================
   Radio Toggle Group (Timeline)
   ============================================================ */
.radio-toggle-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
}

.radio-toggle {
    flex: 1;
    padding: 14px 10px;
    border: 1.5px solid var(--border-red);
    border-radius: 12px;
    background: var(--white);
    color: var(--dark-gray);
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.radio-toggle__top {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.radio-toggle__number {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.radio-toggle__bottom {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: lowercase;
}

.radio-toggle.active {
    background: #EB1D24;
    border-color: #EB1D24;
    color: #ffffff;
}

.radio-toggle:hover:not(.active) {
    border-color: var(--primary-red);
}

/* ============================================================
   Inline Radio Options (Yes/No)
   ============================================================ */
.inline-radio-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.inline-radio-row .form-label {
    margin-bottom: 0;
    flex-shrink: 0;
}

.inline-radio-group {
    display: flex;
    align-items: center;
    gap: 24px;
}

.inline-radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dark-gray);
    text-transform: uppercase;
}

.inline-radio-group input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--medium-gray);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.inline-radio-group input[type="radio"]:checked {
    border-color: var(--primary-red);
    background: var(--primary-red);
}

.inline-radio-group input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* ============================================================
   Form Actions (Submit area)
   ============================================================ */
.form-actions {
    text-align: center;
    margin-top: 28px;
}

.form-actions .btn--gradient {
    min-width: 200px;
}

/* Nav row with back + submit + resend */
.nav-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
}

.nav-row .back-link {
    color: var(--primary-red);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-row .resend-link {
    color: var(--primary-red);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

/* ============================================================
   OTP Input
   ============================================================ */
.otp-input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    border: 1.5px solid var(--border-red);
    border-radius: var(--border-radius-sm);
    background: var(--white);
    color: var(--text-dark);
    outline: none;
    transition: var(--transition);
}

.otp-input:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(235, 29, 36, 0.15);
}

/* ============================================================
   Dashboard (Post-Login)
   ============================================================ */
.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: 20px 16px;
    text-align: center;
    position: relative;
}

.dashboard .btn--gradient {
    width: auto;
}

.dashboard__welcome {
    font-size: 1rem;
    color: var(--dark-gray);
    margin-bottom: 8px;
}

.dashboard__dealer-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.dashboard__cta-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-gray);
    text-transform: uppercase;
    margin-bottom: 24px;
}

.dashboard__logout {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.dashboard__logout:hover {
    color: var(--primary-red);
}

.dashboard__headline {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    min-width: 300px;
}

.dashboard__cost {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
}

/* ============================================================
   Success Screen
   ============================================================ */
.success-screen {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: scaleIn 0.5s ease;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    fill: var(--white);
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 8px;
}

.success-message {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.lead-summary {
    background: var(--light-gray);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.lead-summary__item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--medium-gray);
    font-size: 0.85rem;
    color: var(--dark-gray);
}

.lead-summary__item:last-child {
    border-bottom: none;
}

.lead-summary__label {
    font-weight: 700;
    color: var(--text-dark);
}

/* ============================================================
   Loading Overlay
   ============================================================ */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--medium-gray);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--dark-gray);
    margin-top: 16px;
    font-size: 0.9rem;
    font-weight: 400;
}

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

/* ============================================================
   Toast / Notification
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: 90%;
    max-width: 360px;
}

.toast {
    display: none;
    padding: 14px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 400;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

.toast.show {
    display: block;
}

.toast--success {
    background: var(--success-green);
    color: var(--white);
}

.toast--error {
    background: var(--error-red);
    color: var(--white);
}

.toast--warning {
    background: var(--warning-orange);
    color: var(--white);
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================
   Network Error Screen
   ============================================================ */
.network-error {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    text-align: center;
}

.network-error.active {
    display: flex;
}

.network-error__icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--warning-orange);
}

.network-error__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 8px;
}

.network-error__message {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.network-error__actions {
    display: flex;
    gap: 12px;
}

/* ============================================================
   Offline Banner
   ============================================================ */
.offline-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 16px;
    background: var(--warning-orange);
    color: var(--white);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10001;
    animation: slideDown 0.3s ease;
}

.offline-banner.active {
    display: block;
}

/* ============================================================
   Navigation Buttons (Back/Next - Legacy support)
   ============================================================ */
.nav-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.nav-buttons .btn {
    flex: 1;
}

.nav-buttons--edge {
    margin-top: 20px;
    justify-content: center;
    gap: 16px;
}

.nav-buttons--edge .nav-btn {
    width: auto !important;
    padding: 12px 28px;
    font-size: 1rem;
}

/* ============================================================
   Responsive - Small Mobile (up to 375px)
   ============================================================ */
@media (max-width: 375px) {
    .content-wrapper {
        padding: 16px 12px 30px;
    }

    .form-card {
        padding: 24px 16px;
    }

    .form-input,
    .form-select {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .otp-input {
        width: 40px;
        height: 48px;
        font-size: 1.2rem;
    }

    .logo-header__img {
        width: 100px;
    }
}

/* ============================================================
   Responsive - Standard Mobile (up to 480px)
   ============================================================ */
@media (max-width: 480px) {
    .form-row {
        flex-direction: row;
        gap: 10px;
    }
}

/* ============================================================
   Responsive - Tablet & Desktop (min-width: 768px)
   ============================================================ */
@media (min-width: 768px) {
    .form-card {
        padding: 36px 32px;
        max-width: 480px;
    }

    .logo-header {
        padding: 40px 16px 16px;
    }

    .logo-header__img {
        width: 140px;
    }

    .form-input,
    .form-select {
        padding: 14px 18px;
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.3rem;
        margin-bottom: 28px;
    }

    .btn--gradient {
        font-size: 1.2rem;
        padding: 16px 48px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .otp-input {
        width: 54px;
        height: 62px;
        font-size: 1.5rem;
    }

    .toggle-btn,
    .radio-toggle {
        padding: 14px 20px;
        font-size: 0.9rem;
    }

    .dashboard__headline {
        max-width: 70%;
        min-width: 400px;
    }

    .dashboard__cost {
        width: 400px;
    }
}

/* ============================================================
   Responsive - Desktop (min-width: 1024px)
   ============================================================ */
@media (min-width: 1024px) {
    .form-card {
        max-width: 500px;
    }
}

/* ============================================================
   Touch & Scroll Optimizations (Mobile/Tablet)
   ============================================================ */
@media (max-width: 1023px) {
    body {
        -webkit-overflow-scrolling: touch;
    }

    .page-container {
        min-height: 100dvh;
    }

    /* Prevent input zoom on iOS */
    .form-input,
    .form-select {
        font-size: max(16px, 0.9rem);
    }

    /* Ensure tap targets are at least 44px */
    .btn,
    .toggle-btn,
    .radio-toggle {
        min-height: 44px;
    }
}

/* Safe area insets for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .logo-header {
        padding-top: calc(30px + env(safe-area-inset-top));
    }

    .content-wrapper {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}

/* ============================================================
   Utility Classes
   ============================================================ */
.text-center { text-align: center; }
.text-white { color: var(--white); }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--primary-red); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
