/*
 * Styling for the .ttpc-* offer-widget markup. This class family and its
 * CSS both originate in the tt-price-compare plugin's
 * ttpc_widget_css() (inline-injected only when that plugin is active) —
 * but shortcode-product-template.php's "Custom Feed" fallback here also
 * emits .ttpc-* markup independently of whether price-compare is active,
 * so the styling needs its own copy that doesn't depend on that plugin's
 * activation state. Kept in sync by hand with ttpc_widget_css() in
 * tt-price-compare/includes/class-shortcode.php if that changes.
 */
.ttpc-widget {
    font-family: inherit;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    margin: 20px 0;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: ttpcwidget;
}
.ttpc-mobile-merchant { display: none; }
.ttpc-mobile-stars   { display: none; }
.ttpc-mobile-stock   { display: none; }
.ttpc-mobile-stock--in  { color: #15803d; }
.ttpc-mobile-stock--out { color: #dc2626; }
.ttpc-no-results {
    padding: 14px 16px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}
/* ── Top bar ── */
.ttpc-widget-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f3f4f6;
}
.ttpc-savings-header {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #15803d;
    font-weight: 600;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.ttpc-sort-wrap {
    /* Removed per request — the list already defaults to price-ascending,
       which is what most visitors want. */
    display: none !important;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ttpc-sort-label {
    font-size: 12px;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
}
/* ── Sort select (mobile only, inside .ttpc-sort-wrap) ── */
.ttpc-sort-select {
    display: none;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
}
/* ── Sort tabs ── */
.ttpc-sort-tabs {
    display: flex;
    gap: 2px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
    flex-shrink: 0;
}
.ttpc-sort-tab {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    border: none;
    background: transparent;
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}
.ttpc-sort-tab--active {
    background: #fff;
    color: #111827;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
/* ── Offers list ── */
.ttpc-offers {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.ttpc-offer {
    position: relative;
    border-bottom: 1px solid #f3f4f6;
    margin: 0 !important;
    padding: 0 !important;
}
.ttpc-offer:last-child { border-bottom: none; }
.ttpc-offer.ttpc-hidden { display: none !important; }
.ttpc-offer-link {
    position: absolute !important;
    inset: 0;
    z-index: 0;
    display: block !important;
    text-decoration: none !important;
}
.ttpc-offer:hover { background: #fafafa; }
.ttpc-offer-row {
    position: relative;
    z-index: 1;
    display: grid !important;
    grid-template-columns: 48px minmax(90px, 1fr) minmax(90px, 160px) 140px auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    box-sizing: border-box;
    pointer-events: none;
}
.ttpc-offer-row a,
.ttpc-offer-row .ttpc-cta,
.ttpc-offer-row .ttpc-restore-btn {
    pointer-events: auto;
    position: relative;
    z-index: 2;
}
/* ── Icon column ── */
.ttpc-col-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ttpc-favicon-circle {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.ttpc-favicon-circle img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
}
.ttpc-favicon-fallback {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #0f766e;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
/* ── Merchant column ── */
.ttpc-col-merchant { min-width: 0; }
.ttpc-merchant-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ttpc-merchant-name {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
@media (max-width: 600px) {
    .ttpc-merchant-name { max-width: 110px; }
}
.ttpc-inline-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.ttpc-inline-badge--cheapest { background: #ccfbf1; color: #0f766e; }
.ttpc-inline-badge--rated    { background: #fef9c3; color: #854d0e; }
.ttpc-merchant-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}
.ttpc-stars-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none !important;
    position: relative;
    z-index: 2;
}
.ttpc-stars { color: #f59e0b; font-size: 11px; letter-spacing: -0.5px; }
.ttpc-stars-score { font-size: 11px; font-weight: 600; color: #374151; }
.ttpc-stars-count { font-size: 10px; color: #9ca3af; }
/* ── Price column ── */
.ttpc-col-price { min-width: 100px; }
.ttpc-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.ttpc-price {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}
.ttpc-price--best { color: #15803d; }
.ttpc-orig {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    text-decoration: line-through;
    white-space: nowrap;
    margin-top: 2px;
}
.ttpc-discount-badge {
    font-size: 11px;
    font-weight: 700;
    color: #dc2626;
    background: #fee2e2;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}
/* ── Meta column (shipping + stock) ── */
.ttpc-col-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.ttpc-shipping-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
}
.ttpc-shipping-row svg { flex-shrink: 0; color: #6b7280; }
.ttpc-delivery-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}
.ttpc-delivery-row svg { flex-shrink: 0; color: #9ca3af; }
.ttpc-stock-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
}
.ttpc-stock-row--in  { color: #15803d; }
.ttpc-stock-row--out { color: #dc2626; }
@container ttpcwidget (max-width: 540px) {
    .ttpc-offer-row {
        grid-template-columns: 40px minmax(90px, 1fr) 110px auto;
        gap: 8px;
    }
    .ttpc-col-meta { display: none; }
}
/* ── CTA ── */
.ttpc-col-cta { display: flex; align-items: center; }
.ttpc-cta {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    background: #f97316;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 8px;
    white-space: nowrap;
    letter-spacing: .3px;
    text-decoration: none !important;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
}
.ttpc-cta:hover { background: #ea6c0a; }
.ttpc-cta--shake { animation: ttpc-shake 5s linear infinite; }
@keyframes ttpc-shake {
    0%, 100%, 89% { transform: translate3d(0, 0, 0); }
    90%, 94%, 98% { transform: translate3d(-5px, 0, 0); }
    92%, 96%      { transform: translate3d(5px, 0, 0); }
}
/* ── Footer ── */
.ttpc-widget-footer {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 16px;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
}
.ttpc-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    background: #fff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 20px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.06) !important;
    padding: 6px 14px !important;
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    cursor: pointer;
    text-decoration: none !important;
    line-height: 1.4;
    transition: all .15s ease;
}
.ttpc-toggle:hover {
    background: #f9fafb !important;
    border-color: #9ca3af !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.1) !important;
    color: #111827 !important;
    text-decoration: none !important;
}
.ttpc-toggle-arrow { flex-shrink: 0; color: #6b7280; }
.ttpc-updated {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    text-align: right;
}
.ttpc-full-panel-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
}
.ttpc-full-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}
@media (max-width: 768px) {
    .ttpc-full-panel { display: none !important; }
}
@media (max-width: 600px) {
    .ttpc-sort-label { display: none; }
    .ttpc-sort-tabs { display: none; }
    .ttpc-sort-select { display: inline-block; }
    .ttpc-widget-top { padding: 8px 12px; flex-wrap: wrap; row-gap: 6px; }
    .ttpc-sort-wrap { flex-basis: 100%; justify-content: flex-end; }
    /* Kept in sync with the matching mobile block in tt-price-compare's
       class-shortcode.php (ttpc_widget_css()) — see that file's own comment
       for why this duplicate exists. */
    .ttpc-widget-footer {
        flex-direction: column-reverse;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
    }
    .ttpc-updated { width: 100%; white-space: normal; text-align: center; line-height: 1.3; }
    .ttpc-offer-row { grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 8px; padding: 10px 12px; }
    .ttpc-col-merchant { display: none; }
    .ttpc-col-meta { display: flex; gap: 1px; overflow: hidden; }
    .ttpc-mobile-merchant { display: block; font-size: 13px; font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
    .ttpc-mobile-stars { display: flex; align-items: center; font-size: 11px; margin-bottom: 2px; }
    /* Removed per request — mobile rows show just the shop name now, no
       shipping/delivery/stock detail line underneath it. */
    .ttpc-col-meta .ttpc-shipping-row { display: none; }
    .ttpc-col-meta .ttpc-stock-row { display: none; }
    .ttpc-col-meta .ttpc-delivery-row { display: none; }
    .ttpc-col-price { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
    .ttpc-price-row { justify-content: flex-end; }
    .ttpc-orig { text-align: right; }
    .ttpc-price { font-size: 14px; }
    /* Text button (was an icon-only round cart button) — compact, wraps to
       two lines so the label fits next to the merchant + price. */
    .ttpc-cta { padding: 8px 10px; font-size: 14px; line-height: 1.2; letter-spacing: .2px; text-align: center; white-space: normal; justify-content: center; }
    .ttpc-cta svg { flex-shrink: 0; }
    .ttpc-cta-text { max-width: 92px; }
    .ttpc-savings-header { font-size: 11px; }
    .ttpc-offer-admin-bar:not(.ttpc-offer-admin-bar--removed) > span { display: none; }
    .ttpc-offer-admin-bar:not(.ttpc-offer-admin-bar--removed) { justify-content: flex-end; padding: 2px 8px; }
    .ttpc-offer-admin-bar--removed { padding: 2px 8px; font-size: 10px; }
    .ttpc-remove-offer { font-size: 10px; padding: 2px 6px; }
    .ttpc-admin-toolbar { padding: 6px 8px; flex-wrap: wrap; gap: 4px; }
    .ttpc-admin-label { display: none; }
    .ttpc-full-panel-header { padding: 8px 12px; }
    .ttpc-full-panel-title { font-size: 13px; }
}
@media (max-width: 380px) {
    .ttpc-offer-row { grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 4px; padding: 8px 10px; }
    .ttpc-shipping-row svg { display: none; }
}
/* ── Compset admin ── */
.ttpc-offer-admin-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    font-size: 11px;
    color: #6b7280;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}
.ttpc-admin-bars-hidden .ttpc-offer-admin-bar:not(.ttpc-offer-admin-bar--removed) { display: none !important; }
.ttpc-offer-admin-bar--removed { background: #fff1f2; color: #be123c; }
.ttpc-offer--removed { background: #fff7f7; opacity: .75; }
.ttpc-offers--removed.ttpc-removed-hidden { display: none !important; }
.ttpc-offer-admin-actions { display: flex; align-items: center; gap: 4px; }
.ttpc-move-offer {
    font-size: 11px; font-weight: 700; line-height: 1; border: 1px solid #d1d5db;
    background: #fff; color: #374151; cursor: pointer;
    width: 20px; height: 20px; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
}
.ttpc-move-offer:hover { background: #f3f4f6; border-color: #9ca3af; }
.ttpc-remove-offer {
    font-size: 11px; font-weight: 600; border: none; background: none;
    cursor: pointer; padding: 1px 4px; border-radius: 4px;
    color: #dc2626; text-decoration: underline;
}
.ttpc-remove-offer:hover { background: #fee2e2; }
.ttpc-restore-btn {
    font-size: 12px; font-weight: 600; border: 1px solid #bbf7d0;
    background: #dcfce7; color: #15803d; cursor: pointer;
    padding: 6px 12px; border-radius: 8px;
}
.ttpc-restore-btn:hover { background: #bbf7d0; }
.ttpc-admin-toolbar {
    display: flex;
    align-items: center;
    padding: 7px 16px;
    background: #f0f9ff;
    border-top: 1px solid #bae6fd;
    font-size: 12px;
}
.ttpc-admin-left { display: flex; align-items: center; gap: 10px; }
.ttpc-admin-label { font-weight: 700; color: #0284c7; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.ttpc-refresh-cache,
.ttpc-toggle-removed,
.ttpc-toggle-admin-bars {
    font-size: 11px; font-weight: 600; border: 1px solid #bae6fd;
    background: #fff; color: #0369a1; cursor: pointer;
    padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.ttpc-refresh-cache:hover,
.ttpc-toggle-removed:hover { background: #e0f2fe; }
.ttpc-toggle-admin-bars {
    background: #0369a1; color: #fff; border-color: #0369a1;
}
.ttpc-toggle-admin-bars:hover { background: #0284c7; border-color: #0284c7; }
