/* ============================================================
   The Wine Shelter — Public CSS
   Compartido por index.php y páginas de error (errors/)
============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
    --bg:          #DFDFD7;
    --text:        #1a1a1a;
    --muted:       #6b6b62;
    --border:      #c4c4ba;
    --red:         #A4191A;
    --gold:        #A9893E;
    --green:       #243936;
    --green-hover: #2d4743;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    padding-bottom: 80px;
}

h1, h2, h3, .brand-name, .seccion-title, .info-title {
    font-family: 'Taviraj', Georgia, 'Times New Roman', serif;
}

/* Las páginas de error usan layout flex columna para que el footer quede al fondo */
body.error-page {
    padding-bottom: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.error-page main { flex: 1; }

/* ════════════════════════════════════════
   HEADER
════════════════════════════════════════ */
.site-header {
    padding: 28px 16px 22px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.isotipo img, .isotipo svg { display: block; height: 54px; width: auto; }
.brand-name {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    line-height: 1.1;
    color: var(--text);
    text-decoration: none;
}
.brand-tagline {
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    color: var(--muted);
    text-transform: uppercase;
    margin-top: 3px;
}

/* ════════════════════════════════════════
   NAV
════════════════════════════════════════ */
.site-nav {
    background: var(--green);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    gap: 12px;
}
.nav-links { display: flex; gap: 18px; }
.nav-link {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    font-size: 0.76rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 14px 0;
    display: block;
    transition: color 0.15s;
    white-space: nowrap;
}
.nav-link:hover { color: #fff; }

.btn-wa-wrap { position: relative; flex-shrink: 0; }
.btn-wa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--red);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    white-space: nowrap;
    position: relative;
    transition: background 0.15s, transform 0.1s;
}
.btn-wa:hover  { background: #8c1415; }
.btn-wa:active { transform: scale(0.97); }

/* ════════════════════════════════════════
   FOOTER
════════════════════════════════════════ */
.site-footer {
    background: var(--green);
    color: rgba(255,255,255,0.75);
    padding: 24px 16px;
    text-align: center;
    border-top: 1px solid var(--border);
}
.footer-inner  { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.footer-brand  { font-family: 'Taviraj', serif; font-size: 0.95rem; letter-spacing: 0.12em; color: rgba(255,255,255,0.9); }
.footer-info   { font-size: 0.8rem; }
.footer-ig     { font-size: 0.8rem; color: var(--gold); text-decoration: none; transition: color 0.15s; }
.footer-ig:hover { color: #c9a94e; }

/* ════════════════════════════════════════
   CARTA (index.php)
════════════════════════════════════════ */
.carta { padding: 44px 0 60px; }
.container    { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container-sm { max-width: 680px; }
.seccion { margin-bottom: 56px; }

.seccion-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.seccion-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    opacity: 0.55;
}
.seccion-title {
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Tabla ── */
.tabla-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.vinos-tabla { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.vinos-tabla th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.vinos-tabla td { padding: 11px 10px; border-bottom: 1px solid rgba(0,0,0,0.055); vertical-align: middle; }
.vinos-tabla tr.sin-stock td { opacity: 0.42; }
.vinos-tabla tbody tr:hover:not(.sin-stock) { background: rgba(0,0,0,0.022); }

.col-desktop { display: none; }
.th-nombre,   .td-nombre   { min-width: 140px; text-align: left; }
.th-varietal, .td-varietal { color: var(--muted); font-size: 0.82rem; text-align: left; }
.th-bodega,   .td-bodega   { text-align: left; }
.th-region,   .td-region   { text-align: left; }
.th-stock,    .td-stock     { text-align: center; width: 64px; }
.th-ref,      .td-ref       { text-align: center; color: var(--muted); white-space: nowrap; width: 90px; }
.th-precio,   .td-precio    { text-align: center; white-space: nowrap; width: 100px; }
.th-accion,   .td-accion    { text-align: center; white-space: nowrap; min-width: 110px; }

.vino-nombre  { font-weight: 500; }
.vino-anada   { font-size: 0.74rem; color: var(--muted); margin-left: 5px; }
.badge-dest   { color: var(--gold); font-size: 0.72rem; margin-left: 3px; }

.stock-tag   { font-size: 0.73rem; font-weight: 600; padding: 2px 7px; border-radius: 10px; display: inline-block; }
.stock-ok    { background: rgba(36,57,54,0.11); color: var(--green); }
.stock-cero  { background: rgba(164,25,26,0.09); color: var(--red); font-size: 0.68rem; }

.precio-ref      { color: var(--muted); font-size: 0.8rem; }
.precio-tws      { font-weight: 600; }
.precio-consultar { color: var(--muted); font-size: 0.8rem; font-style: italic; }

/* ── Controles carrito ── */
.btn-agregar {
    background: var(--green);
    color: #fff;
    border: none;
    padding: 6px 11px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    font-family: inherit;
}
.btn-agregar:hover { background: var(--green-hover); }

.cart-ctrl { text-align: center; }
.qty-ctrl  { display: flex; align-items: center; justify-content: center; gap: 7px; }
.btn-menos, .btn-mas {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--green);
    background: transparent;
    color: var(--green);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
}
.btn-menos:hover, .btn-mas:hover { background: var(--green); color: #fff; }
.btn-mas:disabled { border-color: var(--border); color: var(--muted); cursor: not-allowed; }
.btn-mas:disabled:hover { background: transparent; color: var(--muted); }
.qty-val { min-width: 18px; text-align: center; font-weight: 700; font-size: 0.9rem; }
.no-disp { color: var(--muted); }
.carta-empty { text-align: center; padding: 60px 16px; color: var(--muted); font-style: italic; }

/* ── Secciones info ── */
.info-section { background: rgba(0,0,0,0.03); padding: 44px 16px; border-top: 1px solid var(--border); }
.info-title   { font-size: 1.15rem; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 14px; }
.info-text    { color: var(--muted); line-height: 1.72; }
.como-list    { color: var(--muted); line-height: 1.72; padding-left: 20px; }
.como-list li { margin-bottom: 8px; }
.como-list strong { color: var(--text); }

/* ── Barra WA fija (mobile) ── */
#nav-wa-wrap { display: none; }
.tabla-wrap  { display: none; }
.vinos-cards { display: flex; flex-direction: column; }

.vino-card {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    align-items: center;
}
.vino-card.sin-stock { opacity: 0.42; }
.card-left  { flex: 1; min-width: 0; }
.card-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; text-align: right; }
.card-nombre     { font-weight: 500; font-size: 0.88rem; line-height: 1.3; }
.card-varietal   { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.card-bodega     { font-size: 0.78rem; color: var(--muted); }
.card-stock-info { font-size: 0.74rem; color: var(--muted); margin-top: 4px; }
.card-precio-ref { font-size: 0.74rem; }
.card-precio-tws { font-size: 0.92rem; }

.mobile-fixed-bar {
    position: fixed;
    bottom: 14px;
    left: 0; right: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.mobile-fixed-bar .btn-wa-wrap { pointer-events: auto; }
.btn-wa-fixed { border-radius: 4px; padding: 11px 22px; box-shadow: 0 4px 20px rgba(164,25,26,0.42); }
.mobile-fixed-footer { font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

/* ── Badge carrito ── */
.wa-badge {
    position: absolute;
    top: -6px; right: -6px;
    background: #fff;
    color: var(--red);
    border-radius: 50%;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1.5px solid var(--red);
}

/* ── Tooltip ── */
.wa-tooltip {
    position: fixed;
    background: #1c1c1c;
    color: #e6e6de;
    border-radius: 8px;
    padding: 14px 16px;
    width: 268px;
    font-size: 0.79rem;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.18s;
    pointer-events: none;
    box-shadow: 0 4px 22px rgba(0,0,0,0.38);
    line-height: 1.5;
}
.wa-tooltip.visible { opacity: 1; }
.tt-empty  { color: rgba(255,255,255,0.45); font-style: italic; text-align: center; padding: 2px 0; }
.tt-list   { list-style: none; margin-bottom: 10px; display: flex; flex-direction: column; gap: 7px; }
.tt-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: baseline; }
.tt-nombre { color: #e6e6de; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-detail { color: rgba(255,255,255,0.5); white-space: nowrap; }
.tt-sub    { color: var(--gold); font-weight: 600; white-space: nowrap; }
.tt-total  { border-top: 1px solid rgba(255,255,255,0.13); padding-top: 8px; text-align: right; font-weight: 700; color: var(--gold); font-size: 0.86rem; }

/* ── Age Gate ── */
.age-gate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}
html:not(.age-verified) body { overflow: hidden; }
html:not(.age-verified) .age-gate-overlay { display: flex; }

.age-gate {
    background: #1a1a1a;
    border: 1px solid rgba(169,137,62,0.55);
    border-radius: 12px;
    padding: 44px 32px 36px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 16px 64px rgba(0,0,0,0.85);
}
.age-gate-logo     { height: 62px; width: auto; display: block; margin: 0 auto 16px; }
.age-gate-sitename { font-family: 'Taviraj', Georgia, serif; color: #A9893E; font-size: 1.05rem; font-weight: 300; letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 22px; }
.age-gate-msg      { color: rgba(255,255,255,0.78); font-size: 0.94rem; line-height: 1.65; margin-bottom: 28px; }
.age-gate-btns     { display: flex; flex-direction: column; gap: 10px; }
.btn-age-si {
    background: #A9893E; color: #fff; border: none;
    padding: 14px 20px; border-radius: 6px;
    font-size: 0.87rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; transition: background 0.15s; font-family: inherit;
}
.btn-age-si:hover  { background: #bfa050; }
.btn-age-si:active { background: #8d7233; }
.btn-age-no {
    background: transparent; color: rgba(255,255,255,0.42);
    border: 1px solid rgba(255,255,255,0.14);
    padding: 13px 20px; border-radius: 6px;
    font-size: 0.87rem; cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    font-family: inherit;
}
.btn-age-no:hover  { border-color: #A4191A; color: #cf4545; }
.btn-age-no:active { background: rgba(164,25,26,0.12); }
.age-gate-legal    { margin-top: 20px; font-size: 0.7rem; color: rgba(255,255,255,0.22); line-height: 1.5; }

/* ════════════════════════════════════════
   ERROR PAGES — contenido
════════════════════════════════════════ */
.error-wrap {
    max-width: 520px;
    width: 100%;
    text-align: center;
    margin: 0 auto;
}
.error-code {
    font-family: 'Taviraj', Georgia, 'Times New Roman', serif;
    font-size: clamp(5rem, 20vw, 9rem);
    font-weight: 300;
    line-height: 1;
    letter-spacing: 0.12em;
    margin-bottom: 20px;
}
.error-code-404 { color: var(--gold); opacity: 0.45; }
.error-code-500 { color: var(--red);  opacity: 0.25; }

.error-title {
    font-family: 'Taviraj', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.4rem, 5vw, 1.85rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    margin-bottom: 18px;
}
.error-divider { display: flex; align-items: center; gap: 12px; margin: 0 auto 22px; max-width: 300px; }
.error-divider-line { flex: 1; height: 1px; background: linear-gradient(to right, transparent, var(--gold), transparent); opacity: 0.5; }
.error-divider-dot  { color: var(--gold); opacity: 0.6; font-size: 0.6rem; }
.error-msg { color: var(--muted); font-size: 0.95rem; line-height: 1.7; margin-bottom: 36px; }
.error-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; }

.btn-home {
    display: inline-block;
    background: var(--green);
    color: #fff;
    text-decoration: none;
    padding: 12px 28px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transition: background 0.15s;
}
.btn-home:hover { background: var(--green-hover); }

.btn-wa-secondary {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    padding: 8px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.btn-wa-secondary:hover { color: var(--red); border-bottom-color: var(--red); }

/* Contenedor centrado verticalmente (error pages) */
body.error-page main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 16px;
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (min-width: 480px) {
    .age-gate-btns  { flex-direction: row; gap: 14px; }
    .btn-age-si, .btn-age-no { flex: 1; }
    .error-actions  { flex-direction: row; justify-content: center; }
}

@media (min-width: 768px) {
    body           { padding-bottom: 0; }
    .col-desktop   { display: table-cell; }
    .mobile-fixed-bar { display: none; }
    .vinos-cards   { display: none; }
    .tabla-wrap    { display: block; }
    #nav-wa-wrap   { display: block; }
    .brand-name    { font-size: 1.9rem; }
}
