/* Smooth theme transition */
html, body {
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

/* Badge superior para journeys recomendados */
.journey-badge-top {
    position: absolute;
    top: -18px;
    right: -12px;
    padding: 0.4rem 1.2rem;
    border-radius: 0 0 0 16px;
    font-weight: 700;
    font-size: 0.97rem;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    letter-spacing: 0.01em;
    min-width: 110px;
    text-align: center;
    overflow: visible;
}

/* Journey Button Hover Effect */
.journey-btn {
    background: var(--bg-card, #fff);
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.7rem 0;
    transition: box-shadow 0.2s, transform 0.2s, background 0.2s, color 0.2s;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.04));
}

.journey-btn:hover,
.journey-btn:focus {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px) scale(1.03);
    background: var(--primary-3);
    color: #fff;
}

/* Custom CSS for AgenciadeBolsillo */

/* CSS Variables for consistency */
:root {
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

/* Global Styles */
body {
    font-family: 'Avenir', 'Inter', Arial, sans-serif;
    background-color: #F7F7EF;
}

/* Brandbook Font Weights */
.avenir-black {
    font-family: 'Avenir', Arial, sans-serif;
    font-weight: 900;
}

.avenir-medium {
    font-family: 'Avenir', Arial, sans-serif;
    font-weight: 500;
}

.avenir-light {
    font-family: 'Avenir', Arial, sans-serif;
    font-weight: 300;
}

/* Brandbook Colors */
:root {
    --primary-1: #BFAcFE;
    --primary-2: #D0C1FE;
    --primary-3: #8F4CFE;
    --primary-4: #8077FE;
    --primary-5: #C49DDF;
    --primary-6: #6950A3;
    --primary-7: #2F1D4D;
    --primary-8: #523870;
    --secondary-1: #ACBAF8;
    --secondary-2: #1423FF;
    --secondary-3: #00FFC3;
    --secondary-4: #00B9F8;
    --secondary-5: #00D9A4;
    --secondary-6: #2785FE;
    --secondary-7: #3C6DFD;
    --secondary-8: #144C4D;
    --secondary-9: #230577;
    --secondary-10: #0541AD;
    --gray-1: #F7F7EF;
    --gray-2: #E1E1DF;
    --gray-3: #CFD0C8;
    --gray-4: #B2B3AF;
    --gray-5: #232323;
    --gray-6: #333333;
    --gray-7: #5E5E5C;
    --gradient-1: linear-gradient(135deg, #BFAcFE 0%, #ACBAF8 100%);
    --gradient-2: linear-gradient(135deg, #8F4CFE 0%, #00FFC3 100%);
    --gradient-3: linear-gradient(135deg, #8077FE 0%, #2785FE 100%);
}

/* Header Styles */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}


/* Dashboard Enhancements */
.dashboard-header {
    background: var(--gradient-1);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
}


/* Agent Card Styles (según tipo) */
.agent-card {
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 1.5rem 1.2rem;
    font-family: 'Avenir', Arial, sans-serif;
    transition: box-shadow 0.3s, transform 0.3s;
    border: none;
}

.agent-card-recomendado {
    background: var(--gradient-2);
    color: #fff;
}

.agent-card-rapido {
    background: var(--gradient-3);
    color: #fff;
}

.agent-card-avanzado {
    background: var(--gradient-1);
    color: #fff;
}

.agent-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.18);
}

/* Filtros y controles */
.filter-bar,
.filter-select {
    background: var(--input-bg, #fff);
    border-radius: var(--border-radius-sm);
    font-family: 'Avenir', Arial, sans-serif;
    color: var(--text-secondary, var(--gray-6));
    border: 1px solid var(--border-color, var(--gray-3));
    padding: 0.5rem 1rem;
}

/* Botón principal */
.btn-primary {
    background: var(--primary-3);
    color: #fff;
    border-radius: var(--border-radius);
    font-family: 'Avenir', Arial, sans-serif;
    font-weight: 700;
    border: none;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-4);
}

/* Button Enhancements */
.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Form Enhancements */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Form Select */
.form-select {
    border-radius: var(--border-radius);
}

/* Card Animations */
.card {
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    border: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Card Header */
.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Alert Enhancements */
.alert {
    border-radius: var(--border-radius);
    border: none;
}

.alert-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.alert-danger {
    background: linear-gradient(45deg, #dc3545, #fd7e14);
    color: white;
}

.alert-warning {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    color: #212529;
}

/* Badges */
.badge {
    border-radius: var(--border-radius-sm);
}

/* Progress bars */
.progress {
    border-radius: var(--border-radius-sm);
}

/* Modal */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
}

.btn-outline-secondary {
    border-radius: var(--border-radius);
}

/* Footer Styles */
.footer {
    background: #212529;
    color: #6c757d;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.5rem !important;
    }

    .stat-card {
        margin-bottom: 1rem;
    }
}

/* ========================================
   Dark Mode Theme System
   Bootstrap 5.3 compatible using data-bs-theme
   ======================================== */

/* Theme Variables - Light (default) */
:root, [data-bs-theme="light"] {
    /* Backgrounds */
    --bg-primary: #F7F7EF;
    --bg-secondary: #ffffff;
    --bg-tertiary: #E1E1DF;
    --bg-card: #ffffff;
    --bg-navbar: var(--primary-3);
    --bg-footer: #212529;
    --bg-input: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.05);

    /* Text Colors */
    --text-primary: #232323;
    --text-secondary: #5E5E5C;
    --text-muted: #6c757d;
    --text-inverse: #ffffff;

    /* Borders */
    --border-color: #CFD0C8;
    --border-light: #E1E1DF;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.1);

    /* Form Elements */
    --input-bg: #ffffff;
    --input-border: #e9ecef;
    --input-focus-border: #667eea;

    /* Scrollbar */
    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;

    /* Cards & Components */
    --card-bg: #ffffff;
    --dropdown-bg: #ffffff;
    --modal-bg: #ffffff;
}

/* Theme Variables - Dark (Cyberpunk/Neon Style) */
[data-bs-theme="dark"] {
    /* === Colores Neón del Manual de Marca === */
    --neon-purple: #B07FFF;
    --neon-purple-glow: #9D4EDD;
    --neon-magenta: #D946EF;
    --neon-magenta-glow: #E879F9;
    --neon-pink: #FF1493;
    --neon-pink-glow: #EC4899;
    --neon-violet: #8B5CF6;
    --neon-violet-glow: #A78BFA;
    --neon-fuchsia: #C026D3;
    --neon-lavender: #BFACFE;
    --neon-lavender-glow: #D0C1FE;
    --neon-blue-purple: #7F6DF0;
    --neon-blue-purple-glow: #A5B4FC;
    --neon-cyan: #14E3FF;
    --neon-green: #0DFFC3;

    /* Backgrounds - Deep dark with purple undertones */
    --bg-primary: #0A0A0A;
    --bg-secondary: #111111;
    --bg-tertiary: #1a0a2e;
    --bg-card: #0f0f1a;
    --bg-navbar: #0a0a14;
    --bg-footer: #050508;
    --bg-input: #1a1a2e;
    --bg-hover: rgba(176, 127, 255, 0.12);

    /* Text Colors - Neon accents */
    --text-primary: #f5f5f5;
    --text-secondary: #D0C1FE;
    --text-muted: #A78BFA;
    --text-inverse: #0A0A0A;

    /* Borders - Subtle neon glow */
    --border-color: rgba(176, 127, 255, 0.3);
    --border-light: rgba(139, 92, 246, 0.2);

    /* Shadows - Neon glow effects */
    --shadow-sm: 0 2px 8px rgba(176, 127, 255, 0.15);
    --shadow-md: 0 4px 20px rgba(176, 127, 255, 0.2);
    --shadow-lg: 0 8px 40px rgba(176, 127, 255, 0.25);
    --shadow-neon: 0 0 20px rgba(176, 127, 255, 0.4), 0 0 40px rgba(157, 78, 221, 0.2);

    /* Form Elements */
    --input-bg: #1a1a2e;
    --input-border: rgba(139, 92, 246, 0.3);
    --input-focus-border: var(--neon-purple);

    /* Scrollbar */
    --scrollbar-track: #0f0f1a;
    --scrollbar-thumb: rgba(139, 92, 246, 0.4);
    --scrollbar-thumb-hover: rgba(176, 127, 255, 0.6);

    /* Cards & Components */
    --card-bg: rgba(15, 15, 26, 0.95);
    --dropdown-bg: rgba(26, 26, 46, 0.98);
    --modal-bg: #0f0f1a;

    /* Accent colors */
    --accent-primary: var(--neon-purple);
    --accent-secondary: var(--neon-cyan);
    --accent-success: var(--neon-green);
    --accent-warning: #f59e0b;
    --accent-danger: var(--neon-pink);
}

/* Apply theme variables to global elements */
[data-bs-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Smooth transition when theme changes */
body,
.card,
.modal-content,
.dropdown-menu,
.form-control,
.form-select,
.navbar {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Cards */
[data-bs-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .card-header {
    background-color: var(--bg-tertiary);
    border-bottom-color: var(--border-light);
}

/* Forms */
[data-bs-theme="dark"] .form-control {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus-border);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(143, 76, 254, 0.25);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

[data-bs-theme="dark"] .form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

/* Dropdowns */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--dropdown-bg);
    border-color: var(--border-color);
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: var(--border-light);
}

/* Modals */
[data-bs-theme="dark"] .modal-content {
    background-color: var(--modal-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: var(--border-light);
}

/* Tables */
[data-bs-theme="dark"] .table {
    color: var(--text-primary);
    --bs-table-bg: var(--bg-secondary);
    --bs-table-striped-bg: var(--bg-tertiary);
    --bs-table-hover-bg: var(--bg-hover);
}

[data-bs-theme="dark"] .table-bordered {
    border-color: var(--border-color);
}

/* Navbar dark mode */
[data-bs-theme="dark"] .navbar {
    background-color: var(--bg-navbar) !important;
}

/* Filter bar and selects */
[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .filter-select {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Scrollbar global */
[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Agent cards maintain gradients but adjust shadows */
[data-bs-theme="dark"] .agent-card {
    box-shadow: var(--shadow-md);
}

/* Footer */
[data-bs-theme="dark"] .footer {
    background: var(--bg-footer);
    color: var(--text-muted);
}

/* Error popups in dark mode */
[data-bs-theme="dark"] .error-popup {
    background: var(--card-bg);
    border-color: #dc3545;
}

[data-bs-theme="dark"] .error-popup-message {
    color: var(--text-secondary);
}

[data-bs-theme="dark"] .error-popup-close:hover {
    background: var(--bg-hover);
}

/* Links in dark mode */
[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--primary-1);
}

[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--primary-2);
}

/* Text utilities override */
[data-bs-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-bs-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-bs-theme="dark"] .text-body {
    color: var(--text-primary) !important;
}

/* Badges adjustments */
[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* Alerts in dark mode */
[data-bs-theme="dark"] .alert {
    border-color: transparent;
}

/* List groups */
[data-bs-theme="dark"] .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .list-group-item:hover {
    background-color: var(--bg-hover);
}

/* Borders */
[data-bs-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: var(--border-color) !important;
}

/* Background utilities */
[data-bs-theme="dark"] .bg-white {
    background-color: var(--bg-secondary) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: var(--bg-tertiary) !important;
}

/* Dashboard header gradient stays the same */
[data-bs-theme="dark"] .dashboard-header {
    box-shadow: var(--shadow-lg);
}

/* Journey button in dark mode */
[data-bs-theme="dark"] .journey-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .journey-btn:hover,
[data-bs-theme="dark"] .journey-btn:focus {
    background: var(--primary-3);
    color: #fff;
}

/* Error Pop-up System */
.error-popup-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 380px;
}

.error-popup {
    background: var(--bg-card, #fff);
    border: 1px solid #dc3545;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.15);
    padding: 16px 20px;
    margin-bottom: 12px;
    position: relative;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid #dc3545;
}

.error-popup.show {
    transform: translateX(0);
    opacity: 1;
}

.error-popup.hide {
    transform: translateX(100%);
    opacity: 0;
}

.error-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.error-popup-icon {
    color: #dc3545;
    font-size: 18px;
    margin-right: 8px;
}

.error-popup-title {
    color: #dc3545;
    font-weight: 600;
    font-size: 14px;
    margin: 0;
    flex: 1;
}

.error-popup-close {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.error-popup-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.error-popup-message {
    color: #495057;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

/* Success Pop-up variant */
.success-popup {
    border-color: #28a745;
    border-left-color: #28a745;
    box-shadow: 0 8px 32px rgba(40, 167, 69, 0.15);
}

.success-popup .error-popup-icon,
.success-popup .error-popup-title {
    color: #28a745;
}

/* Warning Pop-up variant */
.warning-popup {
    border-color: #ffc107;
    border-left-color: #ffc107;
    box-shadow: 0 8px 32px rgba(255, 193, 7, 0.15);
}

.warning-popup .error-popup-icon,
.warning-popup .error-popup-title {
    color: #ffc107;
}

/* Info Pop-up variant */
.info-popup {
    border-color: #17a2b8;
    border-left-color: #17a2b8;
    box-shadow: 0 8px 32px rgba(23, 162, 184, 0.15);
}

.info-popup .error-popup-icon,
.info-popup .error-popup-title {
    color: #17a2b8;
}

/* Responsive adjustments for pop-ups */
@media (max-width: 480px) {
    .error-popup-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .error-popup {
        transform: translateY(-100%);
    }

    .error-popup.show {
        transform: translateY(0);
    }

    .error-popup.hide {
        transform: translateY(-100%);
    }
}

/* Brain Hub - Icon Customization */
.brain-icon-custom {
    filter: brightness(0) invert(1);
    /* Convierte el ícono a blanco */
}