/* ============================================================
   REPUESTOS — Estilos copiados del proyecto Laravel original.
   Fuente: /var/www/albion/public/css/main.css (secciones REPUESTOS *)
   y repuestos_cart.blade.php inline styles.
   ============================================================ */

/* Asegura que [hidden] gane sobre display:flex/grid de clases. */
[hidden] { display: none !important; }

/* Repuesto code badge — color oscurecido a gray-600 para llegar a contraste
   WCAG AA (≥4.5:1) sobre el fondo gray-100. */
.repuesto-code {
    display: inline-block;
    background: #f3f4f6;
    color: #4b5563;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.repuesto-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.375rem;
    line-height: 1.3;
    text-align: center;
    color: #111827;
}

.card__description {
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0 0 0.5rem;
    color: #6b7280;
}

/* Repuesto actions container */
.repuesto-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Quantity input + button styling */
.repuesto-quantity {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    align-items: center;
}

.repuesto-quantity__label {
    font-size: var(--fs-label);
    font-weight: 600;
    color: #374151;
}

.repuesto-add-btn {
    width: 100%;
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.repuesto-add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Empty state for repuestos */
.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 4rem 0;
}
.empty-state__content {
    text-align: center;
    max-width: 500px;
}
.empty-state__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.empty-state__message {
    color: #9ca3af;
    font-size: 1rem;
}

/* ============================================================
   GRID COMPACTO DE CARDS DE REPUESTOS
   ============================================================ */
.section--lines .cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.section--lines .card {
    background: #fff;
    border: 1px solid var(--gray-20, #e8e8ea);
    border-radius: var(--radius-2, 12px);
    padding: 0.75rem;
    box-shadow: var(--shadow-1, 0 2px 8px rgba(0,0,0,.08));
    overflow: visible;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.section--lines .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2, 0 8px 24px rgba(0,0,0,.12));
    border-color: rgba(20,68,140,.25);
}

.section--lines .card__media {
    height: 100px;
    min-height: 100px;
    margin-bottom: 0.5rem;
    width: 100%;
    overflow: hidden;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-10, #f3f4f6);
    aspect-ratio: unset !important;
    padding: 0.5rem;
    border: 0;
    cursor: zoom-in;
}
.section--lines .card__media img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    object-position: center;
}
.section--lines .card__body {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section--lines .repuesto-code {
    font-size: var(--fs-label);
    padding: 0.1rem 0.3rem;
    margin-bottom: 0.25rem;
    display: block;
    text-align: center;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 3px;
    font-weight: 600;
}

.section--lines .repuesto-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    line-height: 1.3;
    text-align: center;
    color: #111827;
}

.section--lines .repuesto-actions { gap: 0.5rem; margin-top: 0.5rem; }
.section--lines .repuesto-quantity__label { font-size: var(--fs-label); }
.section--lines .repuesto-quantity__input { padding: 0.25rem 0.375rem; font-size: 0.8rem; }
.section--lines .repuesto-add-btn { padding: 0.375rem 0.5rem; font-size: 0.8rem; }

/* Ver más button */
.btn-more {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-left: 0.25rem;
    transition: color 0.2s ease;
}
.btn-more:hover { color: #1d4ed8; }

/* ============================================================
   Quantity controls (E-commerce style)
   ============================================================ */
.quantity-controls {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    width: 120px;
    min-width: 120px;
}
.quantity-controls:hover {
    border-color: var(--brand-primary, #14448C);
    box-shadow: 0 2px 8px rgba(20, 68, 140, 0.1);
}
.quantity-controls:focus-within {
    border-color: var(--brand-primary, #14448C);
    box-shadow: 0 0 0 3px rgba(20, 68, 140, 0.1);
}
.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    user-select: none;
    flex-shrink: 0;
    box-sizing: border-box;
    min-width: 32px;
    max-width: 32px;
    flex-basis: 32px;
}
.quantity-btn:hover { background: #f3f4f6; color: var(--brand-primary, #14448C); }
.quantity-btn:active { background: #e5e7eb; transform: scale(0.95); }
.quantity-btn--minus { border-right: 1px solid #e5e7eb; }
.quantity-btn--plus { border-left: 1px solid #e5e7eb; }

.repuesto-quantity__input,
.cart-item__quantity-input {
    flex: 1;
    text-align: center;
    border: none;
    background: transparent;
    padding: 0.5rem 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    outline: none;
    transition: all 0.15s ease;
    min-width: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.repuesto-quantity__input:focus,
.cart-item__quantity-input:focus { background: #f8fafc; color: var(--brand-primary, #14448C); }
.repuesto-quantity__input::-webkit-outer-spin-button,
.repuesto-quantity__input::-webkit-inner-spin-button,
.cart-item__quantity-input::-webkit-outer-spin-button,
.cart-item__quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================================
   FLOATING CART BUTTON (bottom-right, next to WhatsApp)
   ============================================================ */
.float-cart {
    position: fixed;
    bottom: 20px;
    right: 95px; /* Posicionado a la izquierda del botón de WhatsApp */
    z-index: 1200;
    transition: all 0.3s ease;
    animation: cartAttention 10s ease-in-out infinite;
}
.float-cart[hidden] { display: none !important; }

.float-cart__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #14448C;
    color: white;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(20, 68, 140, 0.3);
    transition: all 0.3s ease;
    position: relative;
}
.float-cart__link:hover {
    background: #0f3366;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(20, 68, 140, 0.4);
}
.float-cart__icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
}
.float-cart__count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    border: 2px solid white;
}
@keyframes cartAttention {
    0%, 95% { transform: translateY(0); }
    96%     { transform: translateY(-3px); }
    97%     { transform: translateY(0); }
    98%     { transform: translateY(-2px); }
    99%, 100% { transform: translateY(0); }
}
.float-cart:hover { animation-play-state: paused; }
@media (max-width: 768px) {
    .float-cart { bottom: 20px; right: 100px; }
}

/* ============================================================
   MODALES (imagen / descripción)
   ============================================================ */
.repuesto-modal,
.image-modal {
    position: fixed; inset: 0;
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.repuesto-modal[hidden],
.image-modal[hidden] { display: none; }

.repuesto-modal__overlay,
.image-modal__overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.7);
}
.repuesto-modal__content,
.image-modal__container {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}
.image-modal__container {
    background: transparent;
    padding: 0;
    max-width: 95vw;
    max-height: 95vh;
}
.image-modal__img {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 8px;
    background: #fff;
    display: block;
    margin: 0 auto;
}
.repuesto-modal__close,
.image-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 0;
    background: rgba(255,255,255,.95);
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    display: grid;
    place-items: center;
    z-index: 2;
}
.repuesto-modal__title {
    margin: 0 36px 12px 0;
    color: var(--gray-90, #1f1f1f);
    font-size: 1.2rem;
    font-weight: 800;
}
.repuesto-modal__description {
    margin: 0;
    color: #374151;
    line-height: 1.6;
}
.repuesto-image-clickable { cursor: pointer; }

/* ============================================================
   CARRITO — página /repuestos/carrito
   ============================================================ */
.cart-items__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.cart-items__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}
.cart-items__list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px auto;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.cart-item__image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
}
.cart-item__image img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.cart-item__code {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.cart-item__name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
}
.cart-item__quantity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
    align-items: center;
}
.cart-item__remove {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
}
.cart-item__remove:hover { background: #b91c1c; transform: scale(1.05); }
.cart-item__remove:active { transform: scale(0.95); }
.cart-item__remove svg { width: 16px; height: 16px; stroke: currentColor; }

.cart-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    padding: 2rem;
}
.cart-empty__content {
    text-align: center;
    max-width: 500px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 3rem 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.cart-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: #6b7280;
    opacity: 0.8;
}
.cart-empty__icon svg { width: 100%; height: 100%; stroke: currentColor; }
.cart-empty__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.75rem;
}
.cart-empty__message {
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}
.cart-empty__actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}
.cart-empty__actions .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.cart-empty__actions .btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.cart-empty__actions .btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }

.btn--secondary {
    background: #fff;
    color: var(--brand-primary, #14448C);
    border: 2px solid var(--brand-primary, #14448C);
}
.btn--secondary:hover {
    background: rgba(20, 68, 140, 0.08);
}
.btn--small { padding: 6px 12px !important; font-size: .85rem !important; }

/* ============================================================
   Toast / mensaje flash
   ============================================================ */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1500;
    pointer-events: none;
}
.message {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-weight: 600;
    pointer-events: auto;
}
.message--success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.message--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ============================================================
   Responsive — mobile cart layout
   ============================================================ */
@media (max-width: 768px) {
    .cart-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 1rem;
        padding: 8px;
        position: relative !important;
        min-height: 100px;
        overflow: visible;
    }
    .cart-item__image { width: 80px !important; height: 80px !important; flex-shrink: 0; }
    .cart-item__info { flex: 0 0 60%; min-width: 0; padding-right: 80px; }
    .cart-item__name { font-size: 1rem; }
    .cart-item__quantity {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 10;
        width: auto;
        min-width: 60px;
    }
    .cart-item__quantity .quantity-controls {
        width: 80px;
        min-width: 80px;
    }
    .cart-item__quantity .quantity-btn {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        flex-basis: 24px !important;
    }
    .cart-item__remove {
        position: absolute !important;
        bottom: 10px !important;
        right: 10px !important;
        width: 30px !important;
        height: 30px !important;
        z-index: 10;
    }
    .cart-item__remove svg { width: 12px !important; height: 12px !important; }
}

/* =====================================================================
   TARGETS TACTILES EN MOBILE — catalogo de repuestos
   El bloque de cantidad era el peor de todo el sitio: el input medida
   54x32, los botones de mas/menos 32x44 (angostos) y el boton de agregar
   270x36. Multiplicado por las 76 tarjetas de la pagina, era la mayor
   fuente de targets chicos del audit.
   ===================================================================== */
@media (max-width: 767px) {
  .repuesto-quantity__input {
    min-height: 44px;
  }
  .quantity-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .repuesto-add-btn {
    min-height: 44px;
  }
  .btn-more {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* El bloque de cantidad mide 120px de ancho: al llevar los botones de
   mas/menos a 44px, el input (flex: 1 1 0) se quedaba con 30px. Se
   ensancha la fila para que los tres controles entren con 44px cada uno. */
@media (max-width: 767px) {
  .quantity-controls {
    width: 100%;
    min-width: 148px;
  }
  .repuesto-quantity__input {
    min-width: 44px;
  }
}
