/*
 * Shortcodes Styles for The Sim Offers Core
 * Brand Matched: Navy Dark #08183A, Electric Blue #0066FF, Chip Gold #F59E0B
 * Logo inline with title. Specs in 2-column grid.
 * Table keeps its layout on mobile with horizontal scroll.
 */

/* =========================================================
   1. PLAN GRID
   ========================================================= */
.tso-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin: 28px 0;
}

/* =========================================================
   2. PREMIUM PLAN CARD
   ========================================================= */
.tso-plan-card {
    position: relative;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px 22px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(8, 24, 58, 0.04);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1),
                box-shadow .3s ease,
                border-color .3s ease;
}

.tso-plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0066ff 0%, #0052cc 50%, #f59e0b 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s ease;
    z-index: 2;
}

.tso-plan-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -12px rgba(8, 24, 58, 0.15),
                0 4px 12px rgba(8, 24, 58, 0.06);
    border-color: #bfdbfe;
}

.tso-plan-card:hover::before {
    transform: scaleX(1);
}

.tso-plan-card.has-discount {
    border-color: #fecaca;
}

/* =========================================================
   3. SALE RIBBON
   ========================================================= */
.tso-plan-card .tso-sale-ribbon {
    position: absolute;
    top: 14px;
    right: -34px;
    transform: rotate(45deg);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 5px 42px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    z-index: 3;
}

/* =========================================================
   4. TITLE ROW — Logo + Title inline
   ========================================================= */
.tso-card-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.tso-operator-logo-inline {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 3px;
    flex-shrink: 0;
    display: block;
    margin-top: 2px;
    transition: transform .25s ease, box-shadow .25s ease;
}

.tso-plan-card:hover .tso-operator-logo-inline {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(0, 102, 255, 0.18);
}

.tso-operator-logo-inline-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
    color: #ffffff;
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* =========================================================
   5. CARD TITLE
   ========================================================= */
.tso-card-title-row .tso-card-title {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    line-height: 1.4;
    margin: 0;
    font-weight: 700;
    padding-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tso-card-title-row .tso-card-title a {
    color: #08183a;
    text-decoration: none;
    transition: color .2s ease;
}

.tso-card-title-row .tso-card-title a:hover {
    color: #0066ff;
}

/* =========================================================
   6. PRICE BLOCK
   ========================================================= */
.tso-card-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px dashed #e2e8f0;
}

.tso-price-amount {
    font-size: 1.85rem;
    font-weight: 800;
    color: #08183a;
    font-family: 'Poppins', 'Inter', sans-serif;
    line-height: 1;
    letter-spacing: -0.02em;
}

.tso-price-old {
    font-size: 1rem;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 500;
}

.tso-plan-card.has-discount .tso-price-amount {
    color: #dc2626;
}

.tso-savings-badge {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-left: auto;
}

/* =========================================================
   7. SPECS LIST — 2-COLUMN GRID
   ========================================================= */
.tso-card-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    row-gap: 0;
    margin-bottom: 18px;
    flex: 1;
    align-content: start;
}

.tso-spec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
    min-width: 0;
}

.tso-card-specs > .tso-spec-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.tso-spec-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 7px;
    color: #0066ff;
    font-size: 12px;
    flex-shrink: 0;
}

.tso-spec-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.tso-spec-value {
    font-weight: 700;
    color: #08183a;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tso-spec-label {
    font-size: 10.5px;
    color: #64748b;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tso-spec-item.spec-validity .tso-spec-icon { background: #ede9fe; color: #7c3aed; }
.tso-spec-item.spec-data .tso-spec-icon { background: #ecfdf5; color: #059669; }
.tso-spec-item.spec-calls .tso-spec-icon { background: #eff6ff; color: #2563eb; }
.tso-spec-item.spec-onnet .tso-spec-icon { background: #fef3c7; color: #d97706; }
.tso-spec-item.spec-offnet .tso-spec-icon { background: #fef2f2; color: #dc2626; }
.tso-spec-item.spec-social .tso-spec-icon { background: #fce7f3; color: #db2777; }
.tso-spec-item.spec-sms .tso-spec-icon { background: #e0f2fe; color: #0284c7; }
.tso-spec-item.spec-intl .tso-spec-icon { background: #f0fdf4; color: #16a34a; }

/* =========================================================
   8. ACTION BUTTONS
   ========================================================= */
.tso-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.tso-btn-view {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #08183a;
    color: #ffffff !important;
    text-align: center;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none !important;
    transition: all .25s ease;
    border: none;
    cursor: pointer;
}

.tso-btn-view:hover {
    background: #0066ff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(0, 102, 255, 0.4);
}

.tso-btn-code {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .25s ease;
    font-size: 14px;
    flex-shrink: 0;
    padding: 0;
}

.tso-btn-code:hover {
    background: #0066ff;
    color: #fff;
    border-color: #0066ff;
    transform: translateY(-1px);
}

/* =========================================================
   9. TABLE VIEW
   ========================================================= */
.tso-table-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin: 24px 0;
    box-shadow: 0 4px 12px rgba(8, 24, 58, 0.04);
    overflow: hidden;
    max-width: 100%;
}

.tso-table-controls {
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tso-table-search {
    width: 100%;
    max-width: 340px;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color .2s ease;
    background: #fff;
    color: #0f172a;
    box-sizing: border-box;
}

.tso-table-search:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.tso-table-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.tso-table-scroll::-webkit-scrollbar {
    height: 8px;
}
.tso-table-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.tso-table-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.tso-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- The Table itself --- */
table.tso-plan-table,
.tso-table-wrapper table.tso-plan-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px;
    text-align: left;
    table-layout: auto;
    margin: 0;
    background: #ffffff;
}

table.tso-plan-table th,
table.tso-plan-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
    color: #334155;
    font-size: 14px;
    line-height: 1.4;
    display: table-cell;
    visibility: visible;
    opacity: 1;
}

table.tso-plan-table th {
    background: #f8fafc;
    color: #08183a;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}

table.tso-plan-table tbody tr:last-child td {
    border-bottom: none;
}

table.tso-plan-table tbody tr:hover td {
    background: #f8fafc;
}

/* --- Column widths --- */
.tso-plan-table .tso-th-operator,
.tso-plan-table .tso-col-operator {
    min-width: 150px;
    width: 150px;
}

.tso-plan-table .tso-th-title,
.tso-plan-table .tso-col-title {
    min-width: 200px;
    max-width: 300px;
    white-space: normal;
    word-wrap: break-word;
}

.tso-plan-table .tso-th-price,
.tso-plan-table .tso-col-price {
    min-width: 110px;
    width: 110px;
    white-space: nowrap;
}

.tso-plan-table .tso-th-data,
.tso-plan-table .tso-col-data {
    min-width: 100px;
    width: 100px;
    white-space: nowrap;
}

.tso-plan-table .tso-th-calls,
.tso-plan-table .tso-col-calls {
    min-width: 140px;
    width: 140px;
    white-space: nowrap;
}

.tso-plan-table .tso-th-validity,
.tso-plan-table .tso-col-validity {
    min-width: 100px;
    width: 100px;
    white-space: nowrap;
}

.tso-plan-table .tso-th-action,
.tso-plan-table .tso-col-action {
    min-width: 80px;
    width: 80px;
    white-space: nowrap;
    text-align: right;
}

/* --- Cell content --- */
.tso-plan-table .tso-col-data .tso-table-value,
.tso-plan-table .tso-col-calls .tso-table-value,
.tso-plan-table .tso-col-validity .tso-table-value {
    display: inline-block;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    visibility: visible;
    opacity: 1;
}

.tso-plan-table .tso-table-normal-price,
.tso-plan-table .tso-table-discount-price {
    color: #0066ff;
    font-weight: 800;
    font-size: 14px;
    display: inline-block;
}

.tso-plan-table .tso-table-discount-price {
    color: #ef4444;
}

.tso-plan-table .tso-table-old-price {
    color: #94a3b8;
    font-size: 11px;
    display: block;
    text-decoration: line-through;
    font-weight: 500;
    margin-bottom: 2px;
}

/* --- Operator cell --- */
.tso-plan-table .tso-table-operator {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    vertical-align: middle;
}

.tso-plan-table .tso-table-operator-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px;
    flex-shrink: 0;
    display: block;
}

.tso-plan-table .tso-table-operator-name {
    font-size: 13px;
    font-weight: 700;
    color: #08183a;
    line-height: 1.2;
    display: inline-block;
}

/* --- Package title --- */
.tso-plan-table .tso-col-title a {
    color: #08183a;
    text-decoration: none;
    font-weight: 600;
    display: inline;
}

.tso-plan-table .tso-col-title a:hover {
    color: #0066ff;
}

.tso-plan-table .tso-table-sale-tag {
    background: #ef4444;
    color: #ffffff;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: 700;
    letter-spacing: .4px;
    display: inline-block;
    white-space: nowrap;
}

/* --- Action button --- */
.tso-plan-table .tso-btn-sm {
    display: inline-block;
    padding: 7px 14px;
    background: #08183a;
    color: #fff !important;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none !important;
    transition: background .2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.tso-plan-table .tso-btn-sm:hover {
    background: #0066ff;
    color: #fff !important;
}

/* =========================================================
   10. SINGLE DETAILS TABLE
   ========================================================= */
.tso-details-table-wrap {
    margin: 24px 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.tso-details-table {
    width: 100%;
    border-collapse: collapse;
}

.tso-details-table th,
.tso-details-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.tso-details-table th {
    background: #08183a;
    color: #fff;
    font-size: 15px;
    text-align: left;
}

.tso-details-table td:first-child {
    width: 35%;
    background: #f8fafc;
    color: #334155;
}

.tso-details-table code {
    background: #e0edff;
    color: #0066ff;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
}

/* =========================================================
   11. RESPONSIVE — Grid Cards (mobile)
   ========================================================= */
@media (max-width: 600px) {
    .tso-plans-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .tso-plan-card {
        padding: 18px 16px;
    }
    .tso-price-amount {
        font-size: 1.65rem;
    }
    .tso-card-title-row .tso-card-title {
        font-size: 1rem;
    }
    .tso-plan-card .tso-sale-ribbon {
        top: 12px;
        right: -36px;
        font-size: 9px;
        padding: 4px 44px;
    }
    .tso-operator-logo-inline,
    .tso-operator-logo-inline-fallback {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    .tso-card-specs {
        column-gap: 10px;
    }
    .tso-spec-icon {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    .tso-spec-value {
        font-size: 12.5px;
    }
    .tso-spec-label {
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .tso-card-specs {
        grid-template-columns: 1fr;
    }
    .tso-card-specs > .tso-spec-item {
        border-bottom: 1px solid #f1f5f9;
    }
    .tso-card-specs > .tso-spec-item:last-child {
        border-bottom: none;
    }
}

/* =========================================================
   12. RESPONSIVE — Table stays as table on mobile
   Compact layout: logo only, truncated title, tight padding.
   ========================================================= */
@media (max-width: 768px) {
    .tso-table-wrapper {
        border-radius: 10px;
        margin: 14px 0;
    }

    .tso-table-controls {
        padding: 10px 12px;
    }

    .tso-table-search {
        max-width: 100%;
        font-size: 13px;
        padding: 9px 12px;
    }

    /* Table scrolls horizontally — stays as table */
    .tso-table-scroll {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    /* Reduce overall table min-width so more fits on screen */
    table.tso-plan-table,
    .tso-table-wrapper table.tso-plan-table {
        min-width: 620px;
    }

    /* Tighter cell padding */
    table.tso-plan-table th,
    table.tso-plan-table td {
        padding: 8px 9px;
        font-size: 12px;
        line-height: 1.25;
    }

    table.tso-plan-table th {
        font-size: 10px;
        letter-spacing: .3px;
        padding: 8px 9px;
    }

    /* ---- Operator column: LOGO ONLY, hide name ---- */
    .tso-plan-table .tso-th-operator,
    .tso-plan-table .tso-col-operator {
        min-width: 56px;
        width: 56px;
        text-align: center;
        padding: 8px 4px;
    }

    .tso-plan-table .tso-table-operator {
        justify-content: center;
        gap: 0;
    }

    .tso-plan-table .tso-table-operator-name {
        display: none !important;
    }

    .tso-plan-table .tso-table-operator-logo {
        width: 32px;
        height: 32px;
        margin: 0 auto;
    }

    /* Header "Network" label shortened */
    .tso-plan-table .tso-th-operator {
        font-size: 0;
    }
    .tso-plan-table .tso-th-operator::after {
        content: 'Net';
        font-size: 10px;
    }

    /* ---- Package title: TRUNCATE to 2 lines ---- */
    .tso-plan-table .tso-th-title,
    .tso-plan-table .tso-col-title {
        min-width: 120px;
        max-width: 140px;
        width: 140px;
        white-space: normal;
        padding: 8px 9px;
    }

    .tso-plan-table .tso-col-title a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 12px;
        line-height: 1.3;
        font-weight: 600;
        word-break: break-word;
    }

    .tso-plan-table .tso-table-sale-tag {
        font-size: 8px;
        padding: 1px 4px;
        margin-left: 3px;
    }

    /* ---- Price column: compact ---- */
    .tso-plan-table .tso-th-price,
    .tso-plan-table .tso-col-price {
        min-width: 72px;
        width: 72px;
        padding: 8px 6px;
    }

    .tso-plan-table .tso-table-normal-price,
    .tso-plan-table .tso-table-discount-price {
        font-size: 12px;
    }

    .tso-plan-table .tso-table-old-price {
        font-size: 9.5px;
    }

    /* ---- Data column: compact ---- */
    .tso-plan-table .tso-th-data,
    .tso-plan-table .tso-col-data {
        min-width: 66px;
        width: 66px;
        padding: 8px 6px;
    }

    .tso-plan-table .tso-col-data .tso-table-value {
        font-size: 11.5px;
        font-weight: 600;
    }

    /* ---- Calls column: compact ---- */
    .tso-plan-table .tso-th-calls,
    .tso-plan-table .tso-col-calls {
        min-width: 100px;
        width: 100px;
        padding: 8px 8px;
        white-space: normal;
    }

    .tso-plan-table .tso-col-calls .tso-table-value {
        font-size: 11px;
        font-weight: 600;
        line-height: 1.25;
        display: block;
        white-space: normal;
        word-break: break-word;
    }

    /* ---- Validity column: compact ---- */
    .tso-plan-table .tso-th-validity,
    .tso-plan-table .tso-col-validity {
        min-width: 62px;
        width: 62px;
        padding: 8px 6px;
    }

    .tso-plan-table .tso-col-validity .tso-table-value {
        font-size: 11.5px;
        font-weight: 600;
    }

    /* ---- Action column: small button ---- */
    .tso-plan-table .tso-th-action,
    .tso-plan-table .tso-col-action {
        min-width: 60px;
        width: 60px;
        padding: 8px 6px;
        text-align: center;
    }

    .tso-plan-table .tso-btn-sm {
        padding: 5px 9px;
        font-size: 10.5px;
        border-radius: 5px;
    }
}