/* =============================================================================
   COMPONENTES
   ============================================================================= */

/* ---- Botones ------------------------------------------------------------- */
.btn {
    --btn-bg: var(--color-accent);
    --btn-fg: #fff;
    --btn-border: var(--color-accent);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-6);
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: var(--fs-15);
    line-height: 1.1;
    cursor: pointer;
    transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
    user-select: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:hover { background: var(--color-accent-hot); --btn-border: var(--color-accent-hot); box-shadow: var(--shadow-accent); }
.btn:active { transform: scale(0.97); }

.btn--lg  { padding: var(--sp-5) var(--sp-8); font-size: var(--fs-16); }
.btn--xl  { padding: var(--sp-6) var(--sp-10); font-size: var(--fs-18); }
.btn--sm  { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-13); }
.btn--block { width: 100%; }

.btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--color-text);
    --btn-border: var(--color-border);
}
.btn--ghost:hover { --btn-bg: var(--color-surface-2); --btn-border: var(--color-accent); box-shadow: none; }

.btn--outline-accent {
    --btn-bg: transparent;
    --btn-fg: var(--color-accent);
    --btn-border: var(--color-accent);
}
.btn--outline-accent:hover { --btn-bg: var(--color-accent); --btn-fg: #fff; }

.btn--dark {
    --btn-bg: var(--color-surface-3);
    --btn-fg: var(--color-text);
    --btn-border: var(--color-border);
}
.btn--dark:hover { --btn-bg: var(--color-surface-2); --btn-border: var(--color-accent); box-shadow: none; }

.btn--light {
    --btn-bg: #fff;
    --btn-fg: #0a0a0a;
    --btn-border: #fff;
}
.btn--light:hover { --btn-bg: #f0f0f0; --btn-border: #f0f0f0; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--radius);
    color: var(--color-text);
    background: transparent;
    border: 1px solid transparent;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
    position: relative;
}
.btn-icon:hover { background: var(--color-surface-2); color: var(--color-accent); }
.btn-icon svg { width: 22px; height: 22px; stroke-width: 1.5; }

/* Loading spinner inside button */
.btn[data-loading="true"] { color: transparent; pointer-events: none; }
.btn[data-loading="true"]::after {
    content: ''; position: absolute; inset: 0; margin: auto;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Etiquetas / Tags ---------------------------------------------------- */
.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--sp-1) var(--sp-3);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: 1.2;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius-sm);
}
.tag--new { background: var(--color-info); }
.tag--sale { background: var(--color-accent); }
.tag--top { background: #f59e0b; color: #1a1a1a; }
.tag--low { background: var(--color-surface-3); color: var(--color-warning); border: 1px solid var(--color-warning); }
.tag--out { background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-text-muted); }

/* ---- Estrellas ----------------------------------------------------------- */
.stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    color: #f5b528;
}
.stars .star { width: 14px; height: 14px; fill: currentColor; }
.stars .star--off { color: rgba(255,255,255,0.18); }

.rating-line {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-13);
    color: var(--color-text-dim);
}

/* ---- Tarjeta de producto ------------------------------------------------- */
.product-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
    position: relative;
}
.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-border);
    box-shadow: var(--shadow-lg);
}

.product-card__media {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--color-surface-2);
}

.product-card__img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--t-slow) var(--ease);
}
.product-card__img--alt {
    position: absolute; inset: 0;
    opacity: 0;
    transition: opacity var(--t) var(--ease);
}
.product-card:hover .product-card__img { transform: scale(1.04); }
.product-card:hover .product-card__img--alt { opacity: 1; }

.product-card__tags {
    position: absolute;
    top: var(--sp-3);
    left: var(--sp-3);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    z-index: 2;
}

.product-card__wishlist {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-full);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    z-index: 2;
}
.product-card__wishlist:hover { color: var(--color-accent); background: rgba(0,0,0,0.75); }
.product-card__wishlist svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.product-card__wishlist[aria-pressed="true"] svg { fill: var(--color-accent); stroke: var(--color-accent); }

.product-card__quick {
    position: absolute;
    inset: auto var(--sp-3) var(--sp-3) var(--sp-3);
    z-index: 2;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.product-card:hover .product-card__quick { opacity: 1; transform: none; }

.product-card__body {
    padding: var(--sp-4) var(--sp-4) var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.product-card__brand {
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: var(--fs-12);
    color: var(--color-text-dim);
}

.product-card__title {
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.1;
    font-size: var(--fs-18);
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}
.product-card__title a { transition: color var(--t-fast) var(--ease); }
.product-card__title a:hover { color: var(--color-accent); }

.product-card__price {
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
    margin-top: auto;
}
.product-card__price .price-now {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-20);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.product-card__price .price-was {
    font-family: var(--font-body);
    font-size: var(--fs-13);
    color: var(--color-text-muted);
    text-decoration: line-through;
}

/* ---- Tarjeta de categoría ----------------------------------------------- */
.cat-card {
    position: relative;
    display: block;
    aspect-ratio: 4/5;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-soft);
    transition: border-color var(--t) var(--ease);
}
.cat-card:hover { border-color: var(--color-accent); }
.cat-card__img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--t-slow) var(--ease), filter var(--t) var(--ease);
    filter: brightness(0.7) saturate(0.85);
}
.cat-card:hover .cat-card__img { transform: scale(1.06); filter: brightness(0.55) saturate(1); }

.cat-card__overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(10,10,11,0.95) 0%, rgba(10,10,11,0.35) 55%, rgba(10,10,11,0) 100%);
}

.cat-card__content {
    position: absolute;
    inset: auto 0 0 0;
    padding: var(--sp-6);
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: var(--sp-4);
}
.cat-card__title {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    font-size: clamp(var(--fs-24), 3vw, var(--fs-36));
    line-height: 1;
    color: #fff;
    letter-spacing: -0.01em;
}
.cat-card__arrow {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.cat-card:hover .cat-card__arrow { background: var(--color-accent); border-color: var(--color-accent); transform: translateX(4px); }
.cat-card__arrow svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; }

/* ---- Tarjeta de subcategoría -------------------------------------------- */
.subcat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.subcat-card:hover { border-color: var(--color-accent); transform: translateY(-3px); }
.subcat-card__media {
    aspect-ratio: 1/1;
    background: var(--color-surface-2);
    overflow: hidden;
}
.subcat-card__media img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform var(--t-slow) var(--ease);
    filter: brightness(0.85);
}
.subcat-card:hover .subcat-card__media img { transform: scale(1.06); filter: brightness(1); }
.subcat-card__title {
    padding: var(--sp-4);
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: var(--fs-18);
    text-align: center;
    line-height: 1.1;
}

/* ---- Inputs / Forms ------------------------------------------------------ */
.field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.field__label {
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--fs-12);
    color: var(--color-text-dim);
}

.input, .select, .textarea {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    font-size: var(--fs-15);
    width: 100%;
    transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--color-accent);
    outline: none;
    background: var(--color-surface);
}
.input::placeholder { color: var(--color-text-muted); }

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0A6B0' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.checkbox {
    display: inline-flex; align-items: flex-start; gap: var(--sp-3);
    cursor: pointer;
    font-size: var(--fs-14);
    color: var(--color-text-dim);
    line-height: 1.5;
}
.checkbox input {
    appearance: none; -webkit-appearance: none;
    width: 18px; height: 18px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.checkbox input:checked { background: var(--color-accent); border-color: var(--color-accent); }
.checkbox input:checked::after {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / 12px no-repeat;
}

.radio {
    display: inline-flex; align-items: center; gap: var(--sp-3);
    cursor: pointer;
}
.radio input {
    appearance: none;
    width: 18px; height: 18px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-2);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: border-color var(--t-fast) var(--ease);
}
.radio input:checked { border-color: var(--color-accent); }
.radio input:checked::after {
    content: ''; position: absolute; inset: 4px;
    background: var(--color-accent);
    border-radius: 50%;
}

/* ---- Selector talla / color (pill) -------------------------------------- */
.pill-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pill {
    min-width: 44px;
    min-height: 44px;
    padding: var(--sp-2) var(--sp-4);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--fs-14);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pill:hover { border-color: var(--color-accent); }
.pill[aria-pressed="true"], .pill.is-active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.swatch {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    position: relative;
    overflow: hidden;
}
.swatch:hover { transform: scale(1.05); }
.swatch[aria-pressed="true"], .swatch.is-active {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-bg) inset;
}

/* ---- Quantity stepper --------------------------------------------------- */
.qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.qty button {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--color-text);
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.qty button:hover { background: var(--color-surface-3); color: var(--color-accent); }
.qty input {
    width: 48px;
    height: 40px;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-16);
    background: transparent;
    border: none;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---- Breadcrumb --------------------------------------------------------- */
.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-13);
    color: var(--color-text-muted);
    padding-block: var(--sp-4);
}
.breadcrumb a {
    transition: color var(--t-fast) var(--ease);
    color: var(--color-text-dim);
}
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb__sep { opacity: 0.5; }
.breadcrumb__current { color: var(--color-text); }

/* ---- Iconos de confianza ------------------------------------------------ */
.trust-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-4);
}
.trust {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius);
}
.trust__icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--color-accent);
    background: rgba(225,29,46,0.08);
    border-radius: var(--radius);
}
.trust__icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.trust__text { font-size: var(--fs-13); color: var(--color-text-dim); line-height: 1.4; }
.trust__text strong { display: block; color: var(--color-text); font-weight: 600; }

/* ---- Toast -------------------------------------------------------------- */
.toast-host {
    position: fixed;
    top: calc(var(--header-h) + var(--sp-4));
    right: var(--sp-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 380px;
    color: var(--color-text);
    font-size: var(--fs-14);
    animation: toast-in 320ms var(--ease-out-soft);
    pointer-events: auto;
}
.toast--success { border-left-color: var(--color-success); }
.toast__icon { color: var(--color-accent); flex-shrink: 0; }
.toast__icon svg { width: 20px; height: 20px; }
.toast--success .toast__icon { color: var(--color-success); }
.toast--leaving { animation: toast-out 220ms var(--ease) forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(20px); }
}

/* ---- Skeleton ----------------------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-2) 0%, var(--color-surface-3) 50%, var(--color-surface-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
    border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Badge contador ---------------------------------------------------- */
.badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
    font-variant-numeric: tabular-nums;
}

.badge-count--pulse { animation: pulse 360ms var(--ease); }
@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}
