/* Estilos específicos para el carrito de compras */

/* ===== ÍCONO DEL CARRITO EN HEADER ===== */
.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    margin-left: 20px;
    padding: 10px;
    border-radius: 8px;
    transition: var(--transition);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon:hover {
    color: var(--primary-color);
    background-color: rgba(255, 107, 107, 0.1);
}

.cart-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--primary-color);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
    border: 2px solid var(--bg-color);
}

/* ===== CARRITO DROPDOWN ===== */
.cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 20px;
    display: none;
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    margin-top: 5px;
}

.cart-dropdown.show {
    display: block;
    animation: fadeInDropdown 0.3s ease;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-dropdown .cart-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.cart-dropdown .cart-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cart-dropdown .cart-item-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.cart-dropdown .cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-dropdown .cart-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-dropdown .cart-item-price {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

.cart-dropdown .cart-item-remove {
    color: #999;
    cursor: pointer;
    transition: var(--transition);
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.cart-dropdown .cart-item-remove:hover {
    color: var(--primary-color);
    background-color: rgba(255, 107, 107, 0.1);
}

.cart-dropdown .empty-cart {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px 0;
}

.cart-dropdown .cart-total {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: bold;
    color: var(--text-color);
}

.cart-dropdown .checkout-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    display: block;
    transition: var(--transition);
}

.cart-dropdown .checkout-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ===== PÁGINA DEL CARRITO ===== */
.cart-section {
    padding: 60px 0;
    min-height: 60vh;
}

.cart-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.cart-items-table {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.cart-items-table table {
    width: 100%;
    border-collapse: collapse;
}

.cart-items-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.cart-items-table td {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    vertical-align: middle;
}

.cart-items-table tr:last-child td {
    border-bottom: none;
}

.cart-product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-product-info .cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.cart-product-info div {
    flex: 1;
}

.cart-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.cart-item-category {
    color: #666;
    font-size: 0.9rem;
}

.cart-item-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 5px;
    border: 1px solid #ddd;
    width: fit-content;
}

.quantity-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.quantity-btn:hover {
    background-color: var(--secondary-color);
}

.quantity-input {
    width: 60px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--text-color);
}

.cart-item-total {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.cart-item-actions .cart-item-remove {
    background-color: #dc3545;
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.cart-item-actions .cart-item-remove:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

/* ===== RESUMEN DEL CARRITO ===== */
.cart-summary {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 120px;
}

.cart-summary h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-color);
}

.cart-summary-row.total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
}

.cart-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 25px;
}

.continue-shopping-btn {
    padding: 12px 20px;
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--text-color);
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.continue-shopping-btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.checkout-btn {
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.checkout-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ===== CARRITO VACÍO ===== */
.empty-cart-message {
    text-align: center;
    padding: 80px 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 30px;
}

.empty-cart-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-cart-message h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.empty-cart-message p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* ===== NOTIFICACIONES MEJORADAS ===== */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-color);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1100;
    max-width: 350px;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background-color: #dc3545;
    border-left-color: rgba(255, 255, 255, 0.3);
}

.notification.success {
    background-color: #28a745;
    border-left-color: rgba(255, 255, 255, 0.3);
}

.notification.warning {
    background-color: #ffc107;
    color: #212529;
    border-left-color: rgba(0, 0, 0, 0.3);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.notification-content i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-content span {
    font-weight: 500;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0.8;
}

.notification-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.notification.error .notification-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.notification.success .notification-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.notification.warning .notification-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Animación de entrada mejorada */
@keyframes notificationSlideIn {
    0% {
        transform: translateX(400px) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(-10px) scale(1.02);
        opacity: 0.9;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.notification.show {
    animation: notificationSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .cart-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .cart-summary {
        position: static;
    }
    
    .cart-dropdown {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .cart-items-table {
        overflow-x: auto;
    }
    
    .cart-items-table table {
        min-width: 600px;
    }
    
    .cart-dropdown {
        width: 260px;
        right: -20px;
    }
    
    .quantity-selector {
        flex-direction: column;
        gap: 5px;
    }
    
    .quantity-input {
        width: 50px;
    }
    
    .notification {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
        min-width: auto;
    }
    
    .nav-controls {
        position: relative;
    }
}

@media (max-width: 480px) {
    .cart-section {
        padding: 40px 0;
    }
    
    .cart-summary {
        padding: 20px;
    }
    
    .cart-items-table th,
    .cart-items-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    
    .cart-product-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .cart-product-info .cart-item-img {
        width: 60px;
        height: 60px;
    }
}

/* ===== MODO OSCURO ===== */
.dark-mode .cart-icon:hover {
    color: var(--accent-color);
    background-color: rgba(255, 165, 0, 0.1);
}

.dark-mode .cart-count {
    background-color: var(--accent-color);
    border-color: #222935;
}

.dark-mode .cart-dropdown {
    background-color: #222935;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .cart-dropdown .cart-item {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .cart-dropdown .cart-total {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .cart-dropdown .cart-item-remove:hover {
    color: var(--accent-color);
    background-color: rgba(255, 165, 0, 0.1);
}

.dark-mode .cart-items-table {
    background-color: #222935;
}

.dark-mode .cart-items-table td {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .cart-summary {
    background-color: #222935;
}

.dark-mode .quantity-selector {
    background-color: #2a2e3a;
    border-color: #444;
}

.dark-mode .continue-shopping-btn {
    border-color: var(--text-color);
    color: var(--text-color);
}

.dark-mode .continue-shopping-btn:hover {
    background-color: var(--text-color);
    color: #222935;
}

.dark-mode .notification {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}