/* ============================================================
 * SwissCarInfo — Reproduction visuelle des plaques d'immatriculation suisses
 * Composant réutilisable .ch-plate (rendu HTML+CSS pur, sans image autre que les SVG d'armoiries cantonales)
 *
 * Usage :
 *   <div class="ch-plate ch-plate--white ch-plate--mini">
 *     <span class="ch-plate-shield"><img src="/public/img/cantons/ch.svg" alt=""></span>
 *     <span class="ch-plate-text">BE · 123456</span>
 *     <span class="ch-plate-flag"><img src="/public/img/cantons/be.svg" alt=""></span>
 *   </div>
 *
 * Modificateurs couleur : --white, --yellow, --green, --blue, --brown
 * Modificateurs format  : --mini (sélecteur), --normal, --moto (carré)
 * ============================================================ */

.ch-plate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 5px;
    border: 2px solid #1e293b;
    font-family: 'Arial Black', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.06em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.4);
    background: #fff;
    color: #000;
    user-select: none;
    -webkit-user-select: none;
}

.ch-plate-shield,
.ch-plate-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ch-plate-shield img,
.ch-plate-flag img {
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: contain;
}

.ch-plate-text {
    font-size: inherit;
    white-space: nowrap;
    line-height: 1;
}

.ch-plate-dot {
    margin: 0 1px;
    font-weight: 900;
}

/* ─── Couleurs de fond (schildfarbe_code) ─── */
.ch-plate--white  { background: #ffffff; color: #000; border-color: #1e293b; }
.ch-plate--yellow { background: #f5c800; color: #000; border-color: #1e293b; }
.ch-plate--green  { background: #0a5c2e; color: #ffffff; border-color: #0a5c2e; }
.ch-plate--blue   { background: #0e5fa6; color: #ffffff; border-color: #0e5fa6; }
.ch-plate--brown  { background: #5a3a1a; color: #ffffff; border-color: #5a3a1a; }
.ch-plate--black  { background: #1a1a1a; color: #ffffff; border-color: #1a1a1a; }

/* ─── Formats / tailles ─── */
.ch-plate--mini {
    font-size: 16px;
    padding: 5px 11px;
    height: 32px;
    gap: 6px;
}
.ch-plate--mini .ch-plate-shield img,
.ch-plate--mini .ch-plate-flag img {
    height: 22px;
}

.ch-plate--normal {
    font-size: 22px;
    padding: 8px 14px;
    height: 44px;
    gap: 8px;
}
.ch-plate--normal .ch-plate-shield img,
.ch-plate--normal .ch-plate-flag img {
    height: 28px;
}

.ch-plate--moto {
    font-size: 16px;
    padding: 6px 10px;
    height: 36px;
    gap: 6px;
}
.ch-plate--moto .ch-plate-shield img,
.ch-plate--moto .ch-plate-flag img {
    height: 22px;
}

/* ═══════════════════════════════════════════════════════════════
   PLATE PICKER — sélecteur de type de véhicule / véhicule individuel
   ═══════════════════════════════════════════════════════════════ */

.plate-picker-wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 16px 16px 24px;
    text-align: left;
}

/* Conteneur du bouton retour : aligné à gauche, sans contrainte de largeur */
.plate-picker-back-wrap {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 16px;
    padding: 0 4px;
    text-align: left;
}

.plate-picker-header {
    text-align: center;
    margin-bottom: 28px;
    padding: 0 16px;
}

.plate-picker-header h4 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}

.plate-picker-header p {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
    font-weight: 500;
}

.plate-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    margin: 0 auto;
    width: 100%;
}

/* Quand il n'y a que 1 ou 2 options, on les centre et on laisse plus d'espace */
.plate-picker:has(.plate-picker-option:only-child) {
    grid-template-columns: minmax(340px, 460px);
    justify-content: center;
}
.plate-picker:has(.plate-picker-option:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(340px, 440px));
    justify-content: center;
}

.plate-picker-option {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 22px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
    text-align: left;
    width: 100%;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

/* Variante "Wechselschild" : accent visuel doré + ruban au-dessus pour le badge */
.plate-picker-option--wechsel {
    border-color: #fbbf24;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 60%);
    padding-top: 30px;
}

.plate-picker-option--wechsel:hover {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fafbff 70%);
    box-shadow: 0 12px 28px -8px rgba(245, 158, 11, 0.22), 0 4px 12px -4px rgba(0,0,0,0.06);
}

/* Badge "Plaque interchangeable" : ruban en haut, pleine largeur */
.plate-picker-wechsel-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 12px;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 2;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
}

.plate-picker-wechsel-badge i {
    font-size: 0.7rem;
}

/* Badge "Type de plaque spéciale" : non-normal (K, Z, CD, CC, AT) — chip dans la meta */
.plate-picker-special-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.5;
    letter-spacing: 0.02em;
    margin-right: 6px;
    vertical-align: middle;
}

.plate-picker-special-badge i {
    font-size: 0.65rem;
}

.plate-picker-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0) 0%, rgba(37, 99, 235, 0.04) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.plate-picker-option:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -8px rgba(37, 99, 235, 0.18), 0 4px 12px -4px rgba(0,0,0,0.06);
    background: #fafbff;
}

.plate-picker-option:hover::before {
    opacity: 1;
}

.plate-picker-option:active {
    transform: translateY(-1px);
}

.plate-picker-option > .ch-plate {
    flex-shrink: 0;
    align-self: center;
}

.plate-picker-option-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.plate-picker-option-label {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
    line-height: 1.3;
    margin-bottom: 5px;
    letter-spacing: -0.005em;
}

.plate-picker-option-meta {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

.plate-picker-option-meta strong {
    color: #2563eb;
    font-weight: 700;
}

.plate-picker-option-arrow {
    color: #cbd5e1;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: color 0.18s ease, transform 0.18s ease;
    z-index: 1;
}

.plate-picker-option:hover .plate-picker-option-arrow {
    color: #2563eb;
    transform: translateX(3px);
}

/* Lien retour stylé */
.plate-picker-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 7px 14px;
    border-radius: 999px;
    transition: all 0.18s ease;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
}

.plate-picker-back-link:hover {
    background: #f1f5f9;
    color: #2563eb;
    border-color: #cbd5e1;
    transform: translateX(-2px);
}

.plate-picker-back-link i {
    transition: transform 0.18s ease;
}

.plate-picker-back-link:hover i {
    transform: translateX(-2px);
}

/* Responsive */
@media (max-width: 640px) {
    .plate-picker {
        grid-template-columns: 1fr;
    }
    .plate-picker:has(.plate-picker-option:only-child),
    .plate-picker:has(.plate-picker-option:nth-child(2):last-child) {
        grid-template-columns: 1fr;
    }
    .plate-picker-option {
        padding: 16px 16px;
        gap: 14px;
    }
    /* Conserver le padding-top élargi sur les cartes Wechselschild pour ne pas écraser le ruban */
    .plate-picker-option--wechsel {
        padding-top: 34px;
    }
    .plate-picker-header h4 {
        font-size: 1.2rem;
    }
    .plate-picker-header p {
        font-size: 0.88rem;
    }
    /* Le ruban garde sa taille mais on garantit qu'il ne déborde pas du card */
    .plate-picker-wechsel-badge {
        font-size: 0.62rem;
        padding: 5px 10px;
    }
}
