/**
 * detalle-colores.css
 * Selector visual de colores en la vista de detalle del producto
 * Integrado con el tema tech existente (detalle-tech.css)
 */

/* ============================================
   SELECTOR DE COLOR - CONTENEDOR
============================================ */
.dt-color-section {
    margin: 1.25rem 0;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
}

/* Header: "Color  Medianoche" */
.dt-color-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.dt-color-label-text {
    color: #64748b;
    font-weight: 500;
}

.dt-color-nombre-activo {
    color: #f1f5f9;
    font-weight: 700;
    transition: color 250ms ease;
}

/* ============================================
   SELECTOR DE COLOR - OPCIONES CON ETIQUETAS
============================================ */
.dt-color-opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.dt-color-opcion {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    outline: none;
    padding: 6px 10px 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 56px;
}

.dt-color-opcion:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.dt-color-opcion:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.dt-color-opcion--activo {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.dt-color-opcion--activo:hover {
    background: rgba(59, 130, 246, 0.12);
}

/* Muestra circular del color */
.dt-color-muestra {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* Nombre del color debajo */
.dt-color-nombre {
    font-size: 0.625rem;
    color: #64748b;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 200ms ease;
}

.dt-color-opcion--activo .dt-color-nombre {
    color: #93c5fd;
    font-weight: 600;
}

/* Checkmark para color seleccionado */
.dt-color-check {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    width: 16px;
    height: 16px;
    transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.dt-color-opcion--activo .dt-color-check {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.dt-color-check svg {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* Borde para colores claros/blancos */
.dt-color-opcion--claro .dt-color-muestra {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ============================================
   STOCK POR COLOR
============================================ */
.dt-color-stock {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.775rem;
    color: #94a3b8;
    margin-top: 0.875rem;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dt-color-stock i {
    font-size: 0.7rem;
}

.dt-color-stock--disponible {
    color: #10b981;
}

.dt-color-stock--bajo {
    color: #f59e0b;
}

.dt-color-stock--agotado {
    color: #ef4444;
}

/* ============================================
   BADGE DE COLOR EN CARRITO MODAL
============================================ */
.carrito-color-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 3px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 20px;
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 3px;
    line-height: 1;
    max-width: fit-content;
    position: relative;
}

.carrito-color-badge--clickable {
    cursor: pointer;
    transition: all 150ms ease;
}

.carrito-color-badge--clickable:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.25);
}

.carrito-color-badge__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.carrito-color-badge__arrow {
    font-size: 0.5rem;
    margin-left: 1px;
    opacity: 0.5;
    transition: transform 150ms ease;
}

.carrito-color-badge--abierto .carrito-color-badge__arrow {
    transform: rotate(180deg);
}

/* ============================================
   DROPDOWN DE COLORES EN CARRITO
============================================ */
.carrito-color-dropdown {
    position: fixed;
    z-index: 1090;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 4px;
    min-width: 160px;
    max-width: 220px;
    animation: carritoColorDropIn 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes carritoColorDropIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.carrito-color-dropdown__opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #334155;
    text-align: left;
    transition: background 120ms ease;
}

.carrito-color-dropdown__opt:hover {
    background: #f1f5f9;
}

.carrito-color-dropdown__opt--activo {
    background: #eff6ff;
    font-weight: 600;
    color: #1e40af;
}

.carrito-color-dropdown__opt--activo:hover {
    background: #dbeafe;
}

.carrito-color-dropdown__opt--agotado {
    opacity: 0.45;
    cursor: not-allowed;
}

.carrito-color-dropdown__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.carrito-color-dropdown__nombre {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.carrito-color-dropdown__check {
    font-size: 0.6rem;
    color: #3b82f6;
    flex-shrink: 0;
}

.carrito-color-dropdown__agotado {
    font-size: 0.6rem;
    color: #ef4444;
    flex-shrink: 0;
}

/* ============================================
   ANIMACIONES
============================================ */
@keyframes colorPulso {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
    50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); }
}

.dt-color-opcion--activo {
    animation: colorPulso 1.5s ease-in-out 1;
}

/* Transicion de imagenes al cambiar color */
.dt-gallery-main img.dt-color-transition {
    opacity: 0;
    transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dt-gallery-main img.dt-color-visible {
    opacity: 1;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 768px) {
    .dt-color-muestra {
        width: 28px;
        height: 28px;
    }

    .dt-color-opcion {
        min-width: 48px;
        padding: 5px 8px 3px;
        border-radius: 10px;
    }

    .dt-color-opciones {
        gap: 0.375rem;
    }

    .dt-color-section {
        margin: 1rem 0;
        padding: 1rem;
        border-radius: 12px;
    }

    .dt-color-nombre {
        font-size: 0.575rem;
        max-width: 52px;
    }

    .dt-color-check {
        top: 16px;
    }
}

@media (max-width: 480px) {
    .dt-color-muestra {
        width: 26px;
        height: 26px;
    }

    .dt-color-check {
        top: 15px;
    }

    .dt-color-check svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   ACCESIBILIDAD
============================================ */
@media (prefers-reduced-motion: reduce) {
    .dt-color-opcion,
    .dt-color-opcion--activo,
    .dt-color-nombre-activo,
    .dt-color-stock,
    .dt-gallery-main img {
        animation: none;
        transition-duration: 0.01ms;
    }
}
