/* ============================================
   MODAL DE DESCARGA CON AUTENTICACIÓN
   ============================================ */

/* Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.download-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(59, 130, 246, 0.1);
}

.download-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 svg {
    color: #3b82f6;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: rgba(51, 65, 85, 0.3);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 10px;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Modal Body */
.modal-body {
    padding: 24px 28px;
}

/* Auth Tabs */
.modal-auth-tabs {
    display: flex;
    gap: 4px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.modal-auth-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-auth-tab.active {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.modal-auth-tab:hover:not(.active) {
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.3);
}

/* Auth Forms */
.modal-auth-form {
    display: none;
}

.modal-auth-form.active {
    display: block;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Groups */
.modal-form-group {
    margin-bottom: 16px;
}

.modal-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.modal-form-group input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.8);
    border-radius: 10px;
    color: #e5e7eb;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-form-group input::placeholder {
    color: #64748b;
}

/* Submit Button */
.modal-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: 20px;
}

.modal-submit-btn:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.modal-submit-btn:active {
    transform: translateY(0);
}

.modal-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.modal-submit-btn .btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.modal-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    color: #ef4444;
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

.modal-error.show {
    display: block;
    animation: modalFadeIn 0.3s ease;
}

/* Success State */
.modal-success {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.modal-success.active {
    display: block;
    animation: modalFadeIn 0.3s ease;
}

.modal-success-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
}

.modal-success h3 {
    font-size: 20px;
    font-weight: 700;
    color: #e5e7eb;
    margin-bottom: 8px;
}

.modal-success p {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.modal-bonus-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 10px;
    font-size: 13px;
    color: #93c5fd;
}

.modal-bonus-info strong {
    color: #3b82f6;
}

/* Divider */
.modal-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #64748b;
    font-size: 12px;
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(51, 65, 85, 0.5);
}

/* Footer Note */
.modal-footer-note {
    text-align: center;
    padding: 16px 28px 24px;
    font-size: 12px;
    color: #64748b;
}

.modal-footer-note a {
    color: #3b82f6;
    text-decoration: none;
}

.modal-footer-note a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    .download-modal {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 20px 20px 14px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 18px;
    }
}
