/* ============================================================
   VARIABLES & RESET
   ============================================================ */
:root {
    --black: #000000;
    --black-soft: #0a0a0a;
    --surface: #111113;
    --surface-2: #1c1c1f;
    --white: #ffffff;
    --white-dim: rgba(255,255,255,0.72);
    --white-muted: rgba(255,255,255,0.38);
    --accent: #ff2d55;        /* Instagram-red */
    --accent-glow: rgba(255,45,85,0.35);
    --gold: #f5a623;
    --cat-active-bg: #ffffff;
    --cat-active-text: #000000;
    --cat-bg: rgba(255,255,255,0.10);
    --cat-text: rgba(255,255,255,0.65);
    --radius-card: 0px;
    --radius-pill: 999px;
    --radius-sm: 8px;
    --font-display: 'Georgia', 'Times New Roman', serif;
    --font-body: -apple-system, 'SF Pro Text', 'Segoe UI', sans-serif;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
    --header-h: 104px;
}

*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--black);
    color: var(--white);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0;
    /* glass effect */
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.92) 0%,
        rgba(0,0,0,0.75) 70%,
        rgba(0,0,0,0) 100%
    );
    padding: 14px 16px 0;
    pointer-events: none; /* children re-enable */
}

.top-bar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: all;
}

.top-bar__logo {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1.5px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    /* Si hay imagen del local, se aplica via JS como background-image */
}

.top-bar__info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.top-bar__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.top-bar__table {
    font-size: 11px;
    color: var(--white-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* Categorías */
.top-bar__categories {
    display: flex;
    gap: 6px;
    padding: 10px 0 14px;
    overflow-x: auto;
    scrollbar-width: none;
    pointer-events: all;
    -webkit-overflow-scrolling: touch;
}

.top-bar__categories::-webkit-scrollbar { display: none; }

.cat-btn {
    flex-shrink: 0;
    padding: 5px 13px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255,255,255,0.18);
    background: var(--cat-bg);
    color: var(--cat-text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
    letter-spacing: 0.1px;
}

.cat-btn:hover {
    background: rgba(255,255,255,0.18);
    color: var(--white);
}

.cat-btn.active {
    background: var(--cat-active-bg);
    color: var(--cat-active-text);
    border-color: transparent;
    font-weight: 700;
}

/* ============================================================
   REEL FEED
   ============================================================ */
.reel-feed {
    position: fixed;
    inset: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.reel-feed::-webkit-scrollbar { display: none; }

/* ============================================================
   REEL ITEM
   ============================================================ */
.reel-item {
    position: relative;
    width: 100%;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background: var(--black);
}

/* Imagen de fondo fullscreen */
.reel-item__bg {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center;
    /* Loaded via IntersectionObserver para performance */
    transition: opacity 400ms ease;
    opacity: 0;
}

.reel-item__bg.loaded { opacity: 1; }

/* Overlay gradiente para legibilidad del texto */
.reel-item__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.90) 0%,
        rgba(0,0,0,0.45) 35%,
        rgba(0,0,0,0.10) 65%,
        rgba(0,0,0,0.45) 100%
    );
    pointer-events: none;
}

/* Contenido principal (abajo izquierda) */
.reel-item__content {
    position: absolute;
    bottom: 0; left: 0; right: 72px;
    padding: 0 16px 32px;
    z-index: 10;
}

.reel-item__category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
    opacity: 0.9;
}

.reel-item__title {
    font-family: var(--font-display);
    font-size: clamp(22px, 6vw, 30px);
    font-weight: 700;
    line-height: 1.15;
    color: var(--white);
    margin-bottom: 6px;
    text-shadow: 0 2px 16px rgba(0,0,0,0.6);
    /* Limitar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reel-item__price {
    font-size: 20px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.reel-item__price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--white-dim);
    margin-right: 3px;
}

.reel-item__desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--white-dim);
    /* Colapsar por defecto */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 10px;
}

.reel-item__desc.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

/* Ingredientes */
.reel-item__ingredients {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.ingredient-tag {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-pill);
    padding: 3px 9px;
    letter-spacing: 0.2px;
}

/* ============================================================
   SIDE ACTIONS (Like, Share)
   ============================================================ */
.reel-item__actions {
    position: absolute;
    right: 0;
    bottom: 80px;
    width: 68px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-bottom: 4px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--white);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* Área táctil mínima 44px */
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
}

.action-btn__icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    transition: transform var(--transition-bounce), background var(--transition-fast);
    will-change: transform;
}

.action-btn:active .action-btn__icon {
    transform: scale(0.88);
}

.action-btn__count {
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    min-width: 24px;
    text-align: center;
    letter-spacing: -0.3px;
    line-height: 1;
}

/* SVG dentro de botones */
.action-btn svg {
    width: 24px; height: 24px;
    transition: transform var(--transition-bounce);
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* Like activo */
.action-btn--like.liked .action-btn__icon {
    background: var(--accent-glow);
}

.action-btn--like.liked svg {
    animation: heart-pop var(--transition-bounce) forwards;
}

@keyframes heart-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.45); }
    70%  { transform: scale(0.90); }
    100% { transform: scale(1.0); }
}

/* ============================================================
   SKELETON LOADER
   ============================================================ */
.skeleton-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--black);
    display: flex;
    align-items: flex-end;
    transition: opacity 300ms ease;
}

.skeleton-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.skeleton-reel {
    width: 100%;
    height: 100dvh;
    position: relative;
}

.skeleton-img {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #222 50%, #1a1a1a 100%);
    background-size: 200% 200%;
    animation: shimmer 1.6s ease infinite;
}

.skeleton-content {
    position: absolute;
    bottom: 32px; left: 16px; right: 80px;
    display: flex; flex-direction: column; gap: 10px;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: rgba(255,255,255,0.10);
    width: 100%;
    animation: shimmer 1.6s ease infinite;
}

.skeleton-line--short { width: 45%; height: 10px; }
.skeleton-line--med   { width: 70%; }

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50%       { background-position: 100% 50%; }
}

/* ============================================================
   SCROLL INDICATOR (puntos laterales)
   ============================================================ */
.scroll-indicator {
    position: fixed;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 300ms ease;
}

.scroll-indicator:hover { opacity: 0.9; }

.scroll-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--white-muted);
    transition: height 300ms var(--transition-bounce), background 200ms ease;
}

.scroll-dot.active {
    height: 16px;
    border-radius: 2px;
    background: var(--white);
    opacity: 1;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: rgba(30, 30, 32, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.10);
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    animation: toast-in 250ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.toast--out {
    animation: toast-out 250ms ease forwards;
}

.toast.toast--error { border-color: var(--accent); }
.toast.toast--success { border-color: rgba(52, 211, 153, 0.5); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0)    scale(1);    }
    to   { opacity: 0; transform: translateY(-6px) scale(0.94); }
}

/* ============================================================
   EMPTY / ERROR STATE
   ============================================================ */
.empty-state {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--white-muted);
    scroll-snap-align: start;
}

.empty-state__icon {
    font-size: 48px;
    opacity: 0.4;
}

.empty-state__text {
    font-size: 15px;
    font-weight: 500;
    color: var(--white-dim);
}

.empty-state__sub {
    font-size: 13px;
    color: var(--white-muted);
}

/* ============================================================
   MEDIA — pantallas más grandes (tablet desktop)
   ============================================================ */
@media (min-width: 500px) {
    .reel-feed {
        max-width: 430px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        width: 430px;
    }

    .top-bar {
        max-width: 430px;
        left: 50%;
        transform: translateX(-50%);
    }

    .scroll-indicator {
        right: calc(50% - 230px);
    }

    .toast-container {
        max-width: 400px;
    }
}