/*
 Theme Name:   Woodmart Child Travel eSIM
 Description:  travelesim.ch child theme: everything from Woodmart Child (eSIM product cards, popups, one-eSIM cart rules) plus the Travel eSIM design: header, homepage, shop/category headings, footer and styling. Pieces can be switched off in Customize > Travel eSIM design.
 Author:       travelesim.ch
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
*/
.woocommerce-product-gallery__image img {
    width: 128px;
    height: 128px;
    object-fit: contain; /* Ensures the image maintains its aspect ratio */
}

/* Center price on product cards (shop, category, tag, archive) */
li.product span.price {
    display: block !important;
    text-align: center !important;
}

/* eSIM attribute rows on product cards */
.esim-loop-attributes {
    width: 100%;
    margin: 6px 0 6px;
    font-size: 12px;
    line-height: 1.4;
    border-collapse: collapse;
    table-layout: fixed;
}
.esim-loop-attributes tr {
    border-bottom: 1px solid #f0f0f0;
}
.esim-loop-attributes tr:last-child {
    border-bottom: none;
}
.esim-attr-label {
    color: #888;
    padding: 3px 6px 3px 0;
    width: 42%;
    vertical-align: middle;
}
.esim-attr-value {
    color: #333;
    text-align: right;
    font-weight: 500;
    padding: 3px 0;
    vertical-align: middle;
}

/* Equal-height product cards.
   li.product is a grid item (Woodmart CSS Grid); making it a flex column lets
   .product-wrapper use flex:1 to genuinely fill the row height instead of relying
   on height:100% which doesn't propagate reliably in grid contexts. */
.products li.product {
    display: flex !important;
    flex-direction: column !important;
}
.products li.product .product-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}
/* Absorb all leftover vertical space above VIEW PLAN so the button pair
   (VIEW PLAN + ACHETER) is always pinned to the card bottom */
.products li.product div.esim-view-plan-btn {
    margin-top: auto !important;
}

/* "View Plan" button — output as <div> so Woodmart's <a> rules cannot interfere */
div.esim-view-plan-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 1.5px solid #c8a008;
    border-radius: 5px;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #c8a008;
    margin: 8px 0 4px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}
div.esim-view-plan-btn:hover {
    background: #c8a008;
    color: #fff;
}

/* Modal overlay */
.esim-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.esim-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 480px;
    width: 100%;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}
/* Only the body scrolls; header and footer stay fixed */
.esim-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.esim-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    z-index: 1;
    padding: 0;
    font-family: inherit;
}
.esim-modal-close:hover { color: #333; }

/* Modal header */
.esim-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid #eee;
}
.esim-modal-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f5f5f5;
}
.esim-modal-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.3;
}
.esim-modal-price {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    text-align: center;
}

/* Modal attribute table */
.esim-modal-body { padding: 10px 20px; }
.esim-val-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    color: #c8a008;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
}
.esim-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.esim-modal-table tr { border-bottom: 1px solid #f0f0f0; }
.esim-modal-table tr:last-child { border-bottom: none; }
.esim-modal-table th {
    text-align: left;
    font-weight: normal;
    color: #888;
    padding: 7px 8px 7px 0;
    width: 38%;
    vertical-align: top;
}
.esim-modal-table td {
    text-align: right;
    color: #222;
    padding: 7px 0 7px 8px;
    font-weight: 500;
}

/* Modal footer */
.esim-modal-footer {
    padding: 14px 20px 20px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.esim-modal-buy {
    display: block;
    background: #c8a008;
    color: #fff !important;
    text-align: center;
    padding: 13px;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none !important;
    font-size: 15px;
    letter-spacing: 0.03em;
    transition: background 0.15s;
}
.esim-modal-buy:hover { background: #a88000; }
.esim-modal-details {
    text-align: center;
    color: #777;
    font-size: 12px;
    text-decoration: underline;
}
/* Single product attributes table: muted label / dark value, matching card style */
.shop_attributes.woocommerce-product-attributes {
    width: 100%;
    border-collapse: collapse;
}
.shop_attributes .woocommerce-product-attributes-item {
    border-bottom: 1px solid #f0f0f0 !important;
    background: none !important;
}
.shop_attributes .woocommerce-product-attributes-item:last-child {
    border-bottom: none !important;
}
.shop_attributes .woocommerce-product-attributes-item__label {
    color: #333 !important;
    font-weight: bold !important;
    padding: 8px 16px 8px 0 !important;
    width: 38%;
    vertical-align: top;
    border: none !important;
}
.shop_attributes .woocommerce-product-attributes-item__value {
    color: #555 !important;
    font-weight: normal !important;
    padding: 8px 0 !important;
    vertical-align: top;
    border: none !important;
}
.shop_attributes .woocommerce-product-attributes-item__value p {
    margin: 0;
}

@media (max-width: 768px) {
    .shop_attributes .woocommerce-product-attributes-item__label {
        color: #333 !important;
        font-weight: bold !important;
    }
    .shop_attributes .woocommerce-product-attributes-item__value {
        color: #555 !important;
        font-weight: normal !important;
    }
}
@media (max-width: 520px) {
    .esim-modal-overlay { padding: 0; align-items: flex-end; }
    .esim-modal {
        border-radius: 16px 16px 0 0;
        max-width: 100%;
        max-height: 85vh;
    }
    .esim-modal-header { padding: 16px 16px 12px; gap: 12px; }
    .esim-modal-img { width: 64px; height: 64px; }
    .esim-modal-title { font-size: 14px; }
    .esim-modal-price { font-size: 17px; }
    .esim-modal-body { padding: 8px 16px; }
    .esim-modal-table th, .esim-modal-table td { font-size: 12px; padding: 6px 0; }
    .esim-modal-footer { padding: 12px 16px 24px; }
}
