/**
 * WP PDC eSIM — Styles frontend
 * Shortcodes [pdc_esim_roaming] et [pdc_esim_destination]
 */

/* ============================================
   Variables & Base
   ============================================ */
.pdc-esim-roaming,
.pdc-esim-roaming-wrap,
.pdc-esim-destination {
    font-family: Arial, sans-serif;
    margin: 20px 0;
    color: #333;
}

.pdc-esim-title {
    color: #ffb606;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 0;
}

/* ============================================
   Header (toggle via wpmaps-view-toggle)
   ============================================ */
.pdc-esim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================
   Map Layout : Sidebar + Carte
   ============================================ */
.pdc-esim-map-layout {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 12px;
    height: 520px;
    position: relative;
}

/* ============================================
   Sidebar
   ============================================ */
.pdc-esim-sidebar {
    width: 300px;
    min-width: 300px;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid #ddd;
    background: #fafafa;
    border-radius: 12px 0 0 12px;
}

.pdc-esim-sidebar__provider {
    border-bottom: 1px solid #eee;
}

.pdc-esim-sidebar__provider:last-child {
    border-bottom: none;
}

.pdc-esim-sidebar__header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    color: #333;
    text-align: left;
    transition: background 0.15s ease;
}

.pdc-esim-sidebar__header:hover {
    background: #f5f5f5;
}

.pdc-esim-sidebar__logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

.pdc-esim-sidebar__name {
    flex: 1;
}

.pdc-esim-sidebar__arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.pdc-esim-sidebar__header[aria-expanded="false"] .pdc-esim-sidebar__arrow {
    transform: rotate(-90deg);
}

.pdc-esim-sidebar__header[aria-expanded="false"] + .pdc-esim-sidebar__plans {
    display: none;
}

.pdc-esim-sidebar__plans {
    padding: 0 10px 10px 10px;
}

.pdc-esim-sidebar__plan {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 13px;
}

.pdc-esim-sidebar__plan:hover {
    background: #f0f0f0;
}

.pdc-esim-sidebar__plan input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #ffb606;
    flex-shrink: 0;
}

.pdc-esim-sidebar__plan-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pdc-esim-sidebar__plan-name {
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pdc-esim-sidebar__plan-detail {
    color: #888;
    font-size: 12px;
}

.pdc-esim-sidebar__plan-detail strong {
    color: #ffb606;
}

/* Indicateurs couverture */
.pdc-esim-cover-yes {
    color: #2e7d32;
    font-weight: bold;
    font-size: 13px;
}

.pdc-esim-cover-no {
    color: #c62828;
    font-weight: bold;
    font-size: 13px;
}

.pdc-esim-coverage-cell {
    text-align: center;
    font-weight: 600;
}

/* ============================================
   Carte Leaflet
   ============================================ */
.pdc-esim-map {
    flex: 1;
    height: 100%;
    min-height: 280px;
    position: relative;
    overflow: hidden;
    border-radius: 0 12px 12px 0;
}

/* Fix : le reset du thème (img { max-width:100%; height:auto })
   casse le positionnement des tuiles Leaflet */
.pdc-esim-map img {
    max-width: none !important;
    max-height: none !important;
    height: auto;
    margin: 0 !important;
}

.pdc-esim-map svg {
    max-width: none !important;
}

/* Légende carte */
.pdc-esim-legend {
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 12px;
    line-height: 1.8;
}

.pdc-esim-legend__title {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 13px;
}

.pdc-esim-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdc-esim-legend__color {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* ============================================
   Tableau Roaming
   ============================================ */
.pdc-esim-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.pdc-esim-table th,
.pdc-esim-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.pdc-esim-table th {
    background-color: #ffb606;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.pdc-esim-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.pdc-esim-table tr:hover {
    background-color: #f5f5f5;
}

.pdc-esim-provider-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdc-esim-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}

.pdc-esim-provider-name {
    font-weight: 600;
}

.pdc-esim-price {
    font-weight: bold;
    color: #ffb606;
    white-space: nowrap;
}

/* ============================================
   Table Groups (accordion)
   ============================================ */
.pdc-esim-tbl-group {
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.pdc-esim-tbl-group__header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    color: #333;
    text-align: left;
    transition: background 0.15s ease;
}

.pdc-esim-tbl-group__header:hover {
    background: #f5f5f5;
}

.pdc-esim-tbl-group__logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.pdc-esim-tbl-group__name {
    flex: 1;
}

.pdc-esim-tbl-group__count {
    font-size: 13px;
    font-weight: normal;
    color: #999;
}

.pdc-esim-tbl-group__arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.pdc-esim-tbl-group__header[aria-expanded="false"] .pdc-esim-tbl-group__arrow {
    transform: rotate(-90deg);
}

.pdc-esim-tbl-group__header[aria-expanded="false"] + .pdc-esim-tbl-group__body {
    display: none;
}

/* ============================================
   Badges
   ============================================ */
.pdc-esim-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdc-esim-badge--recommended {
    background: #fff3d0;
    color: #b8860b;
}

.pdc-esim-badge--esim {
    background: #e8f5e9;
    color: #2e7d32;
}

.pdc-esim-badge--local {
    background: #e3f2fd;
    color: #1565c0;
}

/* ============================================
   Filtres Destination
   ============================================ */
.pdc-esim-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pdc-esim-filter {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-family: Arial, sans-serif;
    transition: all 0.2s ease;
}

.pdc-esim-filter:hover {
    border-color: #ffb606;
    color: #ffb606;
}

.pdc-esim-filter.active {
    background: #ffb606;
    color: white;
    border-color: #ffb606;
}

/* ============================================
   Cards Destination
   ============================================ */
.pdc-esim-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.pdc-esim-card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    background: white;
    transition: box-shadow 0.2s ease, opacity 0.3s ease;
}

.pdc-esim-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pdc-esim-card.hidden {
    display: none;
}

.pdc-esim-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.pdc-esim-card__logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

.pdc-esim-card__provider {
    flex: 1;
}

.pdc-esim-card__name {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: bold;
}

.pdc-esim-card__rating {
    color: #ffb606;
    font-weight: bold;
    font-size: 14px;
}

/* ============================================
   Plans dans les Cards
   ============================================ */
.pdc-esim-card__plans {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pdc-esim-plan {
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

.pdc-esim-plan--recommended {
    border-color: #ffb606;
    background: #fffbf0;
}

.pdc-esim-plan__name {
    font-weight: 600;
    margin-bottom: 6px;
}

.pdc-esim-plan__details {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.pdc-esim-plan__separator {
    margin: 0 6px;
    color: #ccc;
}

.pdc-esim-plan__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdc-esim-plan__price {
    font-size: 20px;
    font-weight: bold;
    color: #ffb606;
}

/* ============================================
   Bouton CTA
   ============================================ */
.pdc-esim-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #ffb606;
    color: white !important;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdc-esim-btn:hover {
    background: #e6a400;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 182, 6, 0.3);
}

/* ============================================
   Promo Code
   ============================================ */
.pdc-esim-promo {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fff3d0;
    border-radius: 6px;
    font-size: 13px;
}

.pdc-esim-promo__code {
    background: #ffb606;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
}

.pdc-esim-promo__discount {
    color: #2e7d32;
    font-weight: bold;
    margin-left: 6px;
}

/* ============================================
   Verified Date
   ============================================ */
.pdc-esim-verified,
.pdc-esim-card__verified {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

/* ============================================
   Destination v2 — Toggle (fallback si wpmaps absent)
   ============================================ */
.pdc-esim-destination .wpmaps-view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 8px;
}

.pdc-esim-destination .wpmaps-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border: none !important;
    background: transparent !important;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b !important;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.pdc-esim-destination .wpmaps-toggle-btn:hover {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

.pdc-esim-destination .wpmaps-toggle-btn--active {
    background: white !important;
    color: #3b82f6 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pdc-esim-destination .wpmaps-view {
    display: none;
}

.pdc-esim-destination .wpmaps-view--active {
    display: block;
}

/* ============================================
   Destination v2 — SVG Icon
   ============================================ */
.pdc-esim-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ============================================
   Destination v2 — Cards View
   ============================================ */
.pdc-esim-dest-cards-wrap {
    position: relative;
}

.pdc-esim-dest-cards {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.pdc-esim-dest-cards::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Flèches navigation */
.pdc-esim-dest-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.2s ease;
    color: #333;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.pdc-esim-dest-arrow:hover {
    background: #ffb606;
    color: white;
    border-color: #ffb606;
    box-shadow: 0 4px 12px rgba(255,182,6,0.3);
}

.pdc-esim-dest-arrow--left {
    left: -12px;
}

.pdc-esim-dest-arrow--right {
    right: -12px;
}

.pdc-esim-dest-arrow[disabled] {
    opacity: 0;
    pointer-events: none;
}

.pdc-esim-dest-card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    background: white;
    transition: box-shadow 0.2s ease;
    min-width: 340px;
    max-width: 420px;
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.pdc-esim-dest-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.pdc-esim-dest-card.hidden {
    display: none;
}

.pdc-esim-dest-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.pdc-esim-dest-card__logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.pdc-esim-dest-card__info {
    flex: 1;
    min-width: 0;
}

.pdc-esim-dest-card__name {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.pdc-esim-dest-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.pdc-esim-dest-card__rating {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pdc-esim-dest-card__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #94a3b8;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.pdc-esim-dest-card__link:hover {
    color: #ffb606;
    background: #fff8e1;
}

.pdc-esim-dest-card__desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 14px 0;
}

/* ============================================
   Destination v2 — Plans dans cards
   ============================================ */
.pdc-esim-dest-card__plans {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdc-esim-dest-plan {
    padding: 12px 14px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

.pdc-esim-dest-plan--recommended {
    border-color: #ffb606;
    background: #fffbf0;
}

.pdc-esim-dest-plan__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pdc-esim-dest-plan__name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.pdc-esim-dest-plan__features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
}

.pdc-esim-dest-plan__feat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.pdc-esim-dest-plan__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.pdc-esim-dest-plan__pricing {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.pdc-esim-dest-plan__price {
    font-size: 20px;
    font-weight: bold;
    color: #ffb606;
}

.pdc-esim-dest-plan__price-local {
    font-size: 12px;
    color: #999;
}

.pdc-esim-dest-plan__meta {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
}

/* ============================================
   Destination v2 — Bouton petit (tableau)
   ============================================ */
.pdc-esim-btn--sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
}

/* ============================================
   Destination v2 — Prix local dans le tableau
   ============================================ */
.pdc-esim-price-local {
    font-size: 11px;
    color: #999;
    font-weight: normal;
}

/* ============================================
   Destination v2 — Tableau trié par prix
   ============================================ */
.pdc-esim-dest-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.pdc-esim-dest-table tr.hidden {
    display: none;
}

/* ============================================
   Responsive — Tablette (iPad)
   ============================================ */
@media (max-width: 1024px) {
    /* Carte à droite, sidebar plus étroite */
    .pdc-esim-map-layout {
        height: 420px;
    }

    .pdc-esim-sidebar {
        width: 240px;
        min-width: 240px;
    }
}

/* ============================================
   Responsive — Mobile
   ============================================ */
@media (max-width: 767px) {
    .pdc-esim-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pdc-esim-title {
        font-size: 18px;
    }

    /* Mobile : sidebar au-dessus, carte en dessous */
    .pdc-esim-map-layout {
        flex-direction: column;
        height: auto;
    }

    .pdc-esim-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid #ddd;
        border-radius: 12px 12px 0 0;
    }

    .pdc-esim-map {
        width: 100%;
        min-height: 300px;
        height: 300px;
        flex: none;
        border-radius: 0 0 12px 12px;
    }

    /* Tables */
    .pdc-esim-table th,
    .pdc-esim-table td {
        padding: 8px;
        font-size: 13px;
    }

    .pdc-esim-provider-cell {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .pdc-esim-card {
        padding: 15px;
    }

    .pdc-esim-card__header {
        flex-wrap: wrap;
    }

    .pdc-esim-plan__bottom {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .pdc-esim-btn {
        width: 100%;
        text-align: center;
    }

    .pdc-esim-filters {
        gap: 6px;
    }

    .pdc-esim-filter {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Destination v2 : cards full width on mobile */
    .pdc-esim-dest-card {
        min-width: 280px;
        max-width: 320px;
        padding: 15px;
    }

    .pdc-esim-dest-arrow {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .pdc-esim-dest-arrow--left { left: -6px; }
    .pdc-esim-dest-arrow--right { right: -6px; }

    .pdc-esim-dest-card__header {
        flex-wrap: wrap;
    }

    .pdc-esim-dest-plan__bottom {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .pdc-esim-dest-plan__bottom .pdc-esim-btn {
        width: 100%;
        text-align: center;
    }

    .pdc-esim-dest-plan__features {
        gap: 6px 10px;
    }

    /* Destination v2 : tableau stack sur mobile */
    .pdc-esim-dest-table thead {
        display: none;
    }

    .pdc-esim-dest-table tr {
        display: block;
        margin-bottom: 8px;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
    }

    .pdc-esim-dest-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .pdc-esim-dest-table td::before {
        content: attr(data-label);
        font-weight: bold;
        font-size: 12px;
        color: #666;
        text-transform: uppercase;
    }

    /* Table roaming : layout stack sur mobile */
    .pdc-esim-table--roaming thead {
        display: none;
    }

    .pdc-esim-table--roaming tr {
        display: block;
        margin-bottom: 8px;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
    }

    .pdc-esim-table--roaming td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .pdc-esim-table--roaming td::before {
        content: attr(data-label);
        font-weight: bold;
        font-size: 12px;
        color: #666;
        text-transform: uppercase;
    }

    .pdc-esim-tbl-group__header {
        padding: 12px;
        font-size: 15px;
    }
}

/* ============================================
   Fallback toggle (si wp-pdc-maps inactif)
   ============================================ */
.pdc-esim-roaming-wrap .wpmaps-view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 8px;
}

.pdc-esim-roaming-wrap .wpmaps-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border: none !important;
    background: transparent !important;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b !important;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}

.pdc-esim-roaming-wrap .wpmaps-toggle-btn:hover {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

.pdc-esim-roaming-wrap .wpmaps-toggle-btn--active {
    background: white !important;
    color: #3b82f6 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pdc-esim-roaming-wrap .wpmaps-view {
    display: none;
}

.pdc-esim-roaming-wrap .wpmaps-view--active {
    display: block;
}
