/* 
 * Modal Styles
 * Contiene estilos para ventanas modales y overlays
 */

/* Modal overlay general */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    background: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-out;
}

/* Animaciones mejoradas para el modal */
@keyframes modalIn {
    from { 
        transform: translateY(-30px) scale(0.95); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

@keyframes modalOut {
    from { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
    to { 
        transform: translateY(-30px) scale(0.95); 
        opacity: 0; 
    }
}

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

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

/* Modal de login - Modernizado y Minimalista */
.modal-login {
    background: white;
    border-radius: 12px;
    padding: 28px;
    width: 380px;
    max-width: 90%;
    position: relative;
    animation: modalIn 0.3s;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.modal-login h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.7em;
    font-weight: 600;
}

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

/* Campos de entrada con iconos */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #f9f9f9;
    transition: all 0.2s ease;
    overflow: hidden;
}

.input-icon-wrapper:focus-within {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(165, 42, 42, 0.1);
}

.input-icon {
    color: #999;
    position: absolute;
    left: 12px;
    font-size: 16px;
}

.modal-login input[type="email"], 
.modal-login input[type="password"] {
    width: 100%;
    padding: 12px 45px 12px 40px;
    border: none;
    background: transparent;
    font-size: 15px;
    outline: none;
}

/* Padding específico para input de email (sin botón toggle) */
.modal-login input[type="email"] {
    padding-right: 12px;
}

/* Botón para mostrar/ocultar contraseña */
.password-toggle {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 16px;
    transition: all 0.2s ease;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    z-index: 10;
    border-radius: 0 6px 6px 0;
}

.password-toggle:hover {
    color: var(--primary-color);
    background-color: rgba(165, 42, 42, 0.05);
}

.password-toggle i {
    pointer-events: none;
    font-size: 14px;
}

/* Opciones de recordarme y recuperar contraseña */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    user-select: none;
    color: #666;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #e0e0e0;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.forgot-password:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.modal-login .btn-primary {
    width: 100%;
    padding: 12px;
    font-weight: 500;
    font-size: 16px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.login-error, .login-success {
    text-align: center;
    font-size: 14px;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
}

.login-error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.login-success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.4em;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.close-modal:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    transform: scale(1.1);
}

.close-modal:active {
    transform: scale(0.95);
}

.login-error, .login-success {
    color: var(--danger-color);
    margin-top: 10px;
    font-size: 0.9em;
    text-align: center;
    display: none;
}

.login-success {
    color: var(--success-color);
}

/* Modal de detalles del producto con carrusel */
.product-details-modal {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 0;
    width: 700px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s ease-out;
    transform-origin: center;
}

.details-header {
    padding: 25px;
    border-bottom: 1px solid #eee;
}

/* Carrusel de imágenes */
.image-carousel {
    margin-bottom: 20px;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: var(--border-radius);
    background: #f8f9fa;
}

.carousel-images {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.3s ease;
    pointer-events: none;
    cursor: pointer;
}

.carousel-image.active {
    opacity: 1;
    pointer-events: auto;
}

.carousel-image:hover {
    transform: scale(1.02);
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 4px;
}

.indicator.active {
    background: var(--primary-color);
    border-color: white;
    transform: scale(1.2);
}

.indicator:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.image-counter {
    text-align: center;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

/* Imagen única para productos con una sola foto */
.single-image {
    margin-bottom: 20px;
    position: relative;
}

.details-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.details-image:hover {
    transform: scale(1.02);
}

/* Indicador visual de que las imágenes son clickeables */
.carousel-image::after,
.details-image::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 8px;
    border-radius: 15px;
    font-size: 0.8em;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.carousel-container:hover .carousel-image.active::after,
.single-image:hover .details-image::after {
    opacity: 1;
}

.details-title {
    text-align: center;
}

.details-title h2 {
    margin: 0 0 10px;
    color: var(--text-color);
    font-size: 1.6rem;
}

.details-price {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--primary-color);
}

.details-body {
    padding: 25px;
}

.details-section {
    margin-bottom: 25px;
}

.details-section h3 {
    margin: 0 0 10px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.details-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.spec-item {
    padding: 12px;
    background: #f9f9f9;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    border-left: 3px solid var(--primary-color);
}

.details-actions {
    text-align: center;
}

.contact-btn-modal {
    padding: 12px 24px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Lightbox para ver imágenes en tamaño completo */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-container {
    position: relative;
    max-width: 85vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightboxIn 0.3s ease-out;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: -10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5em;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    transform: scale(1.1);
}

.lightbox-close:active {
    transform: scale(0.95);
}

/* Navegación del lightbox para múltiples imágenes */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.3em;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(165, 42, 42, 0.9);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

/* Información de la imagen */
.lightbox-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.lightbox-title {
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 5px;
}

.lightbox-counter {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Animaciones del lightbox */
@keyframes lightboxIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes lightboxOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

/* Mejora visual para el scroll */
.product-details-modal::-webkit-scrollbar {
    width: 6px;
}

.product-details-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.product-details-modal::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.product-details-modal::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ================================
   IMAGE MODAL STYLES
   ================================ */

.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    cursor: default;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.image-modal-content img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.image-modal-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Responsive para modal de imagen */
@media (max-width: 768px) {
    .image-modal-content {
        max-width: 95vw;
        max-height: 85vh;
    }
    
    .image-modal-close {
        top: 5px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
    
    .image-modal-title {
        padding: 12px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .image-modal-content {
        max-width: 98vw;
        max-height: 90vh;
    }
    
    .image-modal-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    .image-modal-title {
        padding: 10px;
        font-size: 0.9rem;
    }
}
