/* ============================================================
   MEMORIA - Gestión de Integraciones y Archivos
   ============================================================ */

/* ============================================================
   LOGIN SCREEN
   ============================================================ */

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.login-card h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-card h2 i {
    color: #667eea;
    margin-right: 10px;
}

.login-subtitle {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.password-input {
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.password-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.login-error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid #fcc;
}

.session-info {
    margin-top: 15px;
    color: #95a5a6;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.back-to-chat {
    display: inline-block;
    margin-top: 20px;
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.back-to-chat:hover {
    color: #764ba2;
    transform: translateX(-3px);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.memoria-content {
    padding: 30px;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
    background: #f5f7fa;
}

.memoria-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.6rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: #667eea;
}

.section-description {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin: 0;
}

/* ============================================================
   INTEGRACIONES
   ============================================================ */

.integraciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

.integration-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.integration-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: #667eea;
}

/* Estilos para tarjetas inactivas */
.integration-card.inactive-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-color: #d0d0d0;
    opacity: 0.85;
}

.integration-card.inactive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #b0b0b0;
    opacity: 1;
}

.integration-card.inactive-card .integration-icon {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    opacity: 0.7;
}

.integration-card.inactive-card h3 {
    color: #757575;
}

.integration-card.inactive-card .integration-description {
    color: #9e9e9e;
}

.integration-inactive-message {
    padding: 12px;
    background: #f0f0f0;
    border-radius: 8px;
    color: #9e9e9e;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

.integration-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.integration-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.salesforce-icon {
    background: linear-gradient(135deg, #00a1e0 0%, #0070d2 100%);
}

.meta-icon {
    background: linear-gradient(135deg, #0668e1 0%, #0a7cff 100%);
}

.email-icon {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.btn-connect {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-connect:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Estilos para sección de archivos inactiva */
.section-inactive {
    opacity: 0.95;
}

.archivos-container-inactive {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-radius: 12px;
    border: 2px solid #d0d0d0;
    padding: 60px 40px;
}

.inactive-overlay {
    text-align: center;
    max-width: 600px;
}

.inactive-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.inactive-icon {
    font-size: 5rem;
    color: #9e9e9e;
    opacity: 0.6;
    margin-bottom: 10px;
}

.inactive-content h3 {
    color: #757575;
    font-size: 1.8rem;
    margin: 0;
}

.inactive-content p {
    color: #9e9e9e;
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.6;
}

.inactive-description {
    max-width: 500px;
    font-size: 0.95rem !important;
    color: #b0b0b0 !important;
}

.btn-activate {
    margin-top: 20px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-activate:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-activate i {
    font-size: 1.1rem;
}

.integration-status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.integration-status-badge.active {
    background: #d4edda;
    color: #155724;
}

.integration-status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.integration-body h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.integration-description {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.integration-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5a6c7d;
    font-size: 0.9rem;
}

.stat-item i {
    color: #667eea;
    width: 20px;
}

.integration-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.integration-actions button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.btn-secondary:hover:not(:disabled) {
    background: #dee2e6;
}

.btn-danger {
    background: #fee;
    color: #c33;
}

.btn-danger:hover:not(:disabled) {
    background: #fcc;
}

.integration-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   ARCHIVOS
   ============================================================ */

.archivos-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.upload-icon {
    font-size: 4rem;
    color: #a0aec0;
    margin-bottom: 10px;
}

.upload-area:hover .upload-icon,
.upload-area.drag-over .upload-icon {
    color: #667eea;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

.upload-content h3 {
    color: #2d3748;
    font-size: 1.3rem;
    margin: 0;
}

.upload-content p {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

.upload-hint {
    color: #a0aec0;
    font-size: 0.85rem;
    margin-top: 10px;
}

.files-list-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.files-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
}

.files-list-header h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.files-count {
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.files-list {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #a0aec0;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0 0 8px 0;
}

.empty-state small {
    font-size: 0.9rem;
    opacity: 0.7;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.file-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.file-icon.pdf {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.file-icon.doc {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.file-icon.txt {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
}

.file-icon.csv,
.file-icon.xlsx {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: white;
    color: #667eea;
    font-size: 1rem;
}

.file-action-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.file-action-btn.delete:hover {
    background: #f44336;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .archivos-container {
        grid-template-columns: 1fr;
    }
    
    .integraciones-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .memoria-content {
        padding: 20px 15px;
    }
    
    .memoria-section {
        padding: 20px 15px;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .integration-actions {
        flex-direction: column;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .files-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
