/* ==========================================================================
   ANZRoam eSIM Products — Stylesheet
   Mobile-first, theme-agnostic.
   All selectors are scoped under .anzroam-* to avoid theme conflicts.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
    --anzroam-primary:        #0070f3;
    --anzroam-primary-hover:  #005ec2;
    --anzroam-primary-text:   #ffffff;
    --anzroam-surface:        #ffffff;
    --anzroam-border:         #e2e8f0;
    --anzroam-border-radius:  10px;
    --anzroam-text:           #1a202c;
    --anzroam-text-muted:     #718096;
    --anzroam-success:        #38a169;
    --anzroam-error:          #e53e3e;
    --anzroam-shadow:         0 2px 12px rgba(0,0,0,0.06);
    --anzroam-shadow-hover:   0 8px 28px rgba(0,0,0,0.12);
    --anzroam-transition:     0.22s ease;
}

/* --------------------------------------------------------------------------
   Outer Wrap
   Uses WordPress wide-size variable so width always matches other alignwide
   content on the page, regardless of how the shortcode is placed.
   -------------------------------------------------------------------------- */
.anzroam-esim-wrap {
    width:        100%;
    max-width:    var(--wp--style--global--wide-size, var(--wp--style--global--content-size, 1200px));
    margin-left:  auto;
    margin-right: auto;
    box-sizing:   border-box;
}

/* --------------------------------------------------------------------------
   Country Sections — vertical stack
   -------------------------------------------------------------------------- */
.anzroam-esim-sections {
    display:        flex;
    flex-direction: column;
    gap:            2.5rem;
    width:          100%;
}

/* --------------------------------------------------------------------------
   Country Section
   -------------------------------------------------------------------------- */
.anzroam-country-section {
    background:    var(--anzroam-surface);
    border:        1px solid var(--anzroam-border);
    border-radius: calc(var(--anzroam-border-radius) + 2px);
    box-shadow:    var(--anzroam-shadow);
    padding:       1.5rem;
}

/* --------------------------------------------------------------------------
   Country Header
   -------------------------------------------------------------------------- */
.anzroam-country-header {
    display:     flex;
    align-items: center;
    gap:         0.75rem;
    margin-bottom: 1.25rem;
}

.anzroam-flag {
    flex-shrink:   0;
    width:         40px;
    height:        40px;
    border-radius: 6px;
    object-fit:    cover;
}

.anzroam-country-meta {
    flex:        1;
    display:     flex;
    align-items: center;
    gap:         0.5rem;
}

.anzroam-country-title {
    font-size:   1.2rem;
    font-weight: 700;
    color:       var(--anzroam-text);
    line-height: 1.2;
}

.anzroam-plan-count {
    font-size: 0.8rem;
    color:     var(--anzroam-text-muted);
}

/* Mobile toggle — hidden on desktop, shown on mobile */
.anzroam-mobile-toggle {
    display:         none;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    width:           34px;
    height:          34px;
    background:      transparent;
    border:          1.5px solid var(--anzroam-border);
    border-radius:   50%;
    cursor:          pointer;
    color:           var(--anzroam-text-muted);
    transition:      transform var(--anzroam-transition),
                     border-color var(--anzroam-transition);
}

.anzroam-mobile-toggle[aria-expanded="true"] {
    transform:    rotate(180deg);
    border-color: var(--anzroam-primary);
    color:        var(--anzroam-primary);
}

/* --------------------------------------------------------------------------
   Plans Grid
   --anzroam-plan-cols is set inline by PHP based on visible plan count.
   Desktop: PHP-defined columns (1/2/3).
   Mobile: always single column, hidden until toggled.
   -------------------------------------------------------------------------- */
.anzroam-plans-grid {
    display:               grid;
    grid-template-columns: repeat(var(--anzroam-plan-cols, 3), 1fr);
    gap:                   1.25rem;
}

/* Mobile: hidden accordion */
@media (max-width: 599px) {
    .anzroam-mobile-toggle {
        display: flex;
    }

    .anzroam-country-header {
        margin-bottom: 0;
        cursor:        pointer;
    }

    .anzroam-plans-grid {
        display:               none;
        grid-template-columns: 1fr;
        margin-top:            1.25rem;
    }

    .anzroam-plans-grid.is-open {
        display: grid;
    }
}

/* --------------------------------------------------------------------------
   Plan Card
   -------------------------------------------------------------------------- */
.anzroam-plan-card {
    display:        flex;
    flex-direction: column;
    gap:            0.75rem;
    background:     var(--anzroam-surface);
    border:         1.5px solid var(--anzroam-border);
    border-radius:  var(--anzroam-border-radius);
    padding:        1.2rem;
    box-shadow:     var(--anzroam-shadow);
    transition:     box-shadow var(--anzroam-transition),
                    border-color var(--anzroam-transition),
                    transform var(--anzroam-transition);
}

.anzroam-plan-card:hover {
    box-shadow:   var(--anzroam-shadow-hover);
    border-color: var(--anzroam-primary);
    transform:    translateY(-2px);
}

.anzroam-plan-card.anzroam-outofstock {
    opacity: 0.55;
}

/* Data · Duration */
.anzroam-plan-specs {
    display:     flex;
    align-items: center;
    gap:         0.35rem;
    font-size:   1rem;
    font-weight: 700;
    color:       var(--anzroam-text);
}

.anzroam-plan-sep {
    color: var(--anzroam-text-muted);
}

/* Price */
.anzroam-plan-price {
    font-size:   1.75rem;
    font-weight: 800;
    color:       var(--anzroam-text);
    line-height: 1;
}

.anzroam-plan-price .woocommerce-Price-amount {
    color: var(--anzroam-text);
}

.anzroam-plan-price del {
    font-size:   1.1rem;
    font-weight: 400;
    color:       var(--anzroam-text-muted);
    margin-right: 0.25rem;
}

.anzroam-plan-price ins {
    text-decoration: none;
}

/* Feature bullets */
.anzroam-plan-features {
    list-style: none;
    margin:     0;
    padding:    0;
    flex:       1;
    display:    flex;
    flex-direction: column;
    gap:        0.3rem;
    font-size:  0.83rem;
    color:      var(--anzroam-text-muted);
}

.anzroam-plan-features li::before {
    content:     "✓ ";
    color:       var(--anzroam-success);
    font-weight: 700;
}

/* View Plan button — full-width dark */
.anzroam-plan-card .anzroam-view-plan-btn {
    display:       block;
    width:         100%;
    padding:       0.7rem 1rem;
    margin-top:    auto;
    font-size:     0.88rem;
    font-weight:   700;
    letter-spacing: 0.04em;
    text-align:    center;
    color:         #ffffff;
    background:    var(--anzroam-text);
    border:        none;
    border-radius: 6px;
    cursor:        pointer;
    transition:    background var(--anzroam-transition);
}

.anzroam-plan-card .anzroam-view-plan-btn:hover,
.anzroam-plan-card .anzroam-view-plan-btn:focus-visible {
    background: #2d3748;
    outline:    none;
}

/* Hidden plans (revealed by Show more) */
.anzroam-plan-hidden {
    display: none;
}

/* Show more button — spans full grid width */
.anzroam-show-more-wrap {
    grid-column: 1 / -1;
    display:     flex;
    justify-content: center;
    padding-top: 0.5rem;
}

.anzroam-show-more-btn {
    padding:       0.55rem 1.75rem;
    font-size:     0.88rem;
    font-weight:   600;
    color:         var(--anzroam-primary);
    background:    transparent;
    border:        1.5px solid var(--anzroam-primary);
    border-radius: 999px;
    cursor:        pointer;
    transition:    background var(--anzroam-transition),
                   color var(--anzroam-transition);
}

.anzroam-show-more-btn:hover,
.anzroam-show-more-btn:focus-visible {
    background: var(--anzroam-primary);
    color:      #ffffff;
    outline:    none;
}

.anzroam-show-less-btn {
    padding:       0.55rem 1.75rem;
    font-size:     0.88rem;
    font-weight:   600;
    color:         var(--anzroam-text-muted);
    background:    transparent;
    border:        1.5px solid var(--anzroam-border);
    border-radius: 999px;
    cursor:        pointer;
    transition:    background var(--anzroam-transition),
                   color var(--anzroam-transition);
}

.anzroam-show-less-btn:hover,
.anzroam-show-less-btn:focus-visible {
    background: #f0f4f8;
    color:      var(--anzroam-text);
    outline:    none;
}

/* Sold out label */
.anzroam-sold-out {
    font-size:  0.8rem;
    color:      var(--anzroam-text-muted);
    font-style: italic;
    margin-top: auto;
}

/* --------------------------------------------------------------------------
   Detail Panel Overlay
   -------------------------------------------------------------------------- */
.anzroam-detail-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(0, 0, 0, 0.5);
    z-index:         99999;
    display:         flex;
    align-items:     flex-start;
    justify-content: flex-end;
    opacity:         0;
    pointer-events:  none;
    transition:      opacity var(--anzroam-transition);
}

.anzroam-detail-overlay.is-open {
    opacity:        1;
    pointer-events: auto;
}

/* Slide-in panel from the right */
.anzroam-detail-panel {
    position:   relative;
    width:      100%;
    max-width:  520px;
    height:     100%;
    background: var(--anzroam-surface);
    overflow-y: auto;
    transform:  translateX(100%);
    transition: transform var(--anzroam-transition);
    box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}

.anzroam-detail-overlay.is-open .anzroam-detail-panel {
    transform: translateX(0);
}

@media (max-width: 540px) {
    .anzroam-detail-panel {
        max-width: 100%;
    }
}

.anzroam-detail-close {
    position:    absolute;
    top:         1rem;
    right:       1rem;
    background:  transparent;
    border:      none;
    font-size:   1.4rem;
    cursor:      pointer;
    color:       var(--anzroam-text-muted);
    line-height: 1;
    padding:     0.25rem;
    z-index:     1;
    transition:  color var(--anzroam-transition);
}

.anzroam-detail-close:hover {
    color: var(--anzroam-text);
}

.anzroam-detail-content {
    padding: 1.5rem;
}

/* --------------------------------------------------------------------------
   Detail Inner (populated by AJAX)
   -------------------------------------------------------------------------- */
.anzroam-detail-header {
    display:      flex;
    align-items:  center;
    gap:          1rem;
    margin-bottom: 1.25rem;
    padding-right: 2.5rem;
}

.anzroam-detail-flag {
    width:        64px;
    height:       64px;
    border-radius: 8px;
    object-fit:   cover;
    flex-shrink:  0;
}

.anzroam-detail-country {
    margin:      0 0 0.2rem;
    font-size:   1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.anzroam-detail-plan-name {
    margin:    0;
    font-size: 0.9rem;
    color:     var(--anzroam-text-muted);
}

/* Meta badges: Data / Duration / Price */
.anzroam-detail-meta {
    display:       flex;
    align-items:   stretch;
    gap:           0.75rem;
    flex-wrap:     wrap;
    margin-bottom: 1.25rem;
    padding:       1rem;
    background:    #f7faff;
    border-radius: 8px;
}

.anzroam-meta-item {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    flex:           1 1 auto;
    min-width:      80px;
    text-align:     center;
}

.anzroam-meta-icon {
    font-size:     1.4rem;
    margin-bottom: 0.15rem;
    line-height:   1;
}

.anzroam-meta-label {
    font-size:      0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color:          var(--anzroam-text-muted);
    font-weight:    600;
    line-height:    1.4;
}

.anzroam-meta-value {
    font-size:   1rem;
    font-weight: 700;
    color:       var(--anzroam-text);
    margin-top:  0.1rem;
    line-height: 1.2;
}

/* Neutralise WooCommerce price HTML so it renders like plain text */
.anzroam-meta-value .woocommerce-Price-amount,
.anzroam-meta-value bdi {
    display:        inline !important;
    vertical-align: baseline !important;
    margin:         0 !important;
    padding:        0 !important;
    line-height:    1.2 !important;
}

/* Hide any <br> elements inside meta items — they appear as flex children
   and push the value row down (WC price HTML / template whitespace artefact) */
.anzroam-meta-item br { display: none; }

/* Description */
.anzroam-detail-description {
    margin-bottom: 1.5rem;
    font-size:     0.9rem;
    line-height:   1.6;
    color:         var(--anzroam-text);
}

.anzroam-detail-description h2 {
    font-size:   1rem;
    font-weight: 600;
    margin:      1rem 0 0.5rem;
}

.anzroam-detail-description ul {
    padding-left: 1.2rem;
    margin:       0 0 0.75rem;
}

.anzroam-detail-description li {
    margin-bottom: 0.3rem;
}

/* Actions */
.anzroam-detail-actions {
    padding-top: 1rem;
    border-top:  1px solid var(--anzroam-border);
}

.anzroam-add-to-cart-btn {
    display:       block;
    width:         100%;
    padding:       0.85rem 1.5rem;
    font-size:     1rem;
    font-weight:   700;
    color:         var(--anzroam-primary-text) !important;
    background:    var(--anzroam-primary) !important;
    border:        none !important;
    border-radius: 8px;
    cursor:        pointer;
    text-align:    center;
    transition:    background var(--anzroam-transition),
                   transform 0.1s ease;
}

.anzroam-add-to-cart-btn:hover:not(:disabled) {
    background: var(--anzroam-primary-hover) !important;
    transform:  translateY(-1px);
}

.anzroam-add-to-cart-btn:disabled {
    opacity:   0.65;
    cursor:    not-allowed;
    transform: none;
}

.anzroam-add-to-cart-btn.is-loading {
    opacity: 0.75;
    cursor:  wait;
}

/* Cart feedback */
.anzroam-cart-feedback {
    margin-top:    0.75rem;
    padding:       0.6rem 0.9rem;
    border-radius: 6px;
    font-size:     0.88rem;
    font-weight:   500;
}

.anzroam-cart-feedback.is-success {
    background: #f0fff4;
    color:      var(--anzroam-success);
    border:     1px solid #c6f6d5;
}

.anzroam-cart-feedback.is-error {
    background: #fff5f5;
    color:      var(--anzroam-error);
    border:     1px solid #fed7d7;
}

/* --------------------------------------------------------------------------
   Loading spinner
   -------------------------------------------------------------------------- */
.anzroam-detail-loading {
    display:     flex;
    align-items: center;
    gap:         0.75rem;
    padding:     2rem 1.5rem;
    color:       var(--anzroam-text-muted);
}

.anzroam-spinner {
    display:       inline-block;
    width:         22px;
    height:        22px;
    border:        3px solid var(--anzroam-border);
    border-top-color: var(--anzroam-primary);
    border-radius: 50%;
    animation:     anzroam-spin 0.7s linear infinite;
    flex-shrink:   0;
}

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

/* Ensure pre-rendered SSR templates are never visible */
template.anzroam-detail-tpl { display: none !important; }

/* --------------------------------------------------------------------------
   No products message
   -------------------------------------------------------------------------- */
.anzroam-no-products {
    color:      var(--anzroam-text-muted);
    font-style: italic;
    padding:    1.5rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Non-HKIP badge + detail notice
   -------------------------------------------------------------------------- */

/* Small badge — appears in plan card specs row and detail panel */
.anzroam-nonhkip-badge {
    display:       inline-block;
    font-size:     0.65rem;
    font-weight:   600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color:         #6b46c1;
    background:    #f3eeff;
    border:        1px solid #c4b5fd;
    border-radius: 4px;
    padding:       1px 6px;
    line-height:   1.6;
    vertical-align: middle;
    white-space:   nowrap;
}

/* Notice block inside the detail slide-in panel */
.anzroam-nonhkip-notice {
    display:       flex;
    align-items:   flex-start;
    gap:           0.75rem;
    background:    #f9f5ff;
    border:        1px solid #c4b5fd;
    border-radius: var(--anzroam-border-radius);
    padding:       0.875rem 1rem;
    margin-bottom: 1.25rem;
}

.anzroam-nonhkip-notice .anzroam-nonhkip-badge {
    flex-shrink: 0;
    margin-top:  2px;
}

.anzroam-nonhkip-explanation {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--anzroam-text);
}

.anzroam-nonhkip-explanation strong {
    display:       block;
    margin-bottom: 0.2rem;
    color:         #5b21b6;
}

.anzroam-nonhkip-explanation p {
    margin: 0;
    color:  var(--anzroam-text-muted);
}

/* --------------------------------------------------------------------------
   Sale Promotion
   -------------------------------------------------------------------------- */

/* Red accent border on the left edge of sale cards */
.anzroam-plan-card--sale {
    border-left: 3px solid #dc2626;
}

/* Header row — badge + specs on the same line */
.anzroam-plan-header {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-wrap:   wrap;
}

/* "Sale" pill badge — inline before the specs */
.anzroam-sale-badge {
    display:        inline-block;
    flex-shrink:    0;
    background:     #dc2626;
    color:          #fff;
    font-size:      0.68rem;
    font-weight:    700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding:        2px 9px;
    border-radius:  999px;
    line-height:    1.6;
}

/* "Offer expires …" notice — below price, above feature list */
.anzroam-sale-expires {
    margin:      4px 0 0;
    font-size:   0.78rem;
    font-style:  italic;
    color:       #dc2626;
    line-height: 1.4;
}
