/** Checkout — Estilos adicionales de modales y autenticación */

/* ==================== SCROLLBAR TECH ==================== */
/* Los estilos del scrollbar están en checkout-tech.css */

/* ==================== MODAL LOGIN TECH ==================== */
/* Los estilos del modal están definidos en checkout-tech.css */

/* Iconos del formulario (posición) */
.login-form-icon {
    position: absolute;
    left: 14px;
    top: 36px;
    color: var(--checkout-accent, #3b82f6);
    font-size: 16px;
    pointer-events: none;
}

.toggle-password-icon {
    position: absolute;
    right: 14px;
    top: 36px;
    color: var(--checkout-accent, #3b82f6);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.toggle-password-icon:hover {
    color: var(--checkout-purple, #8b5cf6);
    transform: scale(1.1);
}

/* Padding para inputs con iconos */
.login-form-input {
    padding-left: 42px;
}

input[type="password"].login-form-input,
input[type="text"].login-form-input[id*="password"] {
    padding-right: 42px;
}

/* Loading spinner tech */
.login-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top: 4px solid var(--checkout-accent, #3b82f6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.login-loading.active {
    display: block;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Alert tech dentro del modal */
.login-alert {
    display: none;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.login-alert.active {
    display: block;
}

.login-alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid #10b981;
    color: #059669;
}

.login-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    color: #dc2626;
}

.login-alert i {
    margin-right: 10px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Generar username button */
.btn-generar-username {
    margin-left: auto;
    background: linear-gradient(135deg, var(--checkout-accent, #3b82f6), var(--checkout-purple, #8b5cf6));
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-generar-username:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}
.btn-generar-username:disabled {
    opacity: 0.6;
    cursor: wait;
}
.btn-generar-username .fa-spinner { animation: spin 1s linear infinite; }

.login-form-label {
    display: flex;
    align-items: center;
}

/* Username suggestion chips */
.username-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    animation: slideDown 0.3s ease-out;
}
.username-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid;
}
.username-chip.available {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}
.username-chip.available:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    transform: translateY(-1px);
}
.username-chip.available .chip-icon { color: #10b981; }
.username-suggestions-loading {
    font-size: 12px;
    color: var(--checkout-accent, #3b82f6);
    font-weight: 500;
    padding: 4px 0;
}

/* Responsive para iconos de formulario */
@media (max-width: 576px) {
    .login-form-icon {
        top: 34px;
        left: 12px;
        font-size: 14px;
    }

    .toggle-password-icon {
        top: 34px;
        right: 12px;
        font-size: 14px;
    }

    .login-form-input {
        padding-left: 38px;
    }

    input[type="password"].login-form-input,
    input[type="text"].login-form-input[id*="password"] {
        padding-right: 38px;
    }
}

/* ==================== MODAL TÉRMINOS Y CONDICIONES ==================== */

/* Asegurar que el modal esté oculto por defecto */
#terminosCondicionesModal {
    display: none;
}

#terminosCondicionesModal.show {
    display: block;
}

/* Backdrop oscuro personalizado */
#terminosCondicionesModal.show::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1040;
    animation: fadeIn 0.3s ease-out;
}

/* Modal flotante centrado */
#terminosCondicionesModal .modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 1050;
    max-width: 900px;
    width: 90%;
}

#terminosCondicionesModal.show .modal-dialog {
    animation: modalSlideIn 0.4s ease-out;
}

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

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

#modal-pdf-scroll-container::-webkit-scrollbar {
    width: 14px;
}

#modal-pdf-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#modal-pdf-scroll-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    border: 2px solid #f1f1f1;
}

#modal-pdf-scroll-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* Estilos para PDF.js viewer (móviles) */
#pdfjs-viewer-container {
    padding: 10px 5px;
    min-height: 500px;
}

#pdfjs-viewer-container canvas.pdfjs-page {
    max-width: 100%;
    height: auto;
}

/* Sombra del modal flotante */
#terminosCondicionesModal .modal-content {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

/* Responsive para Tablets */
@media (max-width: 768px) {
    #terminosCondicionesModal .modal-dialog {
        width: 95%;
        max-width: 95%;
    }

    #terminosCondicionesModal .modal-header {
        padding: 1.25rem 1.5rem;
    }

    #terminosCondicionesModal .modal-title {
        font-size: 1.3rem;
    }

    #terminosCondicionesModal .modal-body {
        height: 65vh;
    }

    #terminosCondicionesModal .modal-footer {
        padding: 1rem 1.5rem;
    }
}

/* Responsive para Móviles */
@media (max-width: 576px) {
    #terminosCondicionesModal .modal-dialog {
        width: 100%;
        max-width: 100%;
        height: 100%;
        margin: 0;
        transform: translate(0, 0);
        top: 0;
        left: 0;
    }

    #terminosCondicionesModal .modal-content {
        border-radius: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    #terminosCondicionesModal .modal-header {
        padding: 1rem;
        border-radius: 0;
        flex-shrink: 0;
    }

    #terminosCondicionesModal .modal-title {
        font-size: 1.1rem;
    }

    #terminosCondicionesModal .modal-title p {
        font-size: 0.8rem;
    }

    #terminosCondicionesModal .modal-body {
        height: auto;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    /* Barra de progreso más compacta */
    #terminosCondicionesModal .modal-body > div:first-child {
        padding: 10px 15px;
    }

    #modal-progress-text {
        font-size: 0.9rem;
    }

    /* Contenedor de scroll optimizado para móviles */
    #modal-pdf-scroll-container {
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    /* Iframe responsive */
    #modal-pdf-viewer,
    #modal-pdf-viewer-desktop,
    #modal-pdf-viewer-mobile {
        min-height: 100vh;
    }

    /* Indicador de scroll más pequeño */
    #modal-scroll-indicator {
        bottom: 20px;
        padding: 10px 20px;
        font-size: 13px;
        border-radius: 25px;
    }

    #terminosCondicionesModal .modal-footer {
        padding: 0.875rem;
        flex-shrink: 0;
    }

    #terminosCondicionesModal .modal-footer p {
        font-size: 0.85rem;
    }

    #terminosCondicionesModal .modal-footer .btn {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    /* Scrollbar más delgada en móviles */
    #modal-pdf-scroll-container::-webkit-scrollbar {
        width: 8px;
    }

    #modal-pdf-scroll-container::-webkit-scrollbar-thumb {
        border-radius: 4px;
    }
}

/* Responsive para móviles muy pequeños */
@media (max-width: 375px) {
    #terminosCondicionesModal .modal-title {
        font-size: 1rem;
    }

    #terminosCondicionesModal .modal-title p {
        font-size: 0.75rem;
    }

    #terminosCondicionesModal .modal-body > div:first-child {
        padding: 8px 12px;
    }

    #modal-progress-text {
        font-size: 0.85rem;
    }

    #modal-scroll-indicator {
        padding: 8px 16px;
        font-size: 12px;
    }

    #terminosCondicionesModal .modal-footer {
        padding: 0.75rem;
    }

    #terminosCondicionesModal .modal-footer p {
        font-size: 0.8rem;
    }

    #terminosCondicionesModal .modal-footer .btn {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
}

/* Mejoras de accesibilidad para touch */
@media (hover: none) and (pointer: coarse) {
    #terminosCondicionesModal .btn-close {
        width: 44px;
        height: 44px;
        padding: 12px;
    }

    #terminosCondicionesModal .modal-footer .btn {
        min-height: 44px;
        min-width: 44px;
    }
}
