/* ═══════════════════════════════════════════════════════════════════
   mc_phones — Phone Selector Styles
   Mobile-first. Bottom sheet su mobile, dialog centrato su desktop.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Badge (floating, fixed bottom-right) ─────────────────────────── */
#mc-phone-badge {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.18);
    padding: 8px 14px;
}

/* Icona telefono via CSS — nessuna dipendenza da font-icon esterni */
.mc-ph-icon::before {
    content: "\1F4F1"; /* 📱 */
    font-style: normal;
}

#mc-phone-badge .mc-ph-ask,
#mc-phone-badge .mc-ph-change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid currentColor;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    color: inherit;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

#mc-phone-badge .mc-ph-ask:hover,
#mc-phone-badge .mc-ph-change:hover {
    background: rgba(0, 0, 0, 0.08);
}

#mc-phone-badge.mc-ph-filled {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mc-ph-meta {
    font-size: 0.7em;
    opacity: 0.65;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mc-ph-label {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* ── Overlay ─────────────────────────────────────────────────────── */
#mc-phone-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: flex-end;   /* mobile: bottom sheet */
    justify-content: center;
    animation: mc-fade-in 0.2s ease;
}

#mc-phone-overlay.mc-ph-closing {
    animation: mc-fade-out 0.18s ease forwards;
}

@keyframes mc-fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes mc-fade-out { from { opacity: 1 } to { opacity: 0 } }

/* ── Popup ───────────────────────────────────────────────────────── */
#mc-phone-popup {
    background: #fff;
    width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.18);
    animation: mc-slide-up 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes mc-slide-up {
    from { transform: translateY(100%) }
    to   { transform: translateY(0) }
}

/* Desktop: centered dialog */
@media (min-width: 600px) {
    #mc-phone-overlay {
        align-items: center;
    }

    #mc-phone-popup {
        width: 460px;
        max-height: 72vh;
        border-radius: 16px;
        animation: mc-pop-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes mc-pop-in {
        from { transform: scale(0.92); opacity: 0 }
        to   { transform: scale(1);   opacity: 1 }
    }
}

/* ── Header popup ─────────────────────────────────────────────────── */
.mc-ph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.mc-ph-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: #111;
}

.mc-ph-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.mc-ph-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ── Steps ───────────────────────────────────────────────────────── */
.mc-ph-step {
    display: none;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.mc-ph-step.mc-ph-active {
    display: flex;
}

/* ── Step 1: brand grid ──────────────────────────────────────────── */
.mc-ph-hint {
    padding: 14px 20px 8px;
    margin: 0;
    font-size: 13px;
    color: #666;
    flex-shrink: 0;
}

.mc-ph-brands {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 8px 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mc-ph-brand-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f7f7f7;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #222;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    text-align: left;
}

.mc-ph-brand-btn:hover,
.mc-ph-brand-btn:focus-visible {
    background: #ececec;
    border-color: #ccc;
    outline: none;
}

.mc-ph-brand-btn:active {
    transform: scale(0.97);
}

/* Evidenzia i brand pinned (primi 3) */
.mc-ph-brand-btn:nth-child(-n+3) {
    background: #f0f5ff;
    border-color: #c5d6f8;
}

.mc-ph-brand-btn:nth-child(-n+3):hover,
.mc-ph-brand-btn:nth-child(-n+3):focus-visible {
    background: #e3edff;
    border-color: #9db8f0;
}

.mc-ph-brand-count {
    font-size: 11px;
    font-weight: 400;
    color: #888;
    background: #fff;
    border-radius: 10px;
    padding: 2px 7px;
    border: 1px solid #ddd;
    margin-left: 8px;
    white-space: nowrap;
}

/* ── Step 2: search + model list ─────────────────────────────────── */
.mc-ph-step2-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 8px;
    flex-shrink: 0;
    border-bottom: 1px solid #eee;
}

.mc-ph-back {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #0071e3;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    white-space: nowrap;
}

.mc-ph-back:hover {
    background: #e8f0fe;
}

.mc-ph-brand-title {
    font-weight: 700;
    font-size: 15px;
    color: #111;
}

.mc-ph-search-wrap {
    padding: 10px 16px 6px;
    flex-shrink: 0;
}

#mc-ph-search {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 15px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    outline: none;
    background: #f9f9f9;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
}

#mc-ph-search:focus {
    border-color: #0071e3;
    background: #fff;
}

/* ── Model list ──────────────────────────────────────────────────── */
#mc-ph-model-list {
    list-style: none;
    margin: 0;
    padding: 4px 0 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.mc-ph-model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f2f2f2;
    transition: background 0.12s;
}

.mc-ph-model-item:last-child {
    border-bottom: none;
}

.mc-ph-model-item:hover,
.mc-ph-model-item:focus-visible {
    background: #f5f8ff;
    outline: none;
}

.mc-ph-model-item:active {
    background: #e8efff;
}

.mc-ph-model-name {
    font-size: 15px;
    color: #111;
    font-weight: 500;
}

.mc-ph-model-year {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

.mc-ph-no-results {
    padding: 24px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
    list-style: none;
}

/* ── Accessibilità: reduce motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #mc-phone-overlay,
    #mc-phone-popup {
        animation: none;
    }
}
