/* ============================================================
   ESTILOS DEL CARRITO DE COMPRAS
   Dismar Caucete - E-commerce
   Versión: 1.0
   ============================================================ */

/* ============================================
   VARIABLES CSS (heredadas del proyecto)
============================================ */
:root {
    /* Modo Claro (Default) */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-inverse: #ffffff;
    --border-color: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --overlay: rgba(0, 0, 0, 0.7);
    
    /* Colores de acento */
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-success: #25D366;
    --accent-warning: #FFD93D;
    --accent-danger: #FF4500;
    --accent-info: #0066CC;
    
    /* Colores específicos del carrito */
    --cart-primary: #667eea;
    --cart-secondary: #764ba2;
    --cart-badge: #FF4500;
}

/* Modo Oscuro */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: #0f3460;
    --bg-tertiary: #16213e;
    --text-primary: #e4e4e4;
    --text-secondary: #b0b0b0;
    --text-inverse: #1a1a2e;
    --border-color: #2a2a3e;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.5);
    --overlay: rgba(0, 0, 0, 0.9);
}

/* ============================================
   BOTÓN AGREGAR AL CARRITO
============================================ */
.btn-add-cart {
    background: linear-gradient(135deg, var(--cart-primary), var(--cart-secondary));
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-add-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-add-cart:active {
    transform: translateY(0);
}

.btn-add-cart.adding {
    pointer-events: none;
}

.btn-add-cart.adding::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-add-cart.added {
    background: var(--accent-success);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   MINI CARRITO (FLOTANTE EN HEADER)
============================================ */
.mini-cart-container {
    position: relative;
}

.mini-cart-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--cart-primary);
    color: var(--cart-primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    position: relative;
    transition: all 0.3s ease;
}

.mini-cart-btn:hover {
    background: var(--cart-primary);
    color: white;
    transform: scale(1.05);
}

.mini-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--cart-badge);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    animation: bounceIn 0.3s ease;
}

.mini-cart-badge.empty {
    display: none;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Dropdown del mini carrito */
.mini-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 400px;
    background: var(--bg-secondary);
    border-radius: 15px;
    box-shadow: 0 10px 40px var(--shadow-hover);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.mini-cart-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.mini-cart-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--cart-primary), var(--cart-secondary));
    color: white;
}

.mini-cart-header h4 {
    margin: 0;
    font-size: 1rem;
}

.mini-cart-items {
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
}

.mini-cart-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.mini-cart-item:last-child {
    border-bottom: none;
}

.mini-cart-item-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white;
    border-radius: 8px;
    padding: 3px;
}

.mini-cart-item-info {
    flex: 1;
}

.mini-cart-item-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mini-cart-item-price {
    font-size: 0.9rem;
    color: var(--cart-primary);
    font-weight: 600;
}

.mini-cart-item-qty {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mini-cart-item-remove {
    background: none;
    border: none;
    color: var(--accent-danger);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.mini-cart-item-remove:hover {
    opacity: 1;
}

.mini-cart-footer {
    padding: 15px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.mini-cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.mini-cart-total-label {
    color: var(--text-secondary);
}

.mini-cart-total-value {
    color: var(--text-primary);
    font-weight: bold;
}

.mini-cart-actions {
    display: flex;
    gap: 10px;
}

.mini-cart-actions .btn {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-view-cart {
    background: var(--bg-secondary);
    color: var(--cart-primary);
    border: 2px solid var(--cart-primary);
}

.btn-view-cart:hover {
    background: var(--cart-primary);
    color: white;
}

.btn-checkout {
    background: linear-gradient(135deg, var(--cart-primary), var(--cart-secondary));
    color: white;
    border: none;
}

.btn-checkout:hover {
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.mini-cart-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
}

.mini-cart-empty i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 10px;
}

/* ============================================
   PÁGINA DEL CARRITO
============================================ */
.cart-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.cart-page-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.cart-page-title h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.cart-page-title p {
    color: var(--text-secondary);
}

/* Tabla del carrito */
.cart-table {
    background: var(--bg-secondary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px var(--shadow);
    margin-bottom: 30px;
}

.cart-table-header {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr 50px;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--cart-primary), var(--cart-secondary));
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.cart-item-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr 50px;
    gap: 15px;
    padding: 20px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.cart-item-row:hover {
    background: var(--bg-tertiary);
}

.cart-item-row:last-child {
    border-bottom: none;
}

.cart-item-product {
    display: flex;
    gap: 15px;
    align-items: center;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: white;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 2px 8px var(--shadow);
}

.cart-item-details h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 5px;
}

.cart-item-details p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

.cart-item-code {
    font-size: 0.8rem;
    color: var(--cart-primary);
}

.cart-item-price {
    color: var(--text-primary);
    font-weight: 600;
}

/* Control de cantidad */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.quantity-btn:hover {
    border-color: var(--cart-primary);
    color: var(--cart-primary);
}

.quantity-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.cart-item-subtotal {
    color: var(--cart-primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--accent-danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    opacity: 0.7;
    transition: all 0.2s;
}

.cart-item-remove:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Responsive para tabla */
@media (max-width: 768px) {
    .cart-table-header {
        display: none;
    }
    
    .cart-item-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .cart-item-product {
        grid-column: 1;
    }
    
    .cart-item-row > div:not(.cart-item-product) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
    }
    
    .cart-item-row > div:not(.cart-item-product)::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
    }
}

/* ============================================
   RESUMEN DEL CARRITO
============================================ */
.cart-summary {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px var(--shadow);
}

.cart-summary h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    color: var(--text-secondary);
}

.cart-summary-row.total {
    border-top: 2px solid var(--border-color);
    margin-top: 15px;
    padding-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
}

.cart-summary-row.total .value {
    color: var(--cart-primary);
}

.cart-summary-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-continue-shopping {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 25px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-continue-shopping:hover {
    border-color: var(--cart-primary);
    color: var(--cart-primary);
}

.btn-proceed-checkout {
    background: linear-gradient(135deg, var(--cart-primary), var(--cart-secondary));
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-proceed-checkout:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* ============================================
   CHECKOUT - FORMULARIO
============================================ */
.checkout-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.checkout-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 10px;
}

.checkout-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border-radius: 25px;
    color: var(--text-secondary);
    font-weight: 500;
}

.checkout-step.active {
    background: linear-gradient(135deg, var(--cart-primary), var(--cart-secondary));
    color: white;
}

.checkout-step.completed {
    background: var(--accent-success);
    color: white;
}

.checkout-step-number {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

@media (max-width: 992px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

.checkout-form-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px var(--shadow);
}

.checkout-form-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkout-form-section h3 i {
    color: var(--cart-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 576px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group label .required {
    color: var(--accent-danger);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--cart-primary);
}

.form-control.error {
    border-color: var(--accent-danger);
}

.form-error {
    color: var(--accent-danger);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Direcciones guardadas */
.saved-addresses {
    margin-bottom: 20px;
}

.saved-address-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.saved-address-card:hover {
    border-color: var(--cart-primary);
}

.saved-address-card.selected {
    border-color: var(--cart-primary);
    background: rgba(102, 126, 234, 0.05);
}

.saved-address-card input[type="radio"] {
    margin-top: 3px;
}

.saved-address-info {
    flex: 1;
}

.saved-address-alias {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.saved-address-alias .badge {
    background: var(--cart-primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.saved-address-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-new-address {
    background: none;
    border: 2px dashed var(--border-color);
    padding: 15px;
    border-radius: 12px;
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-new-address:hover {
    border-color: var(--cart-primary);
    color: var(--cart-primary);
}

/* ============================================
   NOTIFICACIONES TOAST
============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow-hover);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--accent-success);
}

.toast.error {
    border-left: 4px solid var(--accent-danger);
}

.toast.info {
    border-left: 4px solid var(--cart-primary);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast.success .toast-icon {
    color: var(--accent-success);
}

.toast.error .toast-icon {
    color: var(--accent-danger);
}

.toast.info .toast-icon {
    color: var(--cart-primary);
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
}

/* ============================================
   ESTADOS DE ORDEN
============================================ */
.order-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.order-status.pendiente {
    background: #fff3cd;
    color: #856404;
}

.order-status.procesando {
    background: #cce5ff;
    color: #004085;
}

.order-status.aprobada {
    background: #d4edda;
    color: #155724;
}

.order-status.rechazada {
    background: #f8d7da;
    color: #721c24;
}

.order-status.cancelada {
    background: #e2e3e5;
    color: #383d41;
}

.order-status.preparando {
    background: #e2e3ff;
    color: #4e4e8c;
}

.order-status.enviada {
    background: #d1ecf1;
    color: #0c5460;
}

.order-status.entregada {
    background: #c3e6cb;
    color: #155724;
}

/* ============================================
   CARRITO VACÍO
============================================ */
.cart-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-secondary);
    border-radius: 15px;
    box-shadow: 0 5px 20px var(--shadow);
}

.cart-empty-icon {
    font-size: 5rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

.cart-empty h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.cart-empty p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.cart-empty .btn-continue-shopping {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   ANIMACIONES
============================================ */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scale-in {
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Efecto de producto agregado */
.cart-add-animation {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    animation: flyToCart 0.6s ease-out forwards;
}

@keyframes flyToCart {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) translateY(-200px);
    }
}
