/* ── Animaciones globales ─────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%,100% { opacity: 1; }
    50%      { opacity: .5; }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.fade-in   { animation: fadeIn .35s ease both; }
.slide-in  { animation: slideInRight .3s ease both; }

/* ── Spinner ────────────────────────────────────────────────────── */
.spinner-mini {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Skeleton loadger ─────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
}
.detalle-skeleton {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 2rem 0;
}
.skeleton-img   { aspect-ratio: 1; border-radius: 12px; }
.skeleton-info  { display: flex; flex-direction: column; gap: 1rem; padding-top: 1rem; }
.skeleton-titulo{ height: 2rem; width: 80%; }
.skeleton-precio{ height: 3rem; width: 50%; }
.skeleton-btn   { height: 3rem; width: 60%; border-radius: 10px; }

/* ── Card con loading ────────────────────────────────────────────── */
.card-loading { opacity: .7; pointer-events: none; }
.btn-loading  {
    position: relative;
    display: flex; align-items: center; justify-content: center; gap: .4rem;
}

/* ── Producto card mejorado ──────────────────────────────────────── */
.producto-card {
    transition: transform .25s ease, box-shadow .25s ease, opacity .2s ease;
}
.producto-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.btn-carrito-rapido {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: all .2s ease;
    font-size: 1rem;
}
.btn-carrito-rapido:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}
.btn-carrito-rapido:disabled { opacity: .5; cursor: not-allowed; }

/* ── Detalle producto ────────────────────────────────────────────── */
.breadcrumb {
    display: flex; gap: .5rem; align-items: center;
    font-size: .85rem; color: var(--muted); margin-bottom: 1.5rem;
}
.breadcrumb a:hover { color: var(--primary); }

.imagen-principal-wrapper {
    position: relative; border-radius: 16px; overflow: hidden;
    border: 1px solid var(--border);
    background: #F9FAFB;
}
.imagen-principal {
    width: 100%; aspect-ratio: 1;
    object-fit: contain; padding: 1rem;
    transition: transform .4s ease;
}
.imagen-principal:hover { transform: scale(1.05); }

.badge-descuento-detalle {
    position: absolute; top: 1rem; left: 1rem;
    background: var(--danger); color: white;
    font-weight: 700; font-size: .85rem;
    padding: .3rem .6rem; border-radius: 8px;
}

.miniaturas {
    display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap;
}
.miniatura {
    width: 64px; height: 64px; object-fit: contain;
    border: 2px solid var(--border); border-radius: 8px;
    cursor: pointer; padding: .25rem;
    transition: all .2s ease;
}
.miniatura:hover { border-color: var(--primary); }
.miniatura.activa { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15); }

.badge-marca {
    display: inline-block; background: #EFF6FF; color: var(--primary);
    font-size: .8rem; font-weight: 600; padding: .2rem .6rem;
    border-radius: 9999px; margin-bottom: .5rem;
}

.rating-row {
    display: flex; align-items: center; gap: .35rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.vendidos-badge {
    background: #FEF9C3; color: #92400E;
    font-size: .75rem; padding: .2rem .5rem; border-radius: 9999px;
    margin-left: .25rem;
}

/* ── Precios escalonados ─────────────────────────────────────────── */
.precios-escalonados { margin: 1rem 0; }
.tabla-precios {
    width: 100%; border-collapse: collapse;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.tabla-precios th {
    background: #F3F4F6; border: 1px solid var(--border);
    padding: .5rem .75rem; font-size: .82rem; font-weight: 600;
    color: var(--muted); text-align: center;
    transition: background .2s;
}
.tabla-precios td {
    border: 1px solid var(--border); padding: .5rem .75rem;
    font-weight: 700; color: var(--primary);
    font-size: 1rem; text-align: center;
    transition: all .2s;
}
.tabla-precios th.precio-activo { background: #DBEAFE; color: var(--primary); }
.tabla-precios td.precio-activo { background: #EFF6FF; font-size: 1.1rem; }
.precio-original-label { font-size: .8rem; color: var(--muted); margin-top: .5rem; }

/* ── Selector de cases ───────────────────────────────────────────── */
.cases-selector {
    border: 1px solid var(--border); border-radius: 12px;
    padding: 1.25rem; margin: 1rem 0;
    background: #FAFAFA;
    animation: fadeIn .3s ease;
}
.selector-titulo {
    display: flex; align-items: center; gap: .5rem;
    font-size: .95rem; font-weight: 700; margin-bottom: 1rem;
    color: var(--text);
}
.selector-icono { font-size: 1.2rem; }

.marcas-celular { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.btn-marca {
    padding: .4rem .9rem; border-radius: 9999px;
    border: 2px solid var(--border); font-size: .85rem; font-weight: 600;
    cursor: pointer; transition: all .2s ease;
    background: white; color: var(--text);
}
.btn-marca:hover { border-color: var(--primary); color: var(--primary); }
.btn-marca.activa {
    background: var(--primary); color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.input-buscar-modelo {
    width: 100%; padding: .6rem 1rem;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: .9rem; margin-bottom: .75rem;
    transition: border-color .2s, box-shadow .2s;
}
.input-buscar-modelo:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}

.lista-modelos {
    max-height: 280px; overflow-y: auto;
    display: flex; flex-direction: column; gap: .4rem;
}
.modelo-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem .9rem; border-radius: 8px;
    border: 2px solid var(--border); cursor: pointer;
    background: white; transition: all .2s ease;
}
.modelo-item:hover { border-color: var(--primary); background: #EFF6FF; }
.modelo-item.seleccionado {
    border-color: var(--primary); background: #DBEAFE;
    box-shadow: 0 0 0 3px rgba(30,58,95,.12);
}
.modelo-info { flex: 1; }
.modelo-nombre { font-weight: 600; font-size: .9rem; }
.badge-agotado {
    display: inline-block; background: #FEE2E2; color: var(--danger);
    font-size: .7rem; padding: .1rem .4rem; border-radius: 9999px;
    margin-left: .4rem;
}
.modelo-precio { text-align: right; flex-shrink: 0; }
.precio-case { font-weight: 700; color: var(--primary); font-size: .9rem; }
.precio-case-tachado { font-size: .75rem; color: var(--muted); text-decoration: line-through; margin-left: .25rem; }
.modelo-img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; border: 1px solid var(--border); }
.sin-modelos { text-align: center; color: var(--muted); padding: 1rem; font-size: .875rem; }

.case-seleccionado-info {
    margin-top: .75rem; padding: .6rem .9rem;
    background: #D1FAE5; border: 1px solid #6EE7B7;
    border-radius: 8px; font-size: .875rem; color: #065F46;
    display: flex; align-items: center; gap: .5rem;
    animation: fadeIn .3s ease;
}
.check-icon { font-size: 1rem; }

/* ── Cantidad ────────────────────────────────────────────────────── */
.cantidad-row {
    display: flex; align-items: center; gap: 1rem;
    margin: 1.25rem 0; flex-wrap: wrap;
}
.cantidad-control {
    display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden;
}
.btn-cantidad {
    width: 36px; height: 36px; font-size: 1.1rem; font-weight: 700;
    background: #F3F4F6; border: none; cursor: pointer;
    transition: background .15s;
    display: flex; align-items: center; justify-content: center;
}
.btn-cantidad:hover { background: var(--border); }
.cantidad-valor {
    min-width: 40px; text-align: center;
    font-weight: 700; font-size: 1rem;
    padding: 0 .5rem;
}
.stock-ok    { color: var(--accent); font-size: .85rem; font-weight: 600; }
.stock-agotado { color: var(--danger); font-size: .85rem; font-weight: 600; }

/* ── Botones de compra ───────────────────────────────────────────── */
.acciones-compra { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }

.btn-agregar {
    display: flex; align-items: center; gap: .5rem;
    background: var(--primary); color: white;
    padding: .75rem 1.75rem; border-radius: 10px;
    font-weight: 700; font-size: 1rem;
    border: none; cursor: pointer;
    transition: all .2s ease;
    min-width: 180px; justify-content: center;
}
.btn-agregar:hover:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30,58,95,.3);
}
.btn-agregar:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-comprar {
    padding: .75rem 1.75rem; border-radius: 10px;
    border: 2px solid var(--primary); color: var(--primary);
    font-weight: 700; font-size: 1rem; cursor: pointer;
    background: white; transition: all .2s ease;
}
.btn-comprar:hover:not(:disabled) {
    background: var(--primary); color: white;
    transform: translateY(-1px);
}
.btn-comprar:disabled { opacity: .55; cursor: not-allowed; }

.aviso-selector {
    background: #FEF9C3; border: 1px solid #FDE68A;
    border-radius: 8px; padding: .6rem .9rem;
    font-size: .85rem; color: #92400E;
    animation: fadeIn .3s ease;
}

.breve-desc {
    color: var(--muted); font-size: .9rem; line-height: 1.6;
    margin-top: 1rem; padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.descripcion-completa {
    margin-top: 2rem; background: white;
    border-radius: 12px; padding: 1.5rem;
    border: 1px solid var(--border);
    animation: fadeIn .4s ease;
}
.descripcion-completa h2 { margin-bottom: 1rem; font-size: 1.2rem; }

.seccion-selector { margin: 1rem 0; }

/* ── Botones globales mejorados ──────────────────────────────────── */
.btn-primary {
    transition: all .2s ease;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30,58,95,.3);
}
.btn-outline {
    transition: all .2s ease;
}
.btn-outline:hover {
    transform: translateY(-1px);
}

/* ── Toast mejorado ──────────────────────────────────────────────── */
.toast {
    animation: slideInRight .3s ease both;
}

/* ── Mini carrito animado ────────────────────────────────────────── */
.mini-carrito {
    transition: right .35s cubic-bezier(.4,0,.2,1);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .detalle-skeleton { grid-template-columns: 1fr; }
    .acciones-compra { flex-direction: column; }
    .btn-agregar, .btn-comprar { width: 100%; }
    .tabla-precios th, .tabla-precios td { font-size: .78rem; padding: .4rem .5rem; }
}
