/* Estilos para la página de productos */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Chewy';
    overflow-x: hidden !important;
}

.products-page {
    background: linear-gradient(119.28deg, #FFFFFF 7.28%, #4EDAFF 118.25%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100vh;
}

/* Estilos para la sección de productos */
.products-section {
    padding: 250px 20px 80px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 80px;
}

/* Estilos para las tarjetas de productos */
.product-card {
    background-color: #fff;
    object-fit: cover;
    border-radius: 31px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 349px;
    width: 349px;
    margin: 0 auto;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.product-image {
    height: 349px;
    padding-bottom: 100%;
    width: 349px;
    overflow: hidden;
    position: relative;
    border-radius: 31px;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

/* Estilo para la imagen primaria (visible por defecto) */
.product-image .primary-image {
    opacity: 1;
    position: absolute;
    top: 0;
    left: 0;
}

/* Estilo para la imagen secundaria (oculta por defecto) */
.product-image .secondary-image {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
}

/* Efecto hover: ocultar primera imagen y mostrar segunda */
.product-card:hover .product-image .primary-image {
    opacity: 0;
}

.product-card:hover .product-image .secondary-image {
    opacity: 1;
    transform: scale(1.05);
}

/* Estilos para el carrito */
.cart-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Media queries para el botón del carrito */
@media (max-width: 768px) {
    .cart-btn {
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .cart-btn {
        top: 10px;
        right: 10px;
        font-size: 1.3rem;
        width: 35px;
        height: 35px;
    }
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #000000;
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Carrito de compras (modal) */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-overlay.open {
    visibility: visible;
    opacity: 1;
}

.cart-modal {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background-color: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease, visibility 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transform: translateX(0);
    border-left: 1px solid #e0e0e0;
}

.cart-modal.open {
    right: 0;
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 480px) {
    .cart-modal {
        width: 100%;
        right: -100%;
    }
}

.cart-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.close-cart {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-bottom: 10px;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    padding-top: 10px;
}

.cart-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

@media (max-width: 480px) {
    .cart-header {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }

    .cart-header h2 {
        font-size: 1.3rem;
    }
}

.cart-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 600;
    font-family: 'Chewy';
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
}

.empty-cart i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    position: relative;
}

@media (max-width: 480px) {
    .cart-item {
        flex-wrap: wrap;
        padding: 12px 0;
    }
}

.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 480px) {
    .cart-item-image {
        width: 60px;
        height: 60px;
        margin-right: 10px;
    }
}

.cart-item-details {
    flex-grow: 1;
}

@media (max-width: 480px) {
    .cart-item-details {
        width: calc(100% - 70px);
    }
}

.cart-item-name {
    font-size: 1rem;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

@media (max-width: 480px) {
    .cart-item-name {
        font-size: 0.95rem;
        margin-bottom: 3px;
    }
}

.cart-item-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ff6b6b;
    margin-bottom: 8px;
}

@media (max-width: 480px) {
    .cart-item-price {
        font-size: 0.9rem;
        margin-bottom: 3px;
    }
}

.cart-item-controls {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

@media (max-width: 480px) {
    .cart-item-controls {
        margin-top: 8px;
    }
}

.cart-item-decrease,
.cart-item-increase {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 480px) {

    .cart-item-decrease,
    .cart-item-increase {
        width: 32px;
        height: 32px;
    }
}

.cart-item-quantity {
    margin: 0 10px;
    font-weight: 500;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    border-radius: 50%;
    font-size: 1.1rem;
    margin-left: 10px;
}

.cart-item-remove:hover {
    color: #ff4d4d;
    background-color: rgba(255, 77, 77, 0.1);
}

@media (max-width: 480px) {
    .cart-item-remove {
        position: absolute;
        top: 10px;
        right: 0;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .cart-footer {
        padding-top: 15px;
        margin-top: 15px;
    }

    .cart-total-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding: 10px 0;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .cart-total-container {
        margin-bottom: 15px;
    }
}

.cart-total {
    font-weight: 700;
    color: #333;
}

.checkout-btn {
    width: 100%;
    padding: 14px;
    background-color: #00B6E6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: 'Chewy';
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkout-btn:hover {
    background-color: #0099CC;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.checkout-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.checkout-btn:disabled {
    background-color: #00B6E6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 480px) {
    .checkout-btn {
        padding: 12px;
        font-size: 1rem;
    }
}

/* Spinner pequeño para botones */
.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Estilos para la confirmación de añadir al carrito */
.add-to-cart-confirmation {
    position: fixed;
    top: 10px;
    right: 20px;
    background-color: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    animation: slideIn 0.3s ease forwards;
}

.add-to-cart-confirmation i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.add-to-cart-confirmation.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Estilos para la página de detalle de producto */

.container {
    padding: 80px 20px;
}

.container-products {
    padding: 80px 20px;
    margin-right: 60px;
    margin-top: -5rem;
}

.product-detail-page {
    background: linear-gradient(119.28deg, #FFFFFF 7.28%, #4EDAFF 118.25%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100%;
    padding: 300px 80px;

}

.product-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

.product-detail.mobile-layout {
    flex-direction: column;
}

.product-detail.mobile-layout .product-images,
.product-detail.mobile-layout .product-info {
    width: 100%;
}

@media (max-width: 768px) {
    .product-detail-page {
        padding: 180px 20px 60px;
    }

    .product-info {
        margin-right: 0;
        padding: 20px;
    }

    .product-title {
        font-size: 42px;
    }

    .product-price {
        font-size: 20px;
    }

    .product-slogan {
        font-size: 20px;
        margin-bottom: 50px;
    }

}

@media (max-width: 480px) {
    .product-detail-page {
        padding: 160px 15px 40px;
    }

    .main-image {
        width: 100%;
        height: auto;
        max-height: 350px;
        border-radius: 30px;
    }

    .product-title {
        font-size: 32px;
    }

    .product-actions {
        margin-top: 30px;
    }

    .quantity-btn,
    #productQuantity,
    .add-to-cart-btn {
        height: 45px;
        font-size: 24px;
        max-width: 45px;
    }

    #productQuantity,
    .add-to-cart-btn {
        width: 100%;
        max-width: 200px;
        font-size: 24px;
    }
}

/* Estilos para la galería de imágenes */

.product-images {
    flex: 1;
}

.main-image {
    width: 708px;
    height: 708px;
    border-radius: 61px;
    overflow: hidden;
    margin-bottom: 20px;
    z-index: 1000;
}

.main-image img {
    width: 708px;
    height: 708px;
    object-fit: cover;
}

.image-gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.gallery-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.gallery-thumbnail.active,
.gallery-thumbnail:hover {
    opacity: 1;
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex: 1;
    padding: 0px;
    margin-right: 12rem;
}

.product-title {
    font-family: 'Chewy';
    font-size: 64px;
    font-weight: 400;
    margin-bottom: 10px;
    color: #3D95AC;
}

.product-price {
    font-family: 'Chewy';
    font-size: 32px;
    font-weight: 400;
    color: #165566;
    margin-bottom: 25px;
}

.product-slogan {
    font-family: 'Chewy';
    font-size: 24px;
    font-weight: 400;
    color: #3D95AC;
    margin-bottom: 100px;
}

.product-description {
    color: #165566;
    font-size: 22px;
    font-family: 'Chewy';
    font-weight: 400;
    margin-top: 44px;
}

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.product-detail {
    font-size: 22px;
    font-family: 'Chewy';
    font-weight: 400;
    color: #165566;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 14px;
}

.product-detail span {
    font-family: 'Chewy';
    font-size: 24px;
    font-weight: 400;
    color: #3D95AC;
}

.product-actions {
    margin-top: 50px;
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    max-width: 428px;
    justify-content: space-between;
}

.quantity-btn {
    width: 150px;
    height: 56px;
    border: none;
    background-color: #ffffff;
    color: #00bcd4;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 32px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.quantity-btn.minus {
    border-radius: 56px 0 0 56px;
}

.quantity-btn.plus {
    border-radius: 0 56px 56px 0;
}

.quantity-btn:hover {
    background-color: #00bcd4;
    color: white;
}

#productQuantity {
    width: 325px;
    height: 56px;
    text-align: center;
    border: none;
    background-color: #fff;
    margin: 0 6px;
    font-size: 32px;
    font-weight: 400;
    font-family: 'Chewy';
    color: #00B6E6;
    border-radius: 0;
}

.add-to-cart-btn {
    width: 325px;
    height: 56px;
    background-color: #ffffff;
    color: #00B6E6;
    border: none;
    border-radius: 56px;
    font-size: 32px;
    font-family: 'Chewy';
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-self: center;
    justify-content: center;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(0, 188, 212, 0.3);
}

.add-to-cart-btn:hover {
    background-color: #00B6E6;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 188, 212, 0.4);
}


/* Estilos para mensajes de error */
.error-message {
    text-align: center;
    padding: 40px 20px;
    background-color: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.error-message i {
    font-size: 3rem;
    color: #ff6b6b;
    margin-bottom: 15px;
}

.error-message p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

.error-message .btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4a6fa5;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.error-message .btn:hover {
    background-color: #3a5a8c;
}

/* Estilos para la carga de productos */
.loading-products,
.loading-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    width: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(74, 111, 165, 0.2);
    border-top-color: #4a6fa5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Estilos para dispositivos móviles */
@media (max-width: 768px) {
    .container {
        padding: 0px 20px;
        z-index: 1000;
    }

    .container-products {
        padding: 0 0;
        margin-top: -5rem;
        margin-right: 0;
        z-index: 1000;
    }

    .add-to-cart-btn {
        width: 250px;
    }

    .products-section {
        padding: 180px 20px 60px;
    }

    .product-card {
        height: 180px;
        width: 180px;
        object-fit: cover;
    }

    .product-image {
        height: 180px;
        width: 180px;
        padding-bottom: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .cart-modal {
        max-width: 320px;
    }

    .cart-content {
        padding: 15px;
    }

    .product-name {
        font-size: 1rem;
    }

    .view-details-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .add-to-cart-btn {
        width: 250px;
        height: 56px;
    }

    .cart-modal {
        max-width: 100%;
    }

    .product-detail {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .main-image {
        height: 350px;
        width: 100%;
        object-fit: cover;
    }

    .main-image img {
        width: 350px;
        height: 350px;
        border-radius: 61px;
        object-fit: cover;
    }

    .product-title {
        font-size: 1.8rem;
    }

    .product-images,
    .product-info {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-section {
        padding: 160px 5px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 25px;
    }

    .cart-modal {
        max-width: 100%;
        width: 100%;
    }

    .cart-content {
        padding: 10px;
    }

    .cart-item {
        padding: 10px 0;
        flex-wrap: wrap;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-name {
        font-size: 0.9rem;
    }

    .cart-item-price {
        font-size: 1rem;
    }

    .cart-item-controls {
        margin-top: 5px;
    }

    .cart-item-remove {
        margin-left: auto;
    }

    .page-title {
        font-size: 2.5rem;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    .cart-footer {
        margin-top: 15px;
        padding-top: 15px;
    }

    .cart-total-container {
        margin-bottom: 15px;
        font-size: 1.1rem;
    }

    .checkout-btn {
        padding: 10px;
        font-size: 0.9rem;
    }

    .container-products {
        margin-right: 0;
    }
}