:root {
    --ae-primary: #0E3950;
    --ae-primary-soft: #EEF2F5;
    --ae-secondary: #ECAD20;
    --ae-sidebar-bg: #FFFFFF;
    --ae-main-bg: #F8FAFC;
    --ae-sidebar-text: #64748B;
    --ae-sidebar-active: #0E3950;
    --ae-card-bg: #FFFFFF;
    --ae-border: #E2E8F0;
    --ae-text-main: #1E293B;
    --ae-text-muted: #64748B;
    --ae-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ae-radius: 12px;
    --ae-sidebar-width: 260px;
    --ae-sidebar-collapsed-width: 80px;
}

[data-theme="dark"] {
    --ae-primary: #0ea5e9;
    --ae-primary-soft: #1e293b;
    --ae-secondary: #ECAD20;
    --ae-sidebar-bg: #0f172a;
    --ae-main-bg: #1e293b;
    --ae-sidebar-text: #94a3b8;
    --ae-sidebar-active: #1e293b;
    --ae-card-bg: #0f172a;
    --ae-border: #334155;
    --ae-text-main: #f8fafc;
    --ae-text-muted: #94a3b8;
}

/* Transitions for dark mode */
body,
#ae-saas-sidebar,
#ae-saas-main,
.main-header,
.ae-section,
.ae-dash-card,
.ae-public-quote-container,
.ae-attention-section {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Fix specific hardcoded backgrounds for dark mode */
[data-theme="dark"] .ae-section,
[data-theme="dark"] .ae-dash-card,
[data-theme="dark"] .ae-public-quote-container,
[data-theme="dark"] .ae-attention-section,
[data-theme="dark"] .login form,
[data-theme="dark"] .ae-card,
[data-theme="dark"] #ae-ticket-view,
[data-theme="dark"] .ae-module-container,
[data-theme="dark"] .ae-support-layout,
[data-theme="dark"] .ae-guest-card,
[data-theme="dark"] .ae-list-card,
[data-theme="dark"] .ae-support-toolbar-modern,
/* Knowledge Base */
[data-theme="dark"] .ae-kb-single-container,
[data-theme="dark"] .ae-kb-sidebar-sticky,
[data-theme="dark"] .ae-kb-action-btn,
[data-theme="dark"] .ae-kb-cat-card,
[data-theme="dark"] .ae-panel-welcome,
[data-theme="dark"] .ae-kb-cat-icon,
[data-theme="dark"] .ae-kb-article-card,
[data-theme="dark"] .ae-kb-article-card a,
[data-theme="dark"] .ae-kb-search-box,
[data-theme="dark"] .ae-kb-results-dropdown,
[data-theme="dark"] #ae-kb-search-input,
[data-theme="dark"] .ae-kb-sidebar,
[data-theme="dark"] .ae-kb-toc,
[data-theme="dark"] .ae-kb-summary-box,
[data-theme="dark"] .ae-kb-feedback,
/* Chat Classes */
[data-theme="dark"] #ae-chat-widget .ae-chat-container,
[data-theme="dark"] #ae-chat-widget .ae-chat-panel,
[data-theme="dark"] #ae-chat-widget .ae-chat-messages,
[data-theme="dark"] #ae-chat-widget .ae-chat-header,
[data-theme="dark"] #ae-chat-widget .ae-chat-conversation,
[data-theme="dark"] #ae-chat-widget .ae-chat-input,
[data-theme="dark"] #ae-chat-widget .ae-chat-input-wrapper,
[data-theme="dark"] #ae-chat-widget .ae-chat-input-wrapper:focus-within,
[data-theme="dark"] #ae-chat-widget .ae-chat-input-area,
[data-theme="dark"] #ae-chat-widget .ae-chat-footer,
/* Estilos en línea expansivos del plugin y degradados */
[data-theme="dark"] [style*="linear-gradient"],
[data-theme="dark"] .ae-guest-hero,
[data-theme="dark"] .ae-filters,
[data-theme="dark"] .ae-table-container,
[data-theme="dark"] .ae-table th,
[data-theme="dark"] .ae-table td,
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background:#f0f7ff"],
[data-theme="dark"] [style*="background: #f0f7ff"],
[data-theme="dark"] [style*="background:rgba(255, 255, 255"],
[data-theme="dark"] [style*="background:rgba(255,255,255"],
[data-theme="dark"] [style*="background: rgba(255"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [class*="-container"] {
    background: var(--ae-card-bg) !important;
    border-color: var(--ae-border) !important;
}

[data-theme="dark"] .ae-table th,
[data-theme="dark"] .ae-table-header {
    background: var(--ae-sidebar-bg) !important;
    color: var(--ae-text-muted) !important;
}

[data-theme="dark"] .ae-dash-card__title,
[data-theme="dark"] .ae-list-card__title,
[data-theme="dark"] .ae-dash-card__stat-val,
[data-theme="dark"] .ae-attention-title,
[data-theme="dark"] .ae-attention-header,
[data-theme="dark"] .ae-chat-header h3,
[data-theme="dark"] .ae-chat-message,
[data-theme="dark"] .ae-chat-input,
[data-theme="dark"] .ae-kb-article-title,
[data-theme="dark"] .ae-kb-toc a,
[data-theme="dark"] .ae-kb-sidebar h5,
[data-theme="dark"] .ae-kb-action-btn,
[data-theme="dark"] .ae-panel-welcome h2,
[data-theme="dark"] .ae-table td,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--ae-text-main) !important;
}

[data-theme="dark"] .ae-dash-card__stat-label,
[data-theme="dark"] .ae-list-card__meta-item,
[data-theme="dark"] .ae-attention-info,
[data-theme="dark"] .ae-chat-status,
[data-theme="dark"] .ae-chat-footer,
[data-theme="dark"] .ae-kb-article-excerpt,
[data-theme="dark"] .ae-kb-breadcrumb,
[data-theme="dark"] .ae-kb-breadcrumb a,
[data-theme="dark"] .ae-kb-article-meta,
[data-theme="dark"] .ae-kb-cat-info span,
[data-theme="dark"] p {
    color: var(--ae-text-muted) !important;
}

[data-theme="dark"] .ae-panel-welcome p {
    color: var(--ae-text-muted) !important;
    opacity: 1 !important;
}

[data-theme="dark"] .ae-chat-message.user {
    background-color: var(--ae-primary) !important;
    color: #fff !important;
}

[data-theme="dark"] .ae-chat-message.bot {
    background-color: var(--ae-sidebar-bg) !important;
    color: var(--ae-text-main) !important;
}

[data-theme="dark"] .ae-attention-icon,
[data-theme="dark"] .ae-dash-card__icon {
    background-color: var(--ae-primary-soft) !important;
    color: var(--ae-secondary) !important;
}

/* Eliminar degradados erróneos en botones por estilos en línea del plugin */
[data-theme="dark"] [style*="linear-gradient"] {
    background: var(--ae-primary-soft) !important;
    color: var(--ae-text-main) !important;
    border-color: var(--ae-border) !important;
}

/* Fix specific buttons that might have gradients */
[data-theme="dark"] .ae-btn--primary {
    background: var(--ae-secondary) !important;
    color: #fff !important;
}

[data-theme="dark"] .header-search,
[data-theme="dark"] .login input[type="text"],
[data-theme="dark"] .login input[type="password"] {
    background-color: var(--ae-main-bg) !important;
    color: var(--ae-text-main) !important;
    border-color: var(--ae-border) !important;
}

[data-theme="dark"] .ae-attention-item {
    background-color: var(--ae-main-bg) !important;
    border-color: var(--ae-border) !important;
}

[data-theme="dark"] .ae-attention-item:hover {
    background-color: var(--ae-primary-soft) !important;
}

[data-theme="dark"] .main-header {
    background-color: var(--ae-sidebar-bg) !important;
    border-bottom-color: var(--ae-border) !important;
}

[data-theme="dark"] .sidebar-toggle-btn,
[data-theme="dark"] .header-btn {
    color: var(--ae-text-main) !important;
}

[data-theme="dark"] .sidebar-toggle-btn:hover,
[data-theme="dark"] .header-btn:hover {
    background-color: var(--ae-primary-soft) !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--ae-text-main);
    background-color: var(--ae-main-bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Layout Container */
#ae-saas-layout {
    display: flex;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Sidebar */
#ae-saas-sidebar {
    width: var(--ae-sidebar-width);
    background: var(--ae-sidebar-bg);
    border-right: 1px solid var(--ae-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Permitir que los tooltips sobresalgan solo cuando está colapsado */
body.sidebar-collapsed #ae-saas-sidebar {
    overflow: visible;
}

/* Collapsed Sidebar State */
body.sidebar-collapsed #ae-saas-sidebar {
    width: var(--ae-sidebar-collapsed-width);
}

body.sidebar-collapsed #ae-saas-sidebar .brand-text,
body.sidebar-collapsed #ae-saas-sidebar .nav-text {
    display: none !important;
}

body.sidebar-collapsed #ae-saas-sidebar .sidebar-brand {
    padding: 24px 0;
    justify-content: center;
    display: flex;
}

body.sidebar-collapsed #ae-saas-sidebar .sidebar-nav {
    padding: 0;
}

body.sidebar-collapsed #ae-saas-sidebar .nav-list a {
    justify-content: center;
    padding: 15px 0;
    gap: 0;
    border-radius: 0;
}

body.sidebar-collapsed #ae-saas-sidebar .nav-list a .dashicons {
    margin: 0;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.sidebar-brand {
    padding: 10px 24px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--ae-border);
    margin-bottom: 10px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* 
.sidebar-logo .logo-full img,
.sidebar-logo .logo-full .dashicons {
    max-height: 40px;
    width: auto;
}
*/

.sidebar-logo .mini-logo-img img {
    max-height: 32px;
    width: auto;
}

.sidebar-logo .mini-logo-img,
.sidebar-logo .mini-logo-icon {
    display: none;
}

body.sidebar-collapsed .sidebar-logo .logo-full {
    display: none !important;
}

body.sidebar-collapsed .sidebar-logo .mini-logo-img,
body.sidebar-collapsed .sidebar-logo .mini-logo-icon {
    display: flex !important;
    justify-content: center;
    width: 100%;
}

/* Custom Login Page Styles */
/*
body.login {
    background-color: var(--ae-main-bg) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
*/

#login {
    padding: 0 !important;
    width: 400px !important;
}

.login form {
    padding: 30px !important;
    background: #fff !important;
    border: 1px solid var(--ae-border) !important;
    border-radius: var(--ae-radius) !important;
    box-shadow: var(--ae-shadow) !important;
}

.login label {
    font-weight: 500 !important;
    color: var(--ae-text-main) !important;
    margin-bottom: 8px !important;
}

.login input[type="text"],
.login input[type="password"] {
    border-radius: 8px !important;
    border: 1px solid var(--ae-border) !important;
    padding: 10px !important;
    background: #F1F5F9 !important;
}

.wp-core-ui .button-primary {
    background: var(--ae-primary) !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-weight: 600 !important;
    height: 44px !important;
    line-height: 44px !important;
    padding: 0 30px !important;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 20px;
    color: var(--ae-primary);
    white-space: nowrap;
}

.sidebar-logo .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
    transition: all 0.3s ease;
}

body.sidebar-collapsed .sidebar-nav {
    overflow: visible;
}

.nav-list {
    list-style: none;
}

.nav-list li {
    margin-bottom: 4px;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--ae-sidebar-text);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-list a:hover {
    background: var(--ae-primary-soft);
    color: var(--ae-primary);
}

.nav-list .current-menu-item a,
.nav-list a.active {
    background: var(--ae-primary-soft);
    color: var(--ae-primary);
    border-left: 3px solid var(--ae-secondary);
}

.nav-list .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Tooltips para Sidebar Colapsado (Modern Style) */
body.sidebar-collapsed .nav-list li {
    position: relative;
    overflow: visible;
}

body.sidebar-collapsed .nav-list li a::after {
    content: attr(data-ae-tooltip);
    position: absolute;
    left: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    background: rgba(14, 57, 80, 0.95);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

body.sidebar-collapsed .nav-list li a::before {
    content: '';
    position: absolute;
    left: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%) translateX(-5px);
    border: 6px solid transparent;
    border-right-color: rgba(14, 57, 80, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

body.sidebar-collapsed .nav-list li:hover a::after,
body.sidebar-collapsed .nav-list li:hover a::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0px);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--ae-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.user-avatar img {
    border-radius: 50%;
    border: 2px solid var(--ae-border);
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ae-text-main);
}

.user-role {
    font-size: 11px;
    color: var(--ae-text-muted);
}

/* Main Content Area */
#ae-saas-main {
    flex: 1;
    margin-left: var(--ae-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - var(--ae-sidebar-width));
}

body.sidebar-collapsed #ae-saas-main {
    margin-left: var(--ae-sidebar-collapsed-width);
    width: calc(100% - var(--ae-sidebar-collapsed-width));
}

.main-header {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid var(--ae-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 10000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ae-text-muted);
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: var(--ae-primary-soft);
    color: var(--ae-primary);
}

.header-search {
    display: flex;
    align-items: center;
    background: #F1F5F9;
    padding: 8px 16px;
    border-radius: 8px;
    width: 300px;
}

.header-search .dashicons {
    color: var(--ae-text-muted);
    font-size: 18px;
    margin-right: 8px;
}

.header-search input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-btn {
    background: transparent;
    border: none;
    color: var(--ae-text-muted);
    cursor: pointer;
    font-size: 20px;
    display: flex;
}

.header-logout {
    text-decoration: none;
    color: var(--ae-text-main);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-logout:hover {
    color: var(--ae-primary);
}

/* Content Area */
.content-area {
    padding: 10px;
    width: 100%;
    flex: 1;
}

.ae-panel-container {
    max-width: 100% !important;
}

/* Full Width Support */
.ae-panel-stats {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    gap: 24px !important;
    margin-bottom: 40px !important;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .header-search {
        width: 200px;
    }
}

@media (max-width: 768px) {
    #ae-saas-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    #ae-saas-sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-active #ae-saas-sidebar {
        transform: translateX(0);
        width: 260px;
    }

    /* Mostrar texto cuando el sidebar está ACTIVO en móvil, incluso si tiene clase collapsed */
    body.sidebar-active #ae-saas-sidebar .nav-text,
    body.sidebar-active #ae-saas-sidebar .brand-text,
    body.sidebar-active #ae-saas-sidebar .user-info {
        display: block !important;
    }

    body.sidebar-active #ae-saas-sidebar .nav-list a {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
        gap: 12px !important;
    }

    body.sidebar-active #ae-saas-sidebar .sidebar-brand {
        justify-content: flex-start !important;
        padding: 30px 24px !important;
    }

    body.sidebar-active #ae-saas-sidebar .sidebar-logo .logo-full {
        display: flex !important;
    }

    body.sidebar-active #ae-saas-sidebar .sidebar-logo .mini-logo-img,
    body.sidebar-active #ae-saas-sidebar .sidebar-logo .mini-logo-icon {
        display: none !important;
    }

    .main-header {
        padding: 0 20px;
    }

    .header-search {
        display: none;
    }

    .content-area {
        padding: 20px;
    }

    .ae-panel-stats {
        grid-template-columns: 1fr !important;
    }
}

/* ERP UI Refinements */
.ae-section {
    background: #fff !important;
    border: 1px solid var(--ae-border) !important;
    border-radius: var(--ae-radius) !important;
    box-shadow: var(--ae-shadow) !important;
    margin-bottom: 30px !important;
}

.ae-btn--primary {
    background-color: var(--ae-secondary) !important;
    color: #fff !important;
}

.ae-btn--primary:hover {
    background-color: #d1991a !important;
}

/* Scrollbar adjustment */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 404 Page Styles */
.ae-404-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px);
    padding: 40px;
    animation: fadeIn 0.8s ease-out;
}

.ae-404-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 60px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.ae-404-icon {
    font-size: 80px;
    color: var(--ae-secondary);
    margin-bottom: 20px;
}

.ae-404-icon .dashicons {
    width: 80px;
    height: 80px;
    font-size: 80px;
}

.ae-404-title {
    font-size: 100px;
    font-weight: 900;
    line-height: 1;
    margin: 0;
    background: linear-gradient(135deg, var(--ae-primary), var(--ae-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.8;
}

.ae-404-subtitle {
    font-size: 24px;
    font-weight: 700;
    color: var(--ae-primary);
    margin: 20px 0 10px;
}

.ae-404-text {
    color: var(--ae-text-muted);
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.6;
}

.ae-404-search {
    margin: 40px 0;
}

.ae-search-form {
    max-width: 450px;
    margin: 0 auto;
}

.ae-search-input-group {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ae-border);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ae-search-input-group:focus-within {
    border-color: var(--ae-primary);
    box-shadow: 0 10px 15px -3px rgba(14, 57, 80, 0.1), 0 4px 6px -2px rgba(14, 57, 80, 0.05);
    transform: translateY(-2px);
}

.ae-search-icon {
    color: var(--ae-text-muted);
    font-size: 20px;
    margin-right: 12px;
}

.ae-search-field {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 10px 0 !important;
    font-size: 16px !important;
    color: var(--ae-primary) !important;
    outline: none !important;
}

.ae-search-submit {
    background: var(--ae-primary);
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.ae-search-submit:hover {
    background: #144e6d;
    transform: scale(1.02);
}

.ae-404-actions {
    margin-top: 20px;
}

.ae-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--ae-primary);
    color: white !important;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ae-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(14, 57, 80, 0.2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .ae-404-glass {
        padding: 40px 20px;
    }

    .ae-404-title {
        font-size: 70px;
    }
}

/* ==========================================================================
   NOTIFICACIONES (Campanita)
   ========================================================================== */
.ae-notif-wrapper {
    position: relative;
    display: inline-block;
}

.ae-notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--ae-sidebar-bg);
}

.ae-notif-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 350px;
    background: var(--ae-card-bg);
    border: 1px solid var(--ae-border);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 10001;
    overflow: hidden;
    animation: slideInNotif 0.3s ease-out;
}

@keyframes slideInNotif {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ae-notif-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ae-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ae-notif-header h3 {
    font-size: 16px;
    margin: 0;
    color: var(--ae-text-main);
}

.ae-notif-clear-all {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--ae-primary);
    cursor: pointer;
    padding: 0;
}

.ae-notif-clear-all:hover {
    text-decoration: underline;
}

.ae-list__item-action {
    padding: 6px;
    border-radius: 6px;
    background: var(--ae-primary);
    color: white;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
}

.ae-list__item-action:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.ae-list__item-action .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ae-row-read .dashicons-visibility {
    opacity: 0.6;
}

.ae-notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.ae-notif-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ae-border);
    display: flex;
    gap: 15px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    position: relative;
}

.ae-notif-item:hover {
    background: var(--ae-primary-soft);
}

.ae-notif-item.unread {
    background: rgba(14, 57, 80, 0.03);
}

.ae-notif-item.unread::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--ae-secondary);
    border-radius: 50%;
}

.ae-notif-item:not(.unread) {
    opacity: 0.7;
}

.ae-notif-item:not(.unread) .ae-notif-icon {
    filter: grayscale(1);
    opacity: 0.5;
}

.ae-notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--ae-primary-soft);
    color: var(--ae-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ae-notif-content {
    flex: 1;
    min-width: 0;
}

.ae-notif-title {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--ae-text-main);
    display: block;
}

.ae-notif-text {
    font-size: 12.5px;
    color: var(--ae-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ae-notif-time {
    font-size: 11px;
    color: var(--ae-text-muted);
    margin-top: 6px;
    display: block;
}

.ae-notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--ae-text-muted);
    font-size: 14px;
}

.ae-notif-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--ae-border);
}

.ae-notif-footer a {
    font-size: 13px;
    font-weight: 600;
    color: var(--ae-primary);
    text-decoration: none;
}

[data-theme="dark"] .ae-notif-item.unread {
    background: rgba(14, 165, 233, 0.05);
}

/* Search Results Styles */
.ae-search-results-page {
    padding: 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.ae-search-header {
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--ae-border);
}

.ae-search-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--ae-text-main);
    margin-bottom: 8px;
}

.ae-search-query {
    color: var(--ae-secondary);
}

.ae-search-meta {
    font-size: 14px;
    color: var(--ae-text-muted);
}

.ae-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.ae-search-card {
    background: var(--ae-card-bg);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    padding: 24px;
    display: flex;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.ae-search-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--ae-secondary);
}

.ae-search-card-icon {
    width: 56px;
    height: 56px;
    background: var(--ae-primary-soft);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ae-primary);
    flex-shrink: 0;
}

.ae-search-card-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.ae-search-card-content {
    flex: 1;
    min-width: 0;
}

.ae-search-card-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ae-secondary);
    margin-bottom: 6px;
    display: block;
}

.ae-search-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ae-text-main);
    margin-bottom: 8px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ae-search-card-excerpt {
    font-size: 14px;
    color: var(--ae-text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ae-search-empty {
    text-align: center;
    padding: 80px 40px;
    background: var(--ae-card-bg);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    margin-top: 20px;
}

.ae-search-empty-icon {
    font-size: 80px;
    color: var(--ae-text-muted);
    margin-bottom: 24px;
    opacity: 0.3;
}

.ae-search-empty-icon .dashicons {
    width: 80px;
    height: 80px;
    font-size: 80px;
}

.ae-search-empty-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--ae-text-main);
    margin-bottom: 12px;
}

.ae-search-empty-text {
    color: var(--ae-text-muted);
    font-size: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.ae-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.ae-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--ae-card-bg);
    border: 1px solid var(--ae-border);
    color: var(--ae-text-main);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.ae-pagination .page-numbers:hover {
    background: var(--ae-primary-soft);
    border-color: var(--ae-primary);
}

.ae-pagination .page-numbers.current {
    background: var(--ae-primary);
    color: #fff;
    border-color: var(--ae-primary);
}

/* --- MEJORAS DE INTERFAZ: HEADER & SIDEBAR DYNAMIC --- */
.ae-header-login-btn {
    background: var(--ae-secondary);
    color: #fff !important;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(236, 173, 32, 0.15);
}

.ae-header-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(236, 173, 32, 0.2);
    background: #f1b735;
}

.header-user-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 5px;
}

.user-name-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--ae-text-main);
    opacity: 0.8;
}

/* Sidebar Footer Dinámico */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0; /* Permite que el flex-child se encoja */
}

.ae-user-info-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ae-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

.ae-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    background: #10b981;
    border: 1.5px solid var(--ae-sidebar-bg);
    border-radius: 50%;
}

.ae-user-badge {
    font-size: 9px;
    font-weight: 800;
    background: var(--ae-secondary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-block;
    margin-top: 2px;
}

.user-logout-mini {
    flex-shrink: 0;
    color: var(--ae-text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    padding: 4px;
}

.user-logout-mini:hover {
    color: #ef4444;
}

.user-avatar {
    position: relative;
    flex-shrink: 0;
}

/* Guest Card Sidebar */
.sidebar-guest-card {
    padding: 5px;
}

.ae-sidebar-login-btn {
    background: var(--ae-primary-soft);
    color: var(--ae-primary) !important;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.3s;
    border: 1px solid var(--ae-border);
}

.ae-sidebar-login-btn:hover {
    background: var(--ae-primary);
    color: #fff !important;
    border-color: var(--ae-primary);
    transform: translateY(-2px);
}

body.sidebar-collapsed .sidebar-guest-card {
    padding: 10px 0;
    display: flex;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    width: 100%;
    position: relative;
}

.ae-user-details-tip {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

body.sidebar-collapsed #ae-saas-sidebar .ae-user-details-tip {
    display: none !important;
}

body.sidebar-collapsed #ae-saas-sidebar .user-profile.ae-user-profile-active .ae-user-details-tip {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    left: calc(var(--ae-sidebar-collapsed-width) - 20px);
    top: -80px; 
    background: var(--ae-sidebar-bg);
    border: 1px solid var(--ae-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.12);
    z-index: 10002;
    min-width: 200px;
    animation: slideInUser 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* El botón de logout ahora se muestra DENTRO de la tarjeta tip */
body.sidebar-collapsed #ae-saas-sidebar .user-profile:hover .user-logout-mini {
    display: flex !important;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ae-border);
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    font-size: 13px;
    color: var(--ae-text-muted);
}

body.sidebar-collapsed #ae-saas-sidebar .user-profile:hover .user-logout-mini::after {
    content: 'Cerrar sesión';
    margin-left: 10px;
    font-weight: 500;
}

body.sidebar-collapsed #ae-saas-sidebar .user-profile:hover .user-logout-mini:hover {
    color: #ef4444;
}

body.sidebar-collapsed .ae-sidebar-login-btn span:last-child {
    display: none;
}

body.sidebar-collapsed .ae-sidebar-login-btn {
    padding: 12px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
}

[data-theme="dark"] .ae-sidebar-login-btn {
    background: rgba(255,255,255,0.05);
    color: #fff !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUser {
    from { 
        opacity: 0; 
        transform: translateX(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

/* Use the specific animation for the user popover */
body.sidebar-collapsed .user-profile:hover .ae-user-info-wrapper,
body.sidebar-collapsed .user-profile:hover .user-logout-mini {
    animation: slideInUser 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}