/* SKAL SCRIPTS — carrito e inicio de sesión (tienda.js). Usa las variables de estilo.css. */

/* ---------------------------------------------------------------- cabecera */
/* Con carrito, «Abrir la tienda» sobra (sigue en el pie) y la cabecera tiene que caber sin partir ninguna palabra */
body.tc-activo .cab-fila > .btn-marca[data-tienda] { display: none; }
body.tc-activo .cab-fila { gap: 16px; }
body.tc-activo .cab .logo { flex: none; }
body.tc-activo .menu > a, body.tc-activo .menu > .desplegable > button { white-space: nowrap; padding-inline: 11px; }
.tc-boton, .tc-nombre { white-space: nowrap; }
.tc-cab { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cab-fila .menu { flex: 1; }
.tc-cuenta-caja { position: relative; }
.tc-boton { position: relative; display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px; border: 1px solid var(--linea2); border-radius: 12px; background: rgba(255, 255, 255, .03); color: var(--texto); cursor: pointer; font-family: var(--rotulo); font-weight: 700; font-size: 17px; letter-spacing: .03em; transition: background .2s, border-color .2s; }
.tc-boton:hover { background: rgba(255, 255, 255, .09); border-color: rgba(61, 214, 192, .5); }
.tc-boton:disabled { opacity: .6; cursor: progress; }
.tc-boton svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tc-carrito { width: 44px; padding: 0; justify-content: center; }
.tc-n { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--marca); color: #04211c; font: 700 13px/20px var(--rotulo); text-align: center; box-shadow: 0 0 0 2px var(--tinta); }
.tc-avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--marca); color: #04211c; font-size: 15px; flex: none; }

.tc-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 270px; padding: 8px; border: 1px solid var(--linea2); border-radius: 14px; background: var(--panel); box-shadow: 0 24px 60px rgba(0, 0, 0, .55); z-index: 80; }
.tc-menu[hidden] { display: none; }
.tc-menu-cab { padding: 10px 12px 12px; font-family: var(--rotulo); font-size: 18px; font-weight: 700; border-bottom: 1px solid var(--linea); margin-bottom: 6px; }
.tc-menu a, .tc-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--texto); text-align: left; cursor: pointer; font-size: 15px; line-height: 1.3; }
.tc-menu a:hover, .tc-menu button:hover { background: rgba(255, 255, 255, .07); }
.tc-menu svg { width: 18px; height: 18px; fill: none; stroke: var(--turq); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tc-menu small { display: block; color: var(--tenue); font-size: 13px; }

/* ---------------------------------------------------------------- cajón del carrito */
body.tc-abierto { overflow: hidden; }
.tc-cajon { position: fixed; inset: 0; z-index: 200; }
.tc-cajon[hidden] { display: none; }
.tc-fondo { position: absolute; inset: 0; background: rgba(2, 5, 8, .66); animation: tc-fade .22s var(--ease); }
.tc-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--linea2); box-shadow: -30px 0 80px rgba(0, 0, 0, .55); animation: tc-entra .32s var(--ease); }
.tc-panel header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--linea); }
.tc-panel h2 { font-family: var(--rotulo); font-size: 28px; line-height: 1.1; display: flex; align-items: center; gap: 12px; }
.tc-panel h2 span { font-size: 15px; padding: 2px 11px; border-radius: 999px; background: rgba(61, 214, 192, .16); color: var(--turq); }
.tc-x { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--linea2); border-radius: 10px; background: none; cursor: pointer; color: var(--texto); }
.tc-x:hover { background: rgba(255, 255, 255, .08); }
.tc-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.tc-revision { margin: 16px 22px 0; padding: 12px 14px; border: 1px solid rgba(241, 182, 74, .4); border-radius: 12px; background: rgba(241, 182, 74, .08); color: #f6d596; font-size: 14px; line-height: 1.5; }
.tc-vacio { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 30px; text-align: center; }
.tc-vacio b { font-family: var(--rotulo); font-size: 24px; }
.tc-vacio p { color: var(--tenue); margin-bottom: 14px; }

.tc-lista { list-style: none; padding: 8px 22px; margin: 0; flex: 1; overflow-y: auto; }
.tc-lista li { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--linea); }
.tc-lista img { width: 84px; height: auto; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; border: 1px solid var(--linea); }
.tc-lista a { display: block; font-family: var(--rotulo); font-weight: 700; font-size: 19px; line-height: 1.2; }
.tc-lista a:hover { color: var(--turq); }
.tc-lista li span { color: var(--tenue); font-size: 15px; }
.tc-quitar { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; cursor: pointer; color: var(--tenue); }
.tc-quitar:hover { background: rgba(255, 90, 74, .14); color: #ff8274; }
.tc-quitar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.tc-pie { padding: 18px 22px 22px; border-top: 1px solid var(--linea); background: rgba(0, 0, 0, .18); display: flex; flex-direction: column; gap: 14px; }
.tc-cupon .tc-etq { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 14px; color: var(--tenue); }
.tc-cupon .tc-etq svg { width: 16px; height: 16px; fill: none; stroke: var(--turq); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tc-cupon div { display: flex; gap: 8px; }
.tc-cupon input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--linea2); border-radius: 11px; background: var(--tinta); color: var(--texto); font: inherit; letter-spacing: .04em; text-transform: uppercase; }
.tc-cupon input:focus { outline: 2px solid var(--turq); outline-offset: 1px; }
.tc-cupon .btn { padding: 0 18px; height: 44px; font-size: 16px; }
.tc-total { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tc-total div { display: flex; justify-content: space-between; gap: 12px; color: var(--tenue); font-size: 15px; }
.tc-total dd { margin: 0; color: var(--texto); font-variant-numeric: tabular-nums; }
.tc-total .tc-grande { padding-top: 10px; border-top: 1px solid var(--linea); color: var(--texto); font-family: var(--rotulo); font-size: 24px; font-weight: 700; }
.tc-nota { margin: 0; color: var(--tenue); font-size: 13px; line-height: 1.5; }
.tc-panel .btn[disabled] { opacity: .6; cursor: progress; }

/* ---------------------------------------------------------------- aviso */
.tc-aviso { position: fixed; left: 50%; bottom: 28px; z-index: 300; max-width: min(560px, calc(100% - 32px)); padding: 13px 20px; border: 1px solid rgba(61, 214, 192, .5); border-radius: 14px; background: #0c1a1c; color: var(--texto); font-size: 15px; line-height: 1.45; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: transform .3s var(--ease), opacity .25s; }
.tc-aviso.visible { transform: translate(-50%, 0); opacity: 1; }
.tc-aviso.mal { border-color: rgba(255, 130, 116, .6); background: #1c0f10; }

@keyframes tc-fade { from { opacity: 0; } }
@keyframes tc-entra { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tc-fondo, .tc-panel { animation: none; } .tc-aviso { transition: none; } }

/* ---------------------------------------------------------------- pantallas pequeñas */
@media (max-width: 1320px) {
    .tc-nombre { display: none; }
    .tc-boton { padding: 0 11px; }
}

@media (max-width: 600px) {
    body.tc-activo .cab-fila { gap: 8px; }
    .cab .logo img { height: 34px; }
    .tc-cab { gap: 6px; }
    .tc-boton { width: 38px; height: 38px; padding: 0; justify-content: center; }
    .tc-carrito { width: 38px; }
    .tc-n { top: -8px; right: -8px; }
    .idioma button { padding: 4px 9px; font-size: 14px; }
    .tc-menu { position: fixed; right: 12px; left: 12px; top: 112px; min-width: 0; }
}
