/* ============================================================
   Obrazone — storefront (tienda) styles
   --t-primary se inyecta inline desde PHP según tenant.brand_color
   ============================================================ */

:root {
    --t-primary: #1e4a7a;
    --t-primary-dark: #143557;
    --t-text: #1a1a1a;
    --t-muted: #5a6470;
    --t-bg: #ffffff;
    --t-bg-alt: #f5f7fa;
    --t-border: #e2e8f0;
    --t-success: #1e8a4d;
    --t-error: #c62828;
    --t-warn: #c97b00;
    --t-radius: 8px;
    --t-shadow: 0 2px 6px rgba(15, 37, 64, 0.08);
    --t-shadow-md: 0 6px 18px rgba(15, 37, 64, 0.10);
    --t-maxw: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--t-text);
    background: var(--t-bg-alt);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--t-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.t-container { max-width: var(--t-maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.t-header {
    background: #fff;
    border-bottom: 1px solid var(--t-border);
    position: sticky; top: 0; z-index: 30;
}
.t-header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.25rem;
}
.t-brand {
    display: inline-flex; align-items: center; gap: 0.6rem;
    font-weight: 800; font-size: 1.1rem; color: var(--t-text);
}
.t-brand:hover { text-decoration: none; }
.t-brand img { height: 36px; width: auto; }
.t-brand-mark {
    display: inline-block; width: 28px; height: 28px;
    background: var(--t-primary); border-radius: 6px;
}
.t-brand-name { color: var(--t-primary); }
.t-nav { display: flex; align-items: center; gap: 1.2rem; font-weight: 500; }
.t-nav a { color: var(--t-text); }
.t-nav a:hover { color: var(--t-primary); text-decoration: none; }
.t-cart-link { display: inline-flex; align-items: center; gap: 0.35rem; }
.t-cart-count {
    background: var(--t-primary); color: #fff;
    font-size: 0.7rem; font-weight: 700;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    min-width: 1.4rem; text-align: center;
}

/* ---------- Buttons ---------- */
.t-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.7rem 1.25rem;
    font-size: 0.95rem; font-weight: 600;
    border-radius: var(--t-radius);
    border: 2px solid transparent;
    cursor: pointer; transition: all 0.15s ease;
    line-height: 1; text-decoration: none;
}
.t-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.t-btn-primary {
    background: var(--t-primary); color: #fff !important; border-color: var(--t-primary);
}
.t-btn-primary:hover:not(:disabled) {
    background: var(--t-primary-dark); border-color: var(--t-primary-dark);
    text-decoration: none; transform: translateY(-1px); box-shadow: var(--t-shadow-md);
}
.t-btn-ghost {
    background: transparent; color: var(--t-primary); border-color: var(--t-primary);
}
.t-btn-ghost:hover { background: var(--t-primary); color: #fff !important; text-decoration: none; }
.t-btn-lg { padding: 0.95rem 1.6rem; font-size: 1rem; }

/* ---------- Main ---------- */
.t-main { min-height: calc(100vh - 200px); }

/* ---------- Hero (home) ---------- */
.t-hero {
    background: linear-gradient(180deg, #fff 0%, var(--t-bg-alt) 100%);
    padding: 2.5rem 0 1.5rem;
    border-bottom: 1px solid var(--t-border);
}
.t-hero h1 {
    font-size: clamp(1.6rem, 3.2vw, 2.2rem);
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}
.t-hero-sub { color: var(--t-muted); margin-bottom: 1rem; }
.t-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.t-chip {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--t-border);
    color: var(--t-text);
    font-size: 0.85rem;
    font-weight: 500;
}
.t-chip:hover { border-color: var(--t-primary); color: var(--t-primary); text-decoration: none; }
.t-chip-active { background: var(--t-primary); color: #fff; border-color: var(--t-primary); }
.t-chip-active:hover { color: #fff; }

/* ---------- Search bar (home) ---------- */
.t-search-bar {
    display: flex; gap: 0.5rem;
    margin: 0.8rem 0 1.2rem;
    flex-wrap: wrap;
}
.t-search-bar input[type=search] {
    flex: 1; min-width: 240px;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--t-border);
    border-radius: var(--t-radius);
    background: #fff;
}
.t-search-bar input[type=search]:focus {
    outline: none; border-color: var(--t-primary);
    box-shadow: 0 0 0 3px rgba(30,74,122,0.12);
}

/* ---------- Pager ---------- */
.t-pager {
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    margin: 2.5rem 0 0; flex-wrap: wrap;
}
.t-pager-info { color: var(--t-muted); font-size: 0.9rem; }

/* ---------- Section ---------- */
.t-section { padding: 2.5rem 0 4rem; }

/* ---------- Catalog grid ---------- */
.t-cat-title {
    font-size: 1.25rem; font-weight: 700;
    margin: 2rem 0 1rem;
    letter-spacing: -0.01em;
}
.t-cat-title:first-of-type { margin-top: 0; }
.t-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.t-card {
    position: relative;
    background: #fff;
    border-radius: var(--t-radius);
    border: 1px solid var(--t-border);
    overflow: hidden;
    transition: all 0.15s ease;
    display: flex; flex-direction: column;
    color: var(--t-text);
}
.t-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--t-shadow-md);
    border-color: var(--t-primary);
    text-decoration: none;
}
.t-card-img {
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #e8eef5, #c9d6e6);
    display: flex; align-items: center; justify-content: center;
    color: var(--t-primary);
    font-weight: 800; font-size: 3rem;
    opacity: 0.85;
    overflow: hidden;
}
.t-card-img.has-img { background: #fff; opacity: 1; }
.t-card-img img {
    width: 100%; height: 100%; object-fit: cover;
}
.t-card-body { padding: 0.9rem; flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.t-card-name {
    font-size: 0.92rem; font-weight: 700;
    line-height: 1.25;
    /* Clamp 2 lines */
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.t-card-sub {
    font-size: 0.78rem; color: var(--t-muted); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.t-card-price {
    margin-top: auto; padding-top: 0.4rem;
    display: flex; align-items: baseline; gap: 0.45rem;
}
.t-card-price strong { font-size: 1.1rem; color: var(--t-primary); font-weight: 800; }
.t-card-price s { font-size: 0.8rem; color: var(--t-muted); }

.t-badge {
    position: absolute; top: 0.55rem; right: 0.55rem;
    background: var(--t-success); color: #fff;
    font-size: 0.65rem; font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.t-badge-discount { background: var(--t-error); }
.t-badge-out { background: var(--t-muted); }

/* ---------- Producto (ficha) ---------- */
.t-product { padding: 2rem 0 4rem; }
.t-product-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 1.4fr;
    gap: 2.5rem;
    align-items: start;
}
.t-product-imgwrap { background: #fff; border-radius: var(--t-radius); padding: 1rem; border: 1px solid var(--t-border); }
.t-product-img {
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #e8eef5, #c9d6e6);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--t-primary); font-weight: 800; font-size: 5rem;
    overflow: hidden;
}
.t-product-img.has-img { background: #fafbfc; }
.t-product-img img { width: 100%; height: 100%; object-fit: contain; }
.t-product-thumbs {
    display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap;
}
.t-thumb {
    width: 64px; height: 64px;
    border: 2px solid var(--t-border); border-radius: 6px;
    overflow: hidden; padding: 0; cursor: pointer; background: #fff;
    transition: border-color 0.12s;
}
.t-thumb:hover { border-color: var(--t-primary); }
.t-thumb.active { border-color: var(--t-primary); box-shadow: 0 0 0 2px rgba(30,74,122,0.18); }
.t-thumb img { width: 100%; height: 100%; object-fit: cover; }

.t-brand-logo { max-height: 44px; width: auto; }
.t-breadcrumb { font-size: 0.85rem; color: var(--t-muted); margin-bottom: 0.5rem; }
.t-product-name {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    margin-bottom: 0.5rem; letter-spacing: -0.01em;
}
.t-product-sub { color: var(--t-muted); margin-bottom: 1rem; }
.t-product-price {
    display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
    margin: 1rem 0;
}
.t-product-price strong { font-size: 1.8rem; color: var(--t-primary); font-weight: 800; }
.t-product-price s { color: var(--t-muted); font-size: 1.05rem; }
.t-product-price small { color: var(--t-muted); font-size: 0.85rem; }
.t-stock { font-size: 0.9rem; margin: 0.5rem 0 1rem; font-weight: 600; }
.t-stock.ok { color: var(--t-success); }
.t-stock.out { color: var(--t-error); }
.t-addcart {
    display: flex; align-items: end; gap: 0.8rem;
    margin: 1rem 0 1.5rem;
    padding: 1rem; background: #fff; border: 1px solid var(--t-border); border-radius: var(--t-radius);
}
.t-addcart label { font-size: 0.85rem; font-weight: 600; color: var(--t-muted); display: flex; flex-direction: column; gap: 0.3rem; }
.t-addcart input[type=number] {
    width: 80px;
    padding: 0.55rem 0.6rem; border: 1.5px solid var(--t-border); border-radius: 6px;
    font-size: 1rem; font-weight: 600; text-align: center;
}
.t-addcart input:focus { outline: none; border-color: var(--t-primary); }
.t-product-desc { margin: 1.5rem 0; }
.t-product-desc h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.t-product-desc p { color: var(--t-muted); }
.t-product-meta { font-size: 0.8rem; color: var(--t-muted); margin-top: 1rem; }

/* ---------- Carrito ---------- */
.t-cart-table {
    width: 100%; background: #fff; border-radius: var(--t-radius);
    overflow: hidden; box-shadow: var(--t-shadow);
    border-collapse: collapse;
}
.t-cart-table th, .t-cart-table td {
    padding: 0.85rem 1rem; border-bottom: 1px solid var(--t-border);
    text-align: left; vertical-align: middle;
}
.t-cart-table thead th { background: var(--t-bg-alt); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--t-muted); }
.t-cart-table tfoot td { border-bottom: none; background: var(--t-bg-alt); }
.t-cart-row-qty { display: inline-flex; align-items: center; gap: 0.4rem; }
.t-cart-row-qty input { width: 60px; padding: 0.4rem; text-align: center; border: 1.5px solid var(--t-border); border-radius: 6px; font-weight: 600; }
.t-cart-row-name { font-weight: 600; }
.t-cart-row-sub { font-size: 0.8rem; color: var(--t-muted); }
.t-cart-remove { background: none; border: none; color: var(--t-error); cursor: pointer; font-size: 0.9rem; }
.t-cart-total-label { text-align: right; font-weight: 600; }
.t-cart-total { text-align: right; font-size: 1.15rem; font-weight: 800; color: var(--t-primary); }
.t-cart-actions { margin-top: 1.5rem; display: flex; gap: 1rem; justify-content: flex-end; flex-wrap: wrap; }
.t-empty { text-align: center; padding: 3rem 1rem; color: var(--t-muted); }
.t-empty p { margin-bottom: 1rem; }

/* ---------- Checkout ---------- */
.t-checkout-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
    align-items: start;
}
.t-form { background: #fff; padding: 1.6rem; border-radius: var(--t-radius); border: 1px solid var(--t-border); }
.t-form label {
    display: block; margin-bottom: 0.9rem;
    font-size: 0.85rem; font-weight: 600; color: var(--t-text);
}
.t-form input, .t-form textarea, .t-form select {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--t-border);
    border-radius: var(--t-radius);
    font-family: inherit;
}
.t-form input:focus, .t-form textarea:focus { outline: none; border-color: var(--t-primary); box-shadow: 0 0 0 3px rgba(30,74,122,0.12); }
.t-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.t-form-row label { margin-bottom: 0; }
.t-form-msg {
    padding: 0.7rem 0.9rem;
    border-radius: var(--t-radius);
    font-size: 0.9rem;
    margin: 1rem 0;
    display: none;
}
.t-form-msg.success { background: #e6f4ec; color: var(--t-success); border: 1px solid #b8e0c8; display: block; }
.t-form-msg.error { background: #fdecec; color: var(--t-error); border: 1px solid #f4c2c2; display: block; }
.t-checkout-note {
    background: #fff7e0;
    color: #6b4900;
    padding: 0.7rem 0.9rem; border-radius: var(--t-radius);
    font-size: 0.85rem; border: 1px solid #f0d896;
    margin: 1rem 0;
}
.t-checkout-summary {
    background: #fff; padding: 1.4rem; border-radius: var(--t-radius); border: 1px solid var(--t-border);
    position: sticky; top: 90px;
}
.t-checkout-summary h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }
.t-checkout-line {
    display: flex; justify-content: space-between; padding: 0.4rem 0;
    border-bottom: 1px solid var(--t-bg-alt); font-size: 0.9rem;
}
.t-checkout-line span:last-child { font-weight: 600; }
.t-checkout-total {
    margin-top: 1rem; padding-top: 1rem; border-top: 2px solid var(--t-border);
    font-size: 1.05rem; display: flex; justify-content: space-between; align-items: baseline;
}
.t-checkout-total strong { font-size: 1.4rem; color: var(--t-primary); font-weight: 800; }

/* ---------- Order confirmation ---------- */
.t-order-confirmation { text-align: center; padding: 2rem 1rem 4rem; max-width: 640px; margin: 0 auto; }
.t-ok-badge {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--t-success); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem; font-weight: 800;
    margin: 0 auto 1.2rem;
}
.t-order-confirmation h1 { font-size: 1.8rem; margin-bottom: 0.8rem; }
.t-order-lead { color: var(--t-muted); margin-bottom: 1.5rem; }
.t-order-card {
    background: #fff; border: 1px solid var(--t-border); border-radius: var(--t-radius);
    padding: 1.4rem; text-align: left; margin: 1.5rem 0;
}
.t-order-card h2 { font-size: 1rem; margin-bottom: 0.8rem; color: var(--t-muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.78rem; }
.t-order-items { list-style: none; }
.t-order-items li {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: 0.8rem; padding: 0.5rem 0;
    border-bottom: 1px solid var(--t-bg-alt);
    font-size: 0.9rem;
}
.t-order-qty { color: var(--t-muted); font-weight: 600; }
.t-order-name { font-weight: 500; }
.t-order-line { font-weight: 700; color: var(--t-primary); }
.t-order-total {
    margin-top: 0.8rem; padding-top: 0.8rem; border-top: 2px solid var(--t-border);
    text-align: right; font-size: 1.05rem;
}
.t-order-total strong { font-size: 1.3rem; color: var(--t-primary); }

/* ---------- Footer ---------- */
.t-footer {
    background: #0a1c33; color: rgba(255,255,255,0.75);
    padding: 2rem 0; margin-top: 3rem; font-size: 0.9rem;
}
.t-footer p { margin-bottom: 0.4rem; }
.t-footer a { color: rgba(255,255,255,0.85); }
.t-powered { font-size: 0.8rem; color: rgba(255,255,255,0.45); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .t-product-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .t-checkout-grid { grid-template-columns: 1fr; }
    .t-form-row { grid-template-columns: 1fr; }
    .t-checkout-summary { position: static; }
    .t-cart-table thead { display: none; }
    .t-cart-table, .t-cart-table tbody, .t-cart-table tr, .t-cart-table td { display: block; width: 100%; }
    .t-cart-table tr { padding: 0.8rem 0; border-bottom: 1px solid var(--t-border); }
    .t-cart-table td { border: none; padding: 0.2rem 0.5rem; }
    .t-cart-table tfoot { display: table; width: 100%; }
    .t-cart-table tfoot tr, .t-cart-table tfoot td { display: table-cell; }
}
