/* =================================
   GRANXAL - ESTILOS DE MODALES
   ================================= */

/* Modal base */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Contenido del modal */
.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(-50px) scale(0.95);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Botón de cerrar */
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #6b7280;
    background-color: #f3f4f6;
}

/* Tamaños de modales */
.modal-sm .modal-content {
    max-width: 400px;
}

.modal-md .modal-content {
    max-width: 500px;
}

.modal-lg .modal-content {
    max-width: 800px;
}

.modal-xl .modal-content {
    max-width: 1200px;
}

/* Modal de términos y políticas */
.modal-legal .modal-content {
    max-width: 900px;
    padding: 40px;
}

.modal-legal h2 {
    color: #111827;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.modal-legal h3 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.modal-legal h4 {
    color: #111827;
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.modal-legal p {
    color: #374151;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.modal-legal ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.modal-legal li {
    color: #374151;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.modal-legal table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.modal-legal th,
.modal-legal td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.modal-legal th {
    font-weight: 600;
    color: #111827;
    background-color: #f9fafb;
}

.modal-legal .info-box {
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.modal-legal .highlight-box {
    background-color: #dbeafe;
    border: 1px solid #3b82f6;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e5e7eb;
    z-index: 999;
    transform: translateY(100px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-widget.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.chat-header {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
    padding: 16px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    height: 256px;
    overflow-y: auto;
    padding: 16px;
}

.chat-message {
    background-color: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
}

.chat-quick-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-quick-button {
    width: 100%;
    text-align: left;
    padding: 8px;
    font-size: 14px;
    background-color: #f9fafb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chat-quick-button:hover {
    background-color: #f3f4f6;
}

.chat-footer {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}

.chat-input-container {
    display: flex;
    gap: 0;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px 0 0 8px;
    font-size: 14px;
    outline: none;
}

.chat-input:focus {
    border-color: #0284c7;
}

.chat-send {
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chat-send:hover {
    background: #0369a1;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #111827;
    color: white;
    padding: 16px;
    z-index: 998;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cookie-text {
    flex: 1;
    font-size: 14px;
}

.cookie-text a {
    text-decoration: underline;
    color: #d1d5db;
}

.cookie-actions {
    display: flex;
    gap: 16px;
}

.cookie-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cookie-btn-accept {
    background-color: #0284c7;
    color: white;
    border: none;
}

.cookie-btn-accept:hover {
    background-color: #0369a1;
}

.cookie-btn-reject {
    background-color: transparent;
    color: white;
    border: 1px solid #6b7280;
}

.cookie-btn-reject:hover {
    border-color: #9ca3af;
}

/* Toggle switches */
.toggle-switch {
    position: relative;
    appearance: none;
    width: 48px;
    height: 24px;
    background-color: #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-switch:checked {
    background-color: #0284c7;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch:checked::before {
    transform: translateX(24px);
}

/* Loading states */
.modal.loading .modal-content {
    opacity: 0.6;
    pointer-events: none;
}

.modal.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0284c7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success/Error notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px;
    border-radius: 8px;
    color: white;
    z-index: 1001;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    background-color: #10b981;
}

.notification.error {
    background-color: #ef4444;
}

.notification.info {
    background-color: #3b82f6;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 14px;
    opacity: 0.9;
}

/* Responsive design para modales */
@media (max-width: 768px) {
    .modal-content {
        padding: 24px 20px;
        margin: 20px;
        max-height: 85vh;
    }
    
    .modal-legal .modal-content {
        padding: 30px 20px;
    }
    
    .modal-legal h2 {
        font-size: 1.5rem;
    }
    
    .modal-legal h3 {
        font-size: 1.1rem;
    }
    
    .chat-widget {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
    }
    
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-actions {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 8px;
    }
    
    .modal-content {
        padding: 20px 16px;
        border-radius: 12px;
    }
    
    .modal-close {
        top: 12px;
        right: 12px;
    }
    
    .notification {
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* Animaciones específicas */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Estilos para nuevos modales */
#contact-modal .modal-title {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#roi-modal-improved .roi-results {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}