/* Extracted from an inline <style> in: application/views/esim/detail.php
   Edit here; every view listed links this file. */
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #fff7f2;
        /* อ่อนส้ม */
        --bg-tertiary: #ffe9de;
        /* highlight background */

        --text-primary: #1a1a1a;
        --text-secondary: #6b7280;
        --text-tertiary: #9ca3af;

        --border-light: #fde1d3;
        /* ขอบส้มอ่อน */
        --border-medium: #f7c9ae;

        --accent-primary: #e35000;
        /* สีหลัก */
        --accent-hover: #cc4700;
        /* hover */
        --accent-light: #ffe9de;
        /* bg ปุ่มอ่อน */

        --success: #10b981;
        --danger: #ef4444;

        --shadow-sm: 0 1px 2px rgba(227, 80, 0, 0.06);
        --shadow-md: 0 4px 10px rgba(227, 80, 0, 0.10);

        --radius: 12px;
        --radius-sm: 8px;
    }

    /* ---- BACK BUTTON ---- */
    .back-link {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 14px;
        padding: 2rem 0 0;
        transition: all 0.2s ease;
    }

    .back-link:hover {
        color: var(--text-primary);
        gap: 10px;
    }

    /* ---- HERO ---- */
    .country-hero {
        padding: 2.2rem 0 1.6rem;
        display: flex;
        align-items: center;
        gap: 1.4rem;
    }

    .country-flag-big {
        font-size: 4.6rem;
        line-height: 1;
        filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
        flex-shrink: 0;
    }

    .country-hero-info {
        flex: 1;
    }

    .country-hero-region {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-tertiary);
        margin-bottom: 0.4rem;
        font-weight: 500;
    }

    .country-hero-name {

        font-size: clamp(2rem, 4vw, 3rem);
        font-weight: 700;
        line-height: 1.05;
        margin-bottom: 0.7rem;
        color: var(--text-primary);
    }

    .country-hero-stats {
        display: flex;
        gap: 1.2rem;
        flex-wrap: wrap;
    }

    .chs {
        font-size: 13px;
        color: var(--text-secondary);
    }

    .chs strong {
        color: var(--text-primary);
        font-weight: 600;
    }

    /* ---- SELECTOR LAYOUT ---- */
    .selector-wrap {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 325px;
        gap: 20px;
       
    }

    .selector-main,
    .selector-side {
        background: var(--bg-primary);
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
    }

    .selector-main {
        padding: 1.5rem;
    }

    .selector-side {
        padding: 1.25rem;
        position: sticky;
        top: 24px;
        align-self: start;
    }

    .section-block+.section-block {
        margin-top: 1.7rem;
        padding-top: 1.7rem;
        border-top: 1px solid var(--border-light);
    }

    #cardTypeAlerts:empty {
        display: none;
    }

    .section-title {

        font-size: 1.05rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 0.35rem;
    }

    .section-sub {
        color: var(--text-secondary);
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    /* ---- OPTION GRID ---- */
    .option-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }

    .option-grid.payment {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));

    }

    .option-btn {
        appearance: none;
        border: 1px solid var(--border-light);
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-radius: var(--radius-sm);
        padding: 10px 12px;
        min-height: 42px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all .15s ease;
        text-align: center;
    }

    .option-btn:hover:not(:disabled) {
        border-color: var(--border-medium);
        background: var(--bg-tertiary);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

    .option-btn.active {
        border-color: var(--accent-primary);
        background: var(--accent-light);
        color: var(--accent-primary);
        box-shadow: 0 0 0 3px rgba(91, 91, 255, 0.1);
        font-weight: 600;
    }

    .option-btn.disabled,
    .option-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
        background: var(--bg-secondary);
    }

    /* ---- INFO BAR ---- */
    .info-bar {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 1rem;
    }

    .info-chip {
        border: 1px solid var(--border-light);
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
        padding: 12px 14px;
        transition: all .2s ease;
    }

    .info-chip:hover {
        border-color: var(--border-medium);
        background: var(--bg-tertiary);
    }

    .info-chip-label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-tertiary);
        margin-bottom: 4px;
        font-weight: 500;
    }

    .info-chip-value {
        color: var(--text-primary);
        font-weight: 600;
        font-size: 14px;
    }

    /* ---- QTY ---- */
    .qty-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .qty-label-wrap {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .qty-label {

        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .qty-sub {
        font-size: 12px;
        color: var(--text-secondary);
    }

    .qty-box {
        display: inline-flex;
        align-items: center;
        gap: 14px;
    }

    .qty-btn {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 2px solid var(--border-medium);
        color: var(--accent-primary);
        background: var(--bg-secondary);
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        transition: all .15s ease;
    }

    .qty-btn:hover {
        border-color: var(--accent-primary);
        background: var(--accent-light);
    }

    .qty-value {
        min-width: 18px;
        text-align: center;
        font-weight: 600;
        font-size: 16px;
        color: var(--text-primary);
    }

    /* ---- SIDEBAR ---- */
    .sum-label {
        font-size: 12px;
        color: var(--text-tertiary);
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 500;
    }

    .sum-product {
        font-size: 14px;
        color: var(--text-primary);
        font-weight: 600;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    .sum-price {

        font-size: 1.8rem;
        font-weight: 700;
        color: var(--accent-primary);
        line-height: 1;
        margin-bottom: 12px;
    }

    .sum-meta {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 1rem;
        padding: 1rem;
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
    }

    .sum-meta-row {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        font-size: 13px;
    }

    .sum-meta-row span:first-child {
        color: var(--text-secondary);
    }

    .sum-meta-row span:last-child {
        color: var(--text-primary);
        font-weight: 500;
        text-align: right;
    }

    .selector-note {
        font-size: 12px;
        color: var(--text-secondary);
        line-height: 1.6;
        margin: 12px 0 14px;
        padding: 10px 12px;
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
        border-left: 3px solid var(--accent-primary);
    }

    .selector-error {
        display: none;
        margin: 0 0 12px;
        padding: 10px 12px;
        border-radius: var(--radius-sm);
        border: 1px solid rgba(239, 68, 68, 0.3);
        background: rgba(239, 68, 68, 0.05);
        color: #dc2626;
        font-size: 13px;
        border-left: 3px solid #dc2626;
    }

    .selector-actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 15px;
        font-weight: 600;
        border-radius: var(--radius-sm);
        background: var(--accent-primary);
        color: white;
        border: none;
        cursor: pointer;
        transition: all .2s ease;
        box-shadow: var(--shadow-sm);
    }

    .selector-actions .btn:hover {
        background: var(--accent-hover);
        box-shadow: 0 8px 16px var(--accent-hover);
        transform: translateY(-2px);
    }

    .extra-meta {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-light);
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 13px;
    }

    .extra-meta div {
        color: var(--text-secondary);
    }

    .extra-meta strong {
        color: var(--text-primary);
        font-weight: 600;
    }

    .hidden-form {
        display: none;
    }

    .detail-checkout-only {
        display: none !important;
    }

    /* ---- MODAL STYLES ---- */
    #orderModal {
        background: rgba(0, 0, 0, 0.3) !important;
        backdrop-filter: blur(4px) !important;
    }

    #orderModal>div {
        background: var(--bg-primary) !important;
        border: 1px solid var(--border-light) !important;
        box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1) !important;
    }

    #orderModal h3 {
        color: var(--text-primary) !important;
    }

    #orderModal input {
        background: var(--bg-secondary) !important;
        border: 1px solid var(--border-light) !important;
        color: var(--text-primary) !important;
    }

    #orderModal input:focus {
        outline: none;
        border-color: var(--accent-primary) !important;
        box-shadow: 0 0 0 3px var(--accent-light) !important;
    }

    #orderModal button[type="button"] {
        color: var(--text-secondary) !important;
    }

    #orderModal button[type="button"]:hover {
        color: var(--text-primary) !important;
    }

    /* ---- RESPONSIVE ---- */
    @media (max-width: 991px) {
        .selector-wrap {
            grid-template-columns: 1fr;
        }

        .selector-side {
            position: static;
        }

        .info-bar {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 640px) {
        .country-hero {
            align-items: flex-start;
            gap: 1rem;
        }

        .country-flag-big {
            font-size: 3.6rem;
        }

        .info-bar {
            grid-template-columns: 1fr 1fr;
        }

        .option-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .country-hero-name {
            font-size: 1.8rem;
        }

        .sum-price {
            font-size: 1.5rem;
        }
    }

    /* ---- COVERED COUNTRIES GRID ---- */
    .covered-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
        margin-top: 10px;
    }

    .covered-item {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 5px;
        border: 1px solid var(--border-light);
        border-radius: 10px;
        text-align: center;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .covered-item.active {
        border-color: var(--primary, #5b5bff);
        background: rgba(91, 91, 255, 0.08);
    }

    .covered-item:hover {
        border-color: var(--accent-primary);
        box-shadow: 0 2px 8px rgba(91, 91, 255, 0.08);
    }

    .covered-flag {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        object-fit: cover;
        border: 1px solid var(--border-light);
        flex-shrink: 0;
    }

    .covered-flag-fb {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-light);
        font-size: 11px;
        font-weight: 700;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .covered-name {
        font-size: 11px;
        font-weight: 500;
        color: var(--text-secondary);
        line-height: 1.3;
        word-break: break-word;
    }

    @media (max-width: 480px) {
        .covered-grid {
            grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        }
    }

    /* === SPEC GRID === */
    .spec-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        overflow: hidden;
        margin-top: 16px;
    }

    .spec-item {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
    }

    .spec-item:nth-child(even) {
        border-right: none;
    }

    .spec-item:nth-last-child(-n+2) {
        border-bottom: none;
    }

    .spec-item-wide {
        grid-column: 1 / -1;
        border-right: none;
    }

    .spec-item-wide:last-child {
        border-bottom: none;
    }

    .spec-icon {
        font-size: 20px;
        color: var(--text-secondary);
        flex-shrink: 0;
        margin-top: 1px;
    }

    .spec-body {
        min-width: 0;
    }

    .spec-label {
        font-size: 11px;
        color: var(--text-secondary);
        margin-bottom: 2px;
        white-space: nowrap;
    }

    .spec-value {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.4;
    }

    .spec-value.yes {
        color: #059669;
    }

    .spec-value.no {
        color: var(--text-secondary);
        font-weight: 400;
    }

    @media (max-width: 480px) {
        .spec-grid {
            grid-template-columns: 1fr;
        }

        .spec-item {
            border-right: none;
        }

        .spec-item:last-child {
            border-bottom: none;
        }
    }

    /* === MOBILE STICKY FOOTER (<=991px) === */
    #mobileFooterBar {
        display: none;
    }

    @media (max-width: 991px) {
        .selector-actions {
            display: none;
        }

        #mobileFooterBar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 900;
            background: var(--bg-primary);
            border-top: 1px solid var(--border-light);
            padding: 16px;
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }

        #mobileFooterBar .mob-price-wrap {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        #mobileFooterBar .mob-price-label {
            font-size: 11px;
            color: var(--text-secondary);
        }

        #mobileFooterBar .mob-price-val {
            font-size: 18px;
            font-weight: 700;
            color: var(--text-primary);
            white-space: nowrap;
        }

        #mobileFooterBar .mob-price-before {
            display: none;
            font-size: 12px;
            font-weight: 500;
            color: var(--text-tertiary);
            text-decoration: line-through;
            white-space: nowrap;
            line-height: 1.1;
        }

        #mobileFooterBar .mob-btn-wrap {
            display: flex;
            gap: 8px;
            flex-shrink: 0;
        }

        #mobDetailBtn {
            height: 44px;
            padding: 0 16px;
            border-radius: var(--radius-sm);
            border: 1.5px solid var(--border-light);
            background: var(--bg-primary);
            color: var(--text-primary);
            font: inherit;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            display: none;
        }

        #mobBookBtn {
            height: 44px;
            padding: 0 20px;
            border-radius: var(--radius-sm);
            border: none;
            background: var(--accent-primary, #5b5bff);
            color: #fff;
            font: inherit;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
        }

        #bookNowBtn:disabled,
        #mobBookBtn:disabled,
        #bookNowBtn.loading,
        #mobBookBtn.loading {
            opacity: .75;
            cursor: not-allowed !important;
        }

     

        #mobDetailDrawer {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 950;
        }

        #mobDetailDrawer.open {
            display: block;
        }

        #mobDetailOverlay {
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.4);
        }

        #mobDetailSheet {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--bg-primary);
            border-radius: 16px 16px 0 0;
            padding: 20px 16px 32px;
            max-height: 80vh;
            overflow-y: auto;
        }

        #mobDetailSheet .drawer-handle {
            width: 36px;
            height: 4px;
            background: var(--border-light);
            border-radius: 2px;
            margin: 0 auto 16px;
        }

        #mobDetailSheet .drawer-title {
            font-size: 15px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 4px;
        }

        #mobDetailSheet .drawer-price {
            font-size: 22px;
            font-weight: 700;
            color: var(--accent-primary, #5b5bff);
            margin-bottom: 16px;
        }
    }

    @media (max-width: 991px) {
        #mobileFooterBar {
            display: flex !important;
        }

        .selector-actions {
            display: none;
        }

   
    }
