/**
 * Cardealer Powersuite – Public Lead Form Styles
 */

:root {
    --cdps-primary: var(--eb-primary, #2f6594);
    --cdps-secondary: var(--eb-dark, #1f2937);
    --cdps-success: #198754;
    --cdps-error: #dc3545;
    --cdps-border: #d7e0ea;
    --cdps-bg-light: #f7fafc;
    --cdps-radius: 12px;
}

/* ── Form Wrap ───────────────────────────────────────────────── */
.cdps-lead-form-wrap {
    max-width: 700px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e3e9f0;
    border-radius: 16px;
    padding: 1.65rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.cdps-lead-form-title {
    font-size: 1.95rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #0f172a;
}

.cdps-lead-form-desc {
    color: #546275;
    margin-bottom: 1.3rem;
}

/* ── Form Sections ───────────────────────────────────────────── */
.cdps-form-section {
    margin-bottom: 1.5rem;
}

.cdps-form-section h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #dbe4ee;
    color: #0f172a;
}

/* ── Registration Plate Input ────────────────────────────────── */
.cdps-reg-input-wrap {
    margin-bottom: 0.75rem;
}

.cdps-reg-input-wrap label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.cdps-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.cdps-reg-plate {
    display: flex;
    align-items: center;
    border: 2px solid var(--cdps-primary);
    border-radius: var(--cdps-radius);
    overflow: hidden;
    background: #fff;
    flex: 1;
    max-width: 320px;
}

.cdps-reg-flag {
    background: var(--cdps-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.5rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
}

.cdps-reg-plate input {
    border: none;
    outline: none;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.5rem;
    width: 100%;
    background: transparent;
}

.cdps-reg-plate input::placeholder {
    font-weight: 400;
    letter-spacing: 1px;
    opacity: 0.5;
}

.cdps-lookup-status {
    font-size: 0.875rem;
    min-height: 1.5rem;
}

.cdps-lookup-status.loading {
    color: #666;
}

.cdps-lookup-status.success {
    color: var(--cdps-success);
}

.cdps-lookup-status.error {
    color: var(--cdps-error);
}

/* ── Fields ──────────────────────────────────────────────────── */
.cdps-field {
    margin-bottom: 1rem;
}

.cdps-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #1f2937;
}

.cdps-field input,
.cdps-field select,
.cdps-field textarea {
    width: 100%;
    padding: 0.62rem 0.8rem;
    border: 1px solid var(--cdps-border);
    border-radius: var(--cdps-radius);
    font-size: 1rem;
    background: #f9fbfd;
    color: #0f172a;
    transition: border-color 0.2s;
}

.cdps-field input:focus,
.cdps-field select:focus,
.cdps-field textarea:focus {
    border-color: var(--cdps-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 101, 148, 0.14);
    background: #fff;
}

.cdps-field input[readonly] {
    background: #f4f7fb;
    color: #495057;
}

.cdps-field input.is-invalid {
    border-color: var(--cdps-error);
}

.cdps-required {
    color: var(--cdps-error);
}

/* ── Grids ───────────────────────────────────────────────────── */
.cdps-vehicle-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

.cdps-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

.cdps-contact-grid .cdps-field:last-child {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .cdps-lead-form-wrap {
        border-radius: 12px;
        padding: 1.1rem;
    }

    .cdps-vehicle-info-grid,
    .cdps-contact-grid {
        grid-template-columns: 1fr;
    }
    .cdps-contact-grid .cdps-field:last-child {
        grid-column: span 1;
    }
    .cdps-input-group {
        flex-direction: column;
    }
    .cdps-reg-plate {
        max-width: 100%;
    }

    .cdps-form-section h3 {
        font-size: 1.65rem;
    }
}

/* ── GDPR ────────────────────────────────────────────────────── */
.cdps-gdpr-field {
    margin-top: 0.5rem;
}

.cdps-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: 400 !important;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.4;
}

.cdps-checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 2px;
    flex-shrink: 0;
}

.cdps-checkbox-label a {
    color: var(--cdps-primary);
    text-decoration: underline;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.cdps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.cdps-btn-primary {
    background: var(--cdps-primary);
    color: #fff;
}

.cdps-btn-primary:hover {
    background: #255077;
    color: #fff;
}

.cdps-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cdps-btn-secondary {
    background: var(--cdps-secondary);
    color: #fff;
}

.cdps-btn-secondary:hover {
    background: #111827;
    color: #fff;
}

.cdps-btn-secondary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cdps-field-help {
    display: block;
    margin-top: 0.38rem;
    font-size: 0.8rem;
    color: #64748b;
}

.cdps-image-preview {
    margin-top: 0.7rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 0.55rem;
}

.cdps-image-preview-item {
    display: block;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #d9e2ec;
    background: #eef2f7;
    aspect-ratio: 4 / 3;
}

.cdps-image-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.cdps-image-preview-remove:hover {
    background: #fff;
    border-color: #64748b;
}

.cdps-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Form Actions ────────────────────────────────────────────── */
.cdps-form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cdps-form-actions-step {
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.cdps-step-nav {
    margin-bottom: 0.45rem;
}

.cdps-step-back-btn {
    border: 0;
    background: transparent;
    color: var(--cdps-primary);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.cdps-step-back-btn:hover {
    color: #255077;
    text-decoration: underline;
}

.cdps-lead-flow-modal .modal-content {
    border: 1px solid #d8e2ee;
    border-radius: 16px;
    overflow: hidden;
}

.cdps-lead-flow-modal .modal-header {
    border-bottom: 1px solid #dbe4ee;
    padding: 0.95rem 1.15rem;
}

.cdps-lead-flow-modal .modal-title {
    font-weight: 700;
    color: #0f172a;
}

.cdps-lead-flow-modal .modal-body {
    background: #fff;
    padding: 1rem 1.15rem 1.2rem;
}

.cdps-lead-flow-modal .cdps-form-section {
    margin-bottom: 1.25rem;
}

.cdps-lead-flow-modal .cdps-form-section:last-of-type {
    margin-bottom: 0.2rem;
}

.cdps-form-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ddd;
    border-top-color: var(--cdps-primary);
    border-radius: 50%;
    animation: cdps-spin 0.6s linear infinite;
}

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

/* ── Messages ────────────────────────────────────────────────── */
.cdps-form-messages {
    margin-top: 1rem;
}

.cdps-message {
    padding: 1rem 1.25rem;
    border-radius: var(--cdps-radius);
    font-size: 0.95rem;
}

.cdps-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.cdps-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* ── Hero Variant ────────────────────────────────────────────── */
.cdps-lead-hero {
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: center;
}

.cdps-lead-hero-overlay {
    width: 100%;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.cdps-lead-hero-content {
    max-width: 700px;
    width: 100%;
}

.cdps-lead-hero .cdps-lead-form-wrap {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(215, 224, 234, 0.8);
}

.cdps-lead-hero .cdps-lead-form-title,
.cdps-lead-hero .cdps-lead-form-desc {
    color: #0f172a;
}

.cdps-lead-hero .cdps-form-section h3 {
    color: #0f172a;
    border-bottom-color: #dbe4ee;
}

.cdps-lead-hero .cdps-field label {
    color: #1f2937;
}

.cdps-lead-hero .cdps-checkbox-label {
    color: #374151;
}

.cdps-lead-hero .cdps-checkbox-label a {
    color: var(--cdps-primary);
}

.cdps-lead-hero .cdps-lookup-status {
    color: #475569;
}

/* ── Modal Adjustments ───────────────────────────────────────── */
.modal .cdps-lead-form-wrap {
    max-width: 100%;
}

.modal .cdps-lead-form-title {
    display: none; /* Title is in modal header */
}

/* ── Brand Cards ─────────────────────────────────────────────── */
.cdps-brands-grid {
    margin: 0 auto;
}

.cdps-brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #fff;
    text-decoration: none;
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cdps-brand-card:hover {
    border-color: var(--cdps-primary, #2563eb);
    box-shadow: 0 2px 12px rgba(0,0,0,.10);
    color: #1a1a2e;
    text-decoration: none;
}

.cdps-brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.cdps-brand-logo-placeholder {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #9ca3af;
    background: #f3f4f6;
    border-radius: 50%;
}

.cdps-brand-name {
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    line-height: 1.2;
}

.cdps-brand-count {
    font-size: 0.75rem;
    color: #6b7280;
}

.cdps-brands-summary {
    text-align: center;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.cdps-brands-all-link .section-link {
    font-weight: 500;
}

/* Responsive brand grid */
@media (max-width: 767.98px) {
    .cdps-brands-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    .cdps-brand-logo {
        width: 44px;
        height: 44px;
    }
    .cdps-brand-card {
        padding: 1rem 0.5rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .cdps-brands-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .cdps-brands-grid--archive {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}
