/**
 * Carta Common — Estilos compartidos por todas las vistas de carta
 * Ruta: /cartas/assets/carta-common.css
 *
 * Prefijo de clases: .cc-
 * Las vistas mantienen sus propios estilos específicos de layout.
 */

/* ══════════════════════════════════════════════════════════════
   VARIABLES
   ══════════════════════════════════════════════════════════════ */
   :root {
    --cc-primary: #2c3e50;
    --cc-secondary: #e74c3c;
    --cc-heart: #e74c3c;          /* Los corazones siempre rojos */
    --cc-alergeno-bg: #fff3cd;
    --cc-alergeno-fg: #664d03;
    --cc-traza-bg: #6c757d;
    --cc-traza-fg: #ffffff;
    --cc-indicador-bg: rgba(13, 202, 240, 0.15);
    --cc-indicador-fg: #055160;
}

/* ══════════════════════════════════════════════════════════════
   ANIMACIONES
   ══════════════════════════════════════════════════════════════ */
.cc-fade-in { animation: ccFadeIn .25s ease; }

@keyframes ccFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cc-fade-in { animation: none; }
    * { transition-duration: 0.01ms !important; }
}

/* ══════════════════════════════════════════════════════════════
   BADGES (alérgenos, trazas, indicadores)
   ══════════════════════════════════════════════════════════════ */
.cc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.cc-badge {
    display: inline-block;
    font-size: 0.72rem;
    line-height: 1.2;
    padding: 0.2rem 0.45rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.cc-badge-alergeno {
    background: var(--cc-alergeno-bg);
    color: var(--cc-alergeno-fg);
}

.cc-badge-traza {
    background: var(--cc-traza-bg);
    color: var(--cc-traza-fg);
}

.cc-badge-indicador {
    background: var(--cc-indicador-bg);
    color: var(--cc-indicador-fg);
}

/* Variantes sobre fondo oscuro (stories, swipe, pantalla) */
.cc-dark .cc-badge-alergeno { background: rgba(255, 243, 205, 0.9); }
.cc-dark .cc-badge-indicador { background: rgba(13, 202, 240, 0.25); color: #cff4fc; }
.cc-dark .cc-badge-traza { background: rgba(108, 117, 125, 0.75); }

/* ══════════════════════════════════════════════════════════════
   CORAZONES / WISHLIST
   ══════════════════════════════════════════════════════════════ */
.cc-heart-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 0.2rem;
    transition: color .2s ease, transform .2s ease;
    line-height: 1;
}

.cc-heart-btn:hover { color: var(--cc-heart); transform: scale(1.1); }
.cc-heart-btn.active { color: var(--cc-heart); }

/* Botón circular flotante sobre imagen */
.cc-heart-float {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    color: #bbb;
    z-index: 10;
    transition: transform .2s ease, color .2s ease;
}

.cc-heart-float:hover { transform: scale(1.1); }
.cc-heart-float.active { color: var(--cc-heart); }

/* ══════════════════════════════════════════════════════════════
   ITEMS DEL MODAL DE WISHLIST
   ══════════════════════════════════════════════════════════════ */
.cc-wishlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.cc-wishlist-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.35rem;
    flex-shrink: 0;
}

.cc-wishlist-name {
    flex: 1;
    font-size: 0.88rem;
    min-width: 0;
}

.cc-wishlist-remove {
    background: none;
    border: none;
    color: var(--cc-heart);
    cursor: pointer;
    padding: 0.35rem;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.cc-wishlist-remove:hover { opacity: .7; }

/* ══════════════════════════════════════════════════════════════
   ESTADOS DE CARGA / VACÍO / ERROR
   ══════════════════════════════════════════════════════════════ */
.cc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    gap: 0.75rem;
    color: #999;
    font-size: 0.9rem;
}

.cc-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #999;
    font-size: 0.9rem;
}

.cc-error {
    text-align: center;
    padding: 2rem 1rem;
    color: #c0392b;
    font-size: 0.9rem;
}

.cc-error-retry {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #999;
}

/* ══════════════════════════════════════════════════════════════
   NAVEGACIÓN DE CATEGORÍAS (scroll horizontal sin barra)
   ══════════════════════════════════════════════════════════════ */
.cc-nav-scroll {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0.5rem;
}

.cc-nav-scroll::-webkit-scrollbar { display: none; }

.cc-nav-scroll > * { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   UTILIDADES
   ══════════════════════════════════════════════════════════════ */
.cc-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cc-no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* ══════════════════════════════════════════════════════════════
   INDICADOR DE VÍDEO EN MINIATURAS
   Se muestra cuando el producto tiene vídeo pero en el listado
   se está mostrando la foto (prioridad foto en grid).
   ══════════════════════════════════════════════════════════════ */
.cc-video-icon {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 9;
    pointer-events: none;
}

/* Corazón arriba a la derecha en las miniaturas de listado */
.cc-heart-float.cc-top-right {
    top: 0.5rem;
    right: 0.5rem;
    bottom: auto;
    left: auto;
}