/* ════════════════════════════════════════
   Trinket Cart — Public Shop
   Mobile-first, desktop enhanced
════════════════════════════════════════ */

#tc-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
}

/* Prevent iOS Safari double-tap zoom on interactive elements */
#tc-wrap button,
#tc-wrap a,
#tc-wrap input,
#tc-wrap .tc-product-card,
#tc-wrap .tc-card-thumb-wrap {
    touch-action: manipulation;
}

/* ── Shop header ── */
#tc-shop-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.tc-section-title {
    font-size: 1.6em;
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}
#tc-category-controls {
    display: flex;
    gap: 8px;
}
.tc-ctrl-btn {
    padding: 5px 12px;
    font-size: .8em;
    border: 1px solid rgba(128,128,128,.4);
    border-radius: 20px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: .75;
    transition: opacity .15s;
}
.tc-ctrl-btn:hover { opacity: 1; }

/* ── Search ── */
#tc-search-wrap {
    position: relative;
    margin-bottom: 20px;
    max-width: 480px;
}
#tc-search-input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1px solid rgba(128,128,128,.4);
    border-radius: 8px;
    font-size: .95em;
    box-sizing: border-box;
    background: transparent;
    color: inherit;
    transition: border-color .2s;
}
#tc-search-input:focus { outline: none; border-color: #3a6bbf; }
#tc-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: .9em;
    color: inherit;
    opacity: .5;
    cursor: pointer;
    display: none;
    padding: 4px;
}
#tc-search-clear:hover { opacity: 1; }
#tc-search-results { margin-bottom: 24px; }
.tc-search-heading { font-size: .95em; font-weight: 700; margin: 0 0 12px; opacity: .7; }
.tc-search-empty   { opacity: .6; font-style: italic; }

/* ════════════════════════════════════════
   CATEGORY SECTIONS
════════════════════════════════════════ */
.tc-category-section {
    border: 1px solid rgba(128,128,128,.2);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.tc-category-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
}

.tc-cat-name {
    font-size: 1.5em;
    font-weight: 700;
    flex: 1;
}
.tc-cat-count {
    font-size: 1.2em;
    opacity: .55;
    white-space: nowrap;
}

.tc-category-body {
    padding: 0 14px 14px;
}

/* ════════════════════════════════════════
   PRODUCT GRID — 1 col mobile, 3 col desktop
════════════════════════════════════════ */
.tc-product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 8px;
}

@media ( min-width: 680px ) {
    .tc-product-grid {
        grid-template-columns: repeat( 2, 1fr );
    }
}

@media ( min-width: 1000px ) {
    .tc-product-grid {
        grid-template-columns: repeat( 3, 1fr );
    }
}

/* ── Product card — vertical stack ── */
.tc-product-card {
    border: 1px solid rgba(128,128,128,.2);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(128,128,128,.06);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    cursor: default;
}
.tc-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* Thumbnail — full width top of card, clickable */
.tc-card-thumb-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: rgba(128,128,128,.06);
}
.tc-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform .25s, opacity .15s;
}
.tc-card-thumb-wrap:hover .tc-card-thumb {
    transform: scale(1.03);
    opacity: .9;
}
.tc-card-thumb.tc-no-img {
    background: rgba(128,128,128,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75em;
    opacity: .5;
    height: 100%;
}

/* Card body — below image */
.tc-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.tc-card-name {
    background: none;
    border: none;
    color: inherit;
    font-weight: 700;
    font-size: 1em;
    cursor: pointer;
    padding: 0;
    text-align: left;
    line-height: 1.3;
    transition: opacity .15s;
}
.tc-card-name:hover { opacity: .75; }

.tc-card-price {
    font-weight: 700;
    font-size: 1em;
    color: #4caf78;
    margin: 0;
}

/* Qty + Add to Cart side by side at bottom of card */
.tc-card-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}
.tc-card-controls .tc-add-btn {
    flex: 1;
}

/* ── Qty stepper (shared) ── */
.tc-qty-stepper {
    display: flex;
    align-items: center;
    border: 1px solid rgba(128,128,128,.4);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.tc-qty-btn {
    width: 30px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    color: inherit;
    transition: background .15s;
    flex-shrink: 0;
    line-height: 1;
}
.tc-qty-btn:hover  { background: rgba(128,128,128,.15); }
.tc-qty-btn:active { background: rgba(128,128,128,.25); }
.tc-qty {
    width: 36px;
    height: 32px;
    border: none;
    border-left: 1px solid rgba(128,128,128,.3);
    border-right: 1px solid rgba(128,128,128,.3);
    text-align: center;
    font-size: .85em;
    background: transparent;
    color: inherit;
    -moz-appearance: textfield;
}
.tc-qty::-webkit-inner-spin-button,
.tc-qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Add to Cart button ── */
.tc-add-btn {
    padding: 7px 14px;
    background: #3a6bbf;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .82em;
    font-weight: 600;
    white-space: nowrap;
    transition: background .2s;
    flex-shrink: 0;
}
.tc-add-btn:hover { background: #2d57a0; }

/* ════════════════════════════════════════
   PRODUCT MODAL
════════════════════════════════════════ */
#tc-modal {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
#tc-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.75);
    cursor: pointer;
}
#tc-modal-box {
    position: relative;
    z-index: 1;
    background: #1a1a1a;
    color: #f0f0f0;
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

@media ( min-width: 600px ) {
    #tc-modal-box { flex-direction: row; }
}

#tc-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: .9em;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
#tc-modal-close:hover { background: rgba(255,255,255,.3); }

/* Gallery side */
#tc-modal-gallery {
    flex-shrink: 0;
    width: 100%;
    background: #111;
    border-radius: 12px 12px 0 0;
}
@media ( min-width: 600px ) {
    #tc-modal-gallery {
        width: 280px;
        border-radius: 12px 0 0 12px;
    }
}

#tc-modal-img {
    width: 100%;
    height: 240px;
    object-fit: contain;
    display: block;
    border-radius: 12px 12px 0 0;
}
@media ( min-width: 600px ) {
    #tc-modal-img {
        height: 280px;
        border-radius: 12px 0 0 0;
    }
}

#tc-modal-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    padding: 8px;
    background: rgba(0,0,0,.3);
}
#tc-modal-thumbs:empty { display: none; }
.tc-modal-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: .65;
    transition: opacity .15s, border-color .15s;
}
.tc-modal-thumb:hover  { opacity: 1; }
.tc-modal-thumb.active { border-color: #3a6bbf; opacity: 1; }

/* Info side */
#tc-modal-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
#tc-modal-name {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0;
    padding-right: 28px; /* don't overlap close btn */
    color: #fff;
}
#tc-modal-price {
    font-size: 1.1em;
    font-weight: 700;
    color: #4caf78;
    margin: 0;
}
#tc-modal-desc {
    font-size: .88em;
    opacity: .75;
    line-height: 1.55;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}
#tc-modal-desc p  { margin: 0 0 8px; }
#tc-modal-desc p:last-child { margin-bottom: 0; }
#tc-modal-desc ul { margin: 0 0 8px 16px; padding: 0; }
#tc-modal-desc ul:last-child { margin-bottom: 0; }
#tc-modal-desc li { margin-bottom: 3px; }
#tc-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
#tc-modal-actions .tc-add-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: .9em;
}

/* ════════════════════════════════════════
   CART — mobile base styles
════════════════════════════════════════ */
#tc-cart-items { margin-bottom: 16px; }

.tc-cart-empty {
    opacity: .6;
    font-style: italic;
    padding: 12px 0;
}

.tc-cart-row {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(128,128,128,.2);
    align-items: flex-start;
}
.tc-cart-row:last-child { border-bottom: none; }

/* Thumbnail column */
.tc-cart-thumb-wrap { flex-shrink: 0; width: 80px; }
.tc-cart-thumb-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    background: rgba(128,128,128,.15);
    border: 1px solid rgba(128,128,128,.2);
}
.tc-cart-thumb-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* Middle info column */
.tc-cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tc-cart-item-name {
    font-weight: 600;
    font-size: .95em;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
}

/* Price shown inline on mobile (inside info column) */
.tc-cart-item-price {
    font-size: 1.05em;
    font-weight: 700;
    margin: 0;
}
.tc-cart-item-unit {
    font-size: .78em;
    font-weight: 400;
    opacity: .6;
}

/* Right price column — hidden on mobile */
.tc-cart-item-price-col { display: none; }

/* Stepper + Delete */
.tc-cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.tc-cart-stepper {
    display: flex;
    align-items: center;
    border: 1px solid rgba(128,128,128,.45);
    border-radius: 24px;
    overflow: hidden;
    height: 34px;
}
.tc-cart-qty-btn {
    width: 36px;
    height: 34px;
    background: transparent;
    border: none;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}
.tc-cart-qty-btn:hover  { background: rgba(128,128,128,.15); }
.tc-cart-qty-btn:active { background: rgba(128,128,128,.25); }
.tc-cart-qty-val {
    min-width: 28px;
    text-align: center;
    font-size: .9em;
    font-weight: 600;
    border-left: 1px solid rgba(128,128,128,.3);
    border-right: 1px solid rgba(128,128,128,.3);
    height: 34px;
    line-height: 34px;
    padding: 0 4px;
}

.tc-remove-btn {
    background: none;
    border: 1px solid rgba(128,128,128,.35);
    border-radius: 24px;
    color: inherit;
    cursor: pointer;
    font-size: .82em;
    padding: 6px 14px;
    height: 34px;
    display: flex;
    align-items: center;
    transition: background .15s, border-color .15s;
}
.tc-remove-btn:hover {
    background: rgba(220,70,70,.12);
    border-color: rgba(220,70,70,.4);
    color: #e05555;
}

/* Cart footer — mobile: stacked */
#tc-cart-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 2px solid rgba(128,128,128,.2);
}
#tc-cart-total {
    font-size: 1.15em;
    font-weight: 700;
}
#tc-checkout-btn {
    width: 100%;
    padding: 14px;
    font-size: 1em;
    border-radius: 8px;
    text-align: center;
}

/* ════════════════════════════════════════
   CART — Desktop (Amazon 3-column layout)
════════════════════════════════════════ */
@media ( min-width: 680px ) {

    #tc-cart { max-width: 860px; }

    .tc-cart-row {
        gap: 20px;
        padding: 24px 0;
    }

    /* Bigger image on desktop */
    .tc-cart-thumb-wrap  { width: 120px; }
    .tc-cart-thumb-placeholder,
    .tc-cart-thumb-img   { width: 120px; height: 120px; }

    /* Name bigger */
    .tc-cart-item-name   { font-size: 1.05em; }

    /* Hide price from middle column */
    .tc-cart-item-price  { display: none; }

    /* Show right price column */
    .tc-cart-item-price-col {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-start;
        flex-shrink: 0;
        min-width: 100px;
        padding-top: 2px;
    }
    .tc-cart-price-main {
        font-size: 1.2em;
        font-weight: 700;
        white-space: nowrap;
    }
    .tc-cart-price-unit {
        font-size: .78em;
        opacity: .55;
        white-space: nowrap;
        margin-top: 3px;
    }

    /* Footer horizontal on desktop */
    #tc-cart-footer    { flex-direction: row; align-items: center; flex-wrap: wrap; }
    #tc-checkout-btn   { width: auto; padding: 11px 28px; }
}

/* ════════════════════════════════════════
   CHECKOUT FORM
════════════════════════════════════════ */
#tc-checkout-form  { max-width: 640px; margin-top: 20px; }
.tc-form-row       { display: flex; gap: 16px; }
.tc-two-col > *    { flex: 1; }
.tc-three-col > *  { flex: 1; }
.tc-form-group     { margin-bottom: 16px; }
.tc-form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9em; }
.tc-form-group input,
.tc-form-group textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid rgba(128,128,128,.4);
    border-radius: 6px;
    font-size: .95em;
    box-sizing: border-box;
    font-family: inherit;
    background: transparent;
    color: inherit;
}
.tc-form-group textarea { resize: vertical; }
#tc-due-date { color-scheme: light; }
#tc-due-date::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.tc-req { color: #f07070; }

.tc-notice {
    background: rgba(240,184,73,.12);
    border-left: 3px solid #f0b849;
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-size: .88em;
    color: inherit;
    opacity: .85;
    margin-bottom: 18px;
}
.tc-form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.tc-error { color: #f07070; margin-top: 10px; font-size: .9em; }

#tc-order-summary {
    background: rgba(128,128,128,.1);
    border: 1px solid rgba(128,128,128,.25);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 24px;
    max-width: 640px;
}
#tc-order-summary h4 { margin: 0 0 10px; color: inherit; }
.tc-summary-line  { display: flex; justify-content: space-between; font-size: .9em; padding: 3px 0; }
.tc-summary-total { font-weight: 700; border-top: 1px solid rgba(128,128,128,.25); padding-top: 8px; margin-top: 6px; }

/* ════════════════════════════════════════
   SHARED BUTTONS
════════════════════════════════════════ */
#tc-checkout-btn, #tc-submit-btn {
    padding: 10px 22px;
    background: #2c7a3e;
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: .95em;
    font-weight: 700;
    transition: background .2s;
}
#tc-checkout-btn:hover, #tc-submit-btn:hover { background: #225f30; }
#tc-continue-btn, #tc-back-btn {
    padding: 10px 18px;
    background: transparent;
    color: inherit;
    border: 1px solid rgba(128,128,128,.4);
    border-radius: 7px;
    cursor: pointer;
    font-size: .9em;
    transition: opacity .2s;
}
#tc-continue-btn:hover, #tc-back-btn:hover { opacity: .7; }
#tc-new-order-btn {
    padding: 10px 24px;
    background: #3a6bbf;
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: .95em;
    font-weight: 700;
    margin-top: 16px;
}

/* ════════════════════════════════════════
   CONFIRMATION
════════════════════════════════════════ */
#tc-confirm-box {
    text-align: center;
    max-width: 480px;
    margin: 40px auto;
    padding: 40px;
    border: 1px solid rgba(128,128,128,.25);
    border-radius: 12px;
    background: transparent;
    color: inherit;
}
#tc-confirm-box h2 { color: inherit; margin-bottom: 12px; }
#tc-confirm-box p  { color: inherit; opacity: .85; }
.tc-confirm-icon {
    width: 64px; height: 64px;
    background: #2c7a3e;
    color: #fff;
    font-size: 2em;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

/* ════════════════════════════════════════
   MOBILE ADJUSTMENTS
════════════════════════════════════════ */
@media ( max-width: 520px ) {
    .tc-form-row { flex-direction: column; gap: 0; }
    .tc-card-controls { width: 100%; }
    .tc-add-btn { flex: 1; }
}
