/* TGS Tienda — responsive layout */
:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface2: #243044;
    --text: #e8eef6;
    --muted: #94a3b8;
    --accent: #ee6c4d;
    --accent-hover: #f4977f;
    --border: #334155;
    --success-bg: rgba(34, 197, 94, 0.15);
    --success-border: #22c55e;
    --error-bg: rgba(239, 68, 68, 0.15);
    --error-border: #ef4444;
    --info-bg: rgba(56, 189, 248, 0.12);
    --info-border: #38bdf8;
    --radius: 12px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --maxw: 1120px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.layout {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.wrap {
    width: min(100% - 2rem, var(--maxw));
    margin-inline: auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    max-width: calc(var(--maxw) + 2rem);
    margin-inline: auto;
}

.site-logo {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-logo:hover {
    color: var(--accent);
}

.nav-toggle {
    display: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
}

.nav-toggle__bars {
    display: block;
    width: 22px;
    height: 14px;
    background: linear-gradient(
        var(--text),
        var(--text)
    );
    background-size: 22px 2px;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow:
        0 -6px 0 var(--text),
        0 6px 0 var(--text);
}

.site-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    align-items: center;
}

.site-nav__list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.site-nav__list a:hover {
    color: var(--accent);
}

.cart-link .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.btn-nav {
    background: var(--accent);
    color: #fff !important;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
}

.btn-nav:hover {
    filter: brightness(1.08);
    color: #fff !important;
}

@media (max-width: 820px) {
    .nav-toggle {
        display: block;
    }

    .site-nav {
        display: none;
        width: 100%;
        border-top: 1px solid var(--border);
        padding: 1rem;
        margin-top: 0;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-header__inner {
        flex-wrap: wrap;
    }

    .site-nav__list {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Alerts */
.alert {
    padding: 0.85rem 1rem;
    margin: 0 auto 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    max-width: calc(var(--maxw) + 2rem);
}

.alert p {
    margin: 0;
}

.alert--error {
    background: var(--error-bg);
    border-color: var(--error-border);
}

.alert--success {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.alert--info {
    background: var(--info-bg);
    border-color: var(--info-border);
}

.alert--info a {
    word-break: break-all;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.06);
    color: #fff;
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #2d3f56;
    color: var(--text);
}

.btn-small {
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

.btn-text:hover {
    color: var(--accent);
}

/* Hero */
.hero {
    background: radial-gradient(ellipse 120% 80% at 70% 20%, #243044 0%, transparent 55%),
        linear-gradient(160deg, #1a2332 0%, #0f1419 100%);
    padding: clamp(2.5rem, 6vw, 4rem) 1rem;
}

.hero__inner {
    display: grid;
    grid-template-columns: 1fr minmax(180px, 1fr);
    gap: 2rem;
    align-items: center;
}

.hero__copy .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.hero__copy h1 {
    margin: 0 0 1rem;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.15;
}

.hero__copy .lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
    max-width: 38ch;
}

.hero__art {
    border-radius: var(--radius);
    min-height: 180px;
    background: repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 12px,
            rgba(238, 108, 77, 0.06) 12px,
            rgba(238, 108, 77, 0.06) 24px
        ),
        linear-gradient(135deg, var(--surface2), var(--surface));
    border: 1px solid var(--border);
}

@media (max-width: 720px) {
    .hero__inner {
        grid-template-columns: 1fr;
    }

    .hero__art {
        min-height: 120px;
    }
}

/* Sections */
.section {
    padding: clamp(2rem, 5vw, 3rem) 1rem;
}

.section--muted {
    background: rgba(26, 35, 50, 0.65);
}

.section__title {
    margin: 0 0 1.25rem;
    font-size: 1.35rem;
}

.grid {
    display: grid;
    gap: 1.25rem;
}

.grid--rubros {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid--products {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.card--rubro {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, border-color 0.15s;
}

.card--rubro:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.card--rubro h3 {
    margin: 0;
    font-size: 1.1rem;
}

.link-arrow {
    color: var(--accent);
    font-weight: 600;
    margin-top: auto;
}

.card--product {
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.card--product__link {
    color: inherit;
    text-decoration: none;
    padding: 0;
}

.card--product__img {
    aspect-ratio: 10 / 7;
    overflow: hidden;
    background: var(--surface2);
}

.card--product__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card--product h3 {
    margin: 0.75rem 1rem 0.35rem;
    font-size: 1rem;
}

.product__meta {
    margin: 0.75rem 1rem 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.product__price {
    margin: 0 1rem;
    font-weight: 700;
    color: var(--accent);
}

.product-quick-add {
    padding: 0 1rem 1rem;
}

.product-quick-add .btn {
    width: 100%;
}

.badge-stock {
    margin: 0 1rem;
    font-size: 0.75rem;
    color: #fbbf24;
}

.badge-stock--out {
    color: var(--muted);
}

/* Catalog */
.catalog-layout {
    padding: 1.5rem 1rem 3rem;
}

.catalog-head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.catalog-head h1 {
    margin: 0;
}

.catalog-search {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.catalog-search input[type="search"] {
    min-width: min(280px, 100%);
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.catalog-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
}

.catalog-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.catalog-filters h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.filter-subtitle {
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-list li {
    margin-bottom: 0.35rem;
}

.filter-list a {
    display: block;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
}

.filter-list a:hover,
.filter-list a.is-active {
    background: var(--surface2);
    color: var(--accent);
}

/* Forms */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-stack label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-stack input,
.form-stack textarea {
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.auth-page {
    padding: 2rem 1rem 4rem;
    max-width: 440px;
}

.auth-page h1 {
    margin-top: 0;
}

.form-inline {
    margin-top: 0.75rem;
}

.form-inline-add {
    margin-top: 1rem;
}

.form-inline-add label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-inline-add input[type="number"] {
    max-width: 100px;
}

.form-inline-add .btn {
    align-self: flex-start;
}

/* Product detail */
.product-detail {
    padding: 1.5rem 1rem 3rem;
}

.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    color: var(--muted);
}

.breadcrumb a {
    color: var(--muted);
}

.breadcrumb a:hover {
    color: var(--accent);
}

.product-detail__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
}

@media (max-width: 768px) {
    .product-detail__grid {
        grid-template-columns: 1fr;
    }
}

.product-detail__media {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

.product-detail__media img {
    width: 100%;
    display: block;
}

.product-detail__info h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.product__price--xl {
    font-size: 1.75rem;
}

.stock-line {
    margin: 1rem 0;
}

.prose h2 {
    font-size: 1rem;
    margin: 1.5rem 0 0.5rem;
}

/* Cart */
.cart-page {
    padding: 1.5rem 1rem 4rem;
}

.cart-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.cart-table th,
.cart-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.cart-table th {
    color: var(--muted);
    font-weight: 600;
}

.td-n {
    text-align: right;
}

.cart-product {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.cart-product img {
    border-radius: 8px;
    border: 1px solid var(--border);
}

.cart-product a {
    font-weight: 600;
    color: var(--text);
}

.cart-product a:hover {
    color: var(--accent);
}

.small {
    font-size: 0.8rem;
}

.form-qty {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
}

.form-qty input[type="number"] {
    width: 4rem;
    padding: 0.35rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
}

.cart-summary {
    max-width: 380px;
}

.cart-total {
    font-size: 1.25rem;
    margin: 0 0 1rem;
}

/* Checkout */
.checkout-page {
    padding: 1.5rem 1rem 4rem;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 320px);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 800px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

.checkout-lines {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.checkout-lines li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.checkout-total {
    margin: 0;
    font-size: 1.15rem;
}

.checkout-aside .small {
    margin-top: 1rem;
}

/* Account */
.account-page {
    padding: 1.5rem 1rem 4rem;
}

.account-block + .account-block {
    margin-top: 1.5rem;
}

.account-block h2 {
    margin-top: 0;
}

.tag-ok {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    font-size: 0.85rem;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    text-align: left;
    color: var(--muted);
    font-size: 0.85rem;
}

.pedido-row .row-action {
    opacity: 0.1;
    transition: opacity 0.2s ease;
}

.pedido-row:hover .row-action,
.pedido-row:focus-within .row-action {
    opacity: 1;
}

.inline-form {
    display: inline;
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.compat-grid {
    margin-top: 0.5rem;
    display: grid;
    gap: 0.35rem;
}

.compat-grid p {
    margin: 0;
}

.compat-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.pager {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

select {
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 2rem 1rem;
    margin-top: auto;
}

.site-footer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.footer-links li {
    margin-bottom: 0.35rem;
}

.footer-links a {
    color: var(--muted);
}

.footer-links a:hover {
    color: var(--accent);
}

.site-footer__legal {
    margin: 2rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

.muted {
    color: var(--muted);
}
