/* Site Design System - NotesApp (LiVnetNotes) */
:root, [data-bs-theme="light"] {
    --sidebar-bg: #0f172a;
    --sidebar-color: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: #334155;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #0ea5e9;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --pinned-bg: #fffbe8;
    --pinned-border: #fde047;
    --editor-bg: #ffffff;
}

[data-bs-theme="dark"] {
    --sidebar-bg: #090d16;
    --sidebar-color: #94a3b8;
    --sidebar-hover: #161e2e;
    --sidebar-active: #1f293d;
    --primary-color: #6366f1;
    --primary-hover: #818cf8;
    --accent-color: #38bdf8;
    --bg-light: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --pinned-bg: #1e1b4b;
    --pinned-border: #4338ca;
    --editor-bg: #1e293b;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100vh;
}

/* 3-Column Layout Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Column 1: Sidebar */
.app-sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.sidebar-brand i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.sidebar-menu-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin: 1.25rem 0.5rem 0.5rem 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    color: var(--sidebar-color);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #f8fafc;
}

.sidebar-nav-item.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-nav-item .badge-count {
    font-size: 0.75rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 1rem;
    padding: 0.15rem 0.5rem;
}

/* Column 2: Note List */
.app-note-list {
    width: 340px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    background-color: var(--card-bg);
}

.search-input-group {
    position: relative;
}

.search-input-group i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-group input {
    padding-left: 2.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.list-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.note-card {
    padding: 0.85rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid transparent;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.note-card:hover {
    background-color: var(--sidebar-hover);
    border-color: var(--card-border);
}

.note-card.active {
    background-color: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
}

.note-card.is-pinned {
    background-color: var(--pinned-bg);
    border-color: var(--pinned-border);
}

.note-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.note-card-snippet {
    font-size: 0.825rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.note-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Column 3: Note Editor Detail */
.app-note-editor {
    flex: 1;
    background-color: var(--editor-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    background-color: var(--editor-bg);
    flex-wrap: wrap; /* Envolvente fluida en todas las pantallas si el espacio no alcanza */
}

@media (min-width: 1200px) {
    .editor-header {
        padding: 0.75rem 1.5rem;
    }
}

.editor-header-title {
    flex: 1 1 auto;
    min-width: 160px;
    max-width: 100%;
    overflow: hidden;
}

.editor-title-input {
    font-size: 1.35rem;
    font-weight: 700;
    border: none;
    outline: none;
    width: 100%;
    min-width: 100px;
    color: var(--text-primary);
    background: transparent;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    row-gap: 0.5rem;
    flex-wrap: wrap; /* Permite envolver suavemente sin forzar rigidez */
    max-width: 100%;
    padding: 2px 0;
}

.btn-action-pill {
    border-radius: 50rem !important;
    background-color: var(--card-bg, rgba(255, 255, 255, 0.05)) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15)) !important;
    transition: all 0.2s ease-in-out !important;
}

.btn-action-pill:hover {
    background-color: var(--hover-bg, rgba(255, 255, 255, 0.12)) !important;
    color: var(--text-primary) !important;
    border-color: var(--text-muted) !important;
    transform: translateY(-1px);
}

.editor-header .btn,
.editor-header .btn-group {
    white-space: nowrap !important;
    height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.editor-header .btn-group .btn {
    height: 100% !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.btn-group-pill {
    border-radius: 50rem !important;
}

.btn-group-pill > .btn:first-child,
.btn-group-pill > .btn.rounded-start-pill {
    border-top-left-radius: 50rem !important;
    border-bottom-left-radius: 50rem !important;
}

.btn-group-pill > .btn:last-child,
.btn-group-pill > .btn.rounded-end-pill {
    border-top-right-radius: 50rem !important;
    border-bottom-right-radius: 50rem !important;
}

.editor-title-input {
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    outline: none;
    width: 100%;
    color: var(--text-primary);
    background: transparent;
}

.editor-title-input:focus {
    outline: none;
}

.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Quill Editor custom styling */
#quill-editor-container {
    min-height: 520px;
    height: calc(100vh - 270px);
    border-radius: 0.5rem;
    border: 1px solid var(--card-border);
}

/* Sidebar Collapsed State */
.app-sidebar.collapsed {
    width: 65px;
}

.app-sidebar.collapsed .sidebar-text,
.app-sidebar.collapsed .sidebar-menu-title,
.app-sidebar.collapsed .sidebar-menu-add-btn,
.app-sidebar.collapsed .badge-count {
    display: none !important;
}

.app-sidebar.collapsed .sidebar-header {
    padding: 1rem 0.35rem;
    text-align: center;
}

.app-sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 0.75rem 0.35rem;
    margin-bottom: 0.3rem;
}

.app-sidebar.collapsed .sidebar-nav-item i {
    margin-right: 0 !important;
    font-size: 1.25rem !important;
}

.app-sidebar.collapsed .btn-new-note {
    width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    margin: 0.75rem auto 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.app-sidebar.collapsed .btn-new-note i {
    margin: 0 !important;
    font-size: 1.25rem !important;
}

.app-sidebar.collapsed .sidebar-theme-container {
    flex-direction: column !important;
    gap: 0.4rem;
    padding: 0.4rem 0.2rem !important;
}

.app-sidebar.collapsed .sidebar-theme-container button {
    padding: 0.4rem 0 !important;
    text-align: center !important;
}

.ql-toolbar.ql-snow {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    border-color: var(--card-border);
    background-color: #f8fafc;
}

.ql-container.ql-snow {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    border-color: var(--card-border);
    font-size: 1rem;
}

/* AutoSave Status Badge */
.autosave-status {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    transition: all 0.2s ease;
}

.autosave-status.saving {
    background-color: #e0f2fe;
    color: #0284c7;
}

.autosave-status.saved {
    background-color: #dcfce7;
    color: #16a34a;
}

.autosave-status.error {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Attachments Gallery & File Cards */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.attachment-card {
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

.attachment-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.attachment-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.attachment-info {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.attachment-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive YouTube Embed */
.youtube-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 ratio */
    height: 0;
    overflow: hidden;
    border-radius: 0.75rem;
    background-color: #000000;
    margin-top: 0.75rem;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Quill Editor Links */
.ql-editor a {
    color: var(--bs-primary, #0d6efd) !important;
    text-decoration: underline !important;
    font-weight: 500;
    word-break: break-all;
}

.ql-editor a:hover {
    color: #0a58ca !important;
    text-decoration: none !important;
}

/* Quill Editor Embedded Videos (YouTube) */
.ql-editor iframe.ql-video,
.ql-editor iframe {
    width: 100% !important;
    max-width: 720px;
    height: 400px !important;
    border-radius: 0.75rem !important;
    margin: 1rem auto !important;
    display: block !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
}

@media (max-width: 768px) {
    .ql-editor iframe.ql-video,
    .ql-editor iframe {
        height: 240px !important;
    }
}

/* Notion-Style Callout Boxes */
.callout-box {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-left: 4px solid #0d6efd;
    background-color: #f0f7ff;
    color: #1e293b;
}

.callout-box.callout-info { border-left-color: #0d6efd; background-color: #f0f7ff; }
.callout-box.callout-tip { border-left-color: #198754; background-color: #f0fdf4; }
.callout-box.callout-warning { border-left-color: #ffc107; background-color: #fffbeb; }
.callout-box.callout-danger { border-left-color: #dc3545; background-color: #fef2f2; }

/* Empty State Placeholder */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 991.98px) {
    .app-container {
        position: relative;
    }

    .app-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 2000;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
    }

    .app-sidebar.show {
        left: 0;
    }

    .app-note-list {
        width: 100%;
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    .app-note-list.hide-mobile {
        display: none !important;
    }

    .app-note-editor {
        display: none;
        width: 100%;
        height: 100vh;
    }

    .app-note-editor.show-mobile {
        display: flex !important;
        width: 100%;
    }

    /* Optimización de espacio para Cabecera de Nota en Móvil */
    .editor-header {
        padding: 0.25rem 0.5rem !important;
        min-height: 42px !important;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
    }

    .editor-title-input {
        font-size: 1.05rem !important;
        padding: 2px 4px !important;
    }

    .editor-header-title {
        min-width: 0 !important;
        gap: 0.35rem !important;
    }

    .editor-header-title .btn {
        padding: 0 4px !important;
        font-size: 1rem !important;
    }

    .editor-header-actions-mobile {
        flex-shrink: 0 !important;
    }

    /* Reducción de relleno en el cuerpo de la nota */
    .editor-body {
        padding: 0.5rem 0.6rem !important;
        gap: 0.5rem !important;
    }

    /* Portada de nota ultra compacta en móvil */
    .note-cover-banner {
        height: 80px !important;
        min-height: 80px !important;
        margin-bottom: 0.5rem !important;
    }

    .note-cover-banner .btn {
        padding: 2px 8px !important;
        font-size: 0.75rem !important;
    }

    /* Barra Resumida Móvil de Metadatos */
    .note-metadata-toggle-bar {
        transition: background-color 0.2s ease, border-color 0.2s ease;
        user-select: none;
    }

    .note-metadata-toggle-bar:active {
        background-color: var(--bs-secondary-bg, #e2e8f0) !important;
    }

    .note-metadata-toggle-bar[aria-expanded="true"] #metadata-collapse-chevron {
        transform: rotate(180deg);
    }

    .transition-transform {
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Barra de metadatos (Libreta, Estado, Etiquetas) visible y fluida en móvil */
    .note-metadata-bar {
        padding: 0.4rem 0.6rem !important;
        gap: 0.4rem 0.6rem !important;
        flex-wrap: wrap !important;
        overflow: visible !important;
    }

    .note-metadata-bar select {
        padding: 2px 6px !important;
        font-size: 0.8rem !important;
        height: 30px !important;
        width: auto !important;
    }

    .note-metadata-bar .btn,
    .note-metadata-bar .badge {
        font-size: 0.78rem !important;
    }

    /* Barra de herramientas Quill visible y fluida en móvil */
    .ql-toolbar.ql-snow {
        padding: 4px 6px !important;
        display: flex !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 4px 6px !important;
        overflow: visible !important;
    }

    .ql-toolbar.ql-snow .ql-formats {
        margin-right: 4px !important;
        margin-bottom: 2px !important;
        display: inline-flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }

    .ql-toolbar.ql-snow button {
        padding: 3px 5px !important;
        width: 30px !important;
        height: 30px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .ql-toolbar.ql-snow .ql-picker-label {
        padding: 3px 6px !important;
        height: 30px !important;
        width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    /* Quill Editor Container max-height adaptado a pantallas móviles */
    #quill-editor-container {
        min-height: 380px !important;
        height: calc(100vh - 170px) !important;
    }
}

/* Custom Floating Context Menu */
.custom-context-menu {
    position: fixed;
    z-index: 2500;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 200px;
    padding: 0.35rem 0;
    display: none;
}

.custom-context-menu .context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.custom-context-menu .context-menu-item:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

.custom-context-menu .context-menu-item.danger:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.custom-context-menu .context-menu-divider {
    height: 1px;
    background-color: var(--card-border);
    margin: 0.25rem 0;
}

/* Quill Dark Theme Overrides */
.ql-editor.ql-blank::before {
    color: var(--text-muted, #64748b) !important;
    font-style: italic;
}

[data-bs-theme="dark"] .ql-editor.ql-blank::before {
    color: #94a3b8 !important;
    opacity: 0.75;
}

[data-bs-theme="dark"] ::placeholder {
    color: #94a3b8 !important;
    opacity: 0.7;
}

[data-bs-theme="dark"] .ql-toolbar.ql-snow {
    background-color: #0f172a;
    border-color: var(--card-border);
}

[data-bs-theme="dark"] .ql-container.ql-snow {
    background-color: #1e293b;
    border-color: var(--card-border);
    color: #f8fafc;
}

[data-bs-theme="dark"] .ql-stroke {
    stroke: #94a3b8 !important;
}

[data-bs-theme="dark"] .ql-fill {
    fill: #94a3b8 !important;
}

[data-bs-theme="dark"] .ql-picker {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .custom-context-menu {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

[data-bs-theme="dark"] .custom-context-menu .context-menu-item:hover {
    background-color: #334155;
    color: #818cf8;
}

/* Image Editor & Color Picker Palette */
.color-picker-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-block;
}

.color-picker-dot:hover {
    transform: scale(1.15);
}

.color-picker-dot.selected {
    transform: scale(1.25);
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--primary-color);
}

/* Attachment Hover Overlay */
.attachment-thumb-container {
    position: relative;
}

.attachment-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.attachment-thumb-container:hover .attachment-hover-overlay {
    opacity: 1;
}

/* Quill Image Toolbar Overlay */
.quill-image-toolbar {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: fadeIn 0.15s ease;
}

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

.quill-img-selected {
    outline: 2px solid #4f46e5 !important;
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.5) !important;
}

/* Callout Boxes (Notion Style) */
.callout-box {
    padding: 0.85rem 1.1rem;
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-left: 4px solid #3b82f6;
    background-color: #eff6ff;
    color: #1e3a8a;
}
.callout-box p { margin: 0; }
.callout-box.callout-info { border-left-color: #3b82f6; background-color: #eff6ff; color: #1e3a8a; }
.callout-box.callout-success { border-left-color: #10b981; background-color: #ecfdf5; color: #065f46; }
.callout-box.callout-warning { border-left-color: #f59e0b; background-color: #fffbeb; color: #92400e; }
.callout-box.callout-danger { border-left-color: #ef4444; background-color: #fef2f2; color: #991b1b; }

[data-bs-theme="dark"] .callout-box.callout-info { background-color: rgba(59, 130, 246, 0.15); color: #93c5fd; }
[data-bs-theme="dark"] .callout-box.callout-success { background-color: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
[data-bs-theme="dark"] .callout-box.callout-warning { background-color: rgba(245, 158, 11, 0.15); color: #fde047; }
[data-bs-theme="dark"] .callout-box.callout-danger { background-color: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* Slash Commands Floating Menu */
#slash-commands-menu {
    position: absolute;
    z-index: 3000;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
    display: none;
}

[data-bs-theme="dark"] #slash-commands-menu {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

.slash-menu-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    padding: 0.25rem 0.5rem;
    letter-spacing: 0.5px;
}

.slash-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.slash-menu-item:hover, .slash-menu-item.active {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

[data-bs-theme="dark"] .slash-menu-item:hover, [data-bs-theme="dark"] .slash-menu-item.active {
    background-color: #334155;
    color: #818cf8;
}

.slash-menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Custom Context Menu for Note List and Kanban Cards */
.custom-context-menu {
    position: fixed;
    z-index: 10500;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    padding: 6px;
    display: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: contextMenuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

[data-bs-theme="dark"] .custom-context-menu {
    background: rgba(30, 41, 59, 0.95);
    color: #f8fafc;
    border-color: rgba(51, 65, 85, 0.9);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.custom-context-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.custom-context-menu .menu-item:hover {
    background-color: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}

[data-bs-theme="dark"] .custom-context-menu .menu-item:hover {
    background-color: rgba(99, 102, 241, 0.18);
    color: #818cf8;
}

.custom-context-menu .menu-item.danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444 !important;
}

.custom-context-menu .menu-divider {
    height: 1px;
    margin: 4px 6px;
    background-color: rgba(226, 232, 240, 0.8);
}

[data-bs-theme="dark"] .custom-context-menu .menu-divider {
    background-color: rgba(51, 65, 85, 0.8);
}

.note-card-context-active {
    outline: 2px solid #4f46e5 !important;
    outline-offset: -2px;
}

/* App Preloader / Splash Screen */
.app-preloader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-preloader-container.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-logo-wrapper {
    position: relative;
    width: 95px;
    height: 95px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-logo-img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 22px;
    position: relative;
    z-index: 2;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45);
    animation: preloaderPulse 2s ease-in-out infinite alternate;
}

.preloader-glow-ring {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.6) 0%, rgba(168, 85, 247, 0.25) 60%, transparent 100%);
    filter: blur(16px);
    z-index: 1;
    animation: preloaderRotateGlow 3.5s linear infinite;
}

@keyframes preloaderPulse {
    0% {
        transform: scale(0.96);
    }
    100% {
        transform: scale(1.05);
    }
}

@keyframes preloaderRotateGlow {
    0% {
        transform: rotate(0deg) scale(0.9);
    }
    50% {
        transform: rotate(180deg) scale(1.15);
    }
    100% {
        transform: rotate(360deg) scale(0.9);
    }
}

.preloader-title {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    font-size: 1.6rem;
}

.preloader-progress-bar {
    width: 160px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.preloader-progress-fill {
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    border-radius: 10px;
    animation: preloaderBarAnim 1.2s ease-in-out infinite alternate;
}

@keyframes preloaderBarAnim {
    0% {
        width: 15%;
        transform: translateX(-10%);
    }
    100% {
        width: 85%;
        transform: translateX(30%);
    }
}

/* Estilos para Bloques de Código con Resaltado de Sintaxis (C#, ASP, Java, SQL, JS, etc.) */
.ql-editor pre.ql-syntax,
pre.ql-syntax,
.ql-syntax {
    background-color: #282c34 !important;
    color: #abb2bf !important;
    font-family: 'Fira Code', 'Consolas', 'Cascadia Code', 'Monaco', 'Courier New', monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    padding: 1.25rem !important;
    border-radius: 0.75rem !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    overflow-x: auto !important;
    margin: 1.25rem 0 !important;
}

.ql-editor pre.ql-syntax ::selection {
    background-color: rgba(99, 102, 241, 0.4) !important;
}

/* ==========================================
   ESTILOS Y FORMATO DE TABLAS (Quill / Notes)
   ========================================== */
.ql-editor table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    background-color: var(--bs-body-bg, #ffffff);
    color: var(--bs-body-color, #1e293b);
}

.ql-editor table th,
.ql-editor table td {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--bs-border-color, #e2e8f0);
    vertical-align: middle;
    font-size: 0.9rem;
    line-height: 1.4;
}

.ql-editor table th {
    background-color: var(--bs-tertiary-bg, #f8fafc);
    font-weight: 600;
    color: var(--bs-emphasis-color, #0f172a);
}

/* 1. Tema Estándar LiVnet / Moderno (Azul / Índigo) */
.ql-editor table.table-livnet,
.ql-editor table.table-styled {
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
}
.ql-editor table.table-livnet th,
.ql-editor table.table-styled th {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-color: rgba(255, 255, 255, 0.2) !important;
}
.ql-editor table.table-livnet tr:nth-child(even),
.ql-editor table.table-styled tr:nth-child(even) {
    background-color: rgba(99, 102, 241, 0.04);
}

/* 2. Tema Esmeralda / Verde */
.ql-editor table.table-emerald {
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}
.ql-editor table.table-emerald th {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-color: rgba(255, 255, 255, 0.2) !important;
}
.ql-editor table.table-emerald tr:nth-child(even) {
    background-color: rgba(16, 185, 129, 0.04);
}

/* 3. Tema Púrpura / Violeta */
.ql-editor table.table-purple {
    border: 1px solid rgba(147, 51, 234, 0.3) !important;
}
.ql-editor table.table-purple th {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-color: rgba(255, 255, 255, 0.2) !important;
}
.ql-editor table.table-purple tr:nth-child(even) {
    background-color: rgba(147, 51, 234, 0.04);
}

/* 4. Tema Carmesí / Coral */
.ql-editor table.table-crimson {
    border: 1px solid rgba(225, 29, 72, 0.3) !important;
}
.ql-editor table.table-crimson th {
    background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-color: rgba(255, 255, 255, 0.2) !important;
}
.ql-editor table.table-crimson tr:nth-child(even) {
    background-color: rgba(225, 29, 72, 0.04);
}

/* 5. Tema Ámbar / Dorado */
.ql-editor table.table-amber {
    border: 1px solid rgba(217, 119, 6, 0.3) !important;
}
.ql-editor table.table-amber th {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-color: rgba(255, 255, 255, 0.2) !important;
}
.ql-editor table.table-amber tr:nth-child(even) {
    background-color: rgba(217, 119, 6, 0.04);
}

/* 6. Tema Cyberpunk Neon */
.ql-editor table.table-cyberpunk {
    border: 1px solid rgba(6, 182, 212, 0.5) !important;
    background-color: #090d16 !important;
    color: #06b6d4 !important;
}
.ql-editor table.table-cyberpunk th {
    background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-color: rgba(6, 182, 212, 0.4) !important;
}
.ql-editor table.table-cyberpunk td {
    border-color: rgba(6, 182, 212, 0.2) !important;
    color: #e0f2fe !important;
}
.ql-editor table.table-cyberpunk tr:nth-child(even) {
    background-color: rgba(6, 182, 212, 0.08) !important;
}

/* 7. Tema Zebra / Rayado */
.ql-editor table.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.025);
}
[data-bs-theme="dark"] .ql-editor table.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.04);
}

/* 8. Tema Dark Header */
.ql-editor table.table-dark-header th {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

/* 9. Tema Minimalista */
.ql-editor table.table-minimal {
    border: none !important;
    box-shadow: none !important;
    border-bottom: 2px solid var(--bs-border-color, #e2e8f0) !important;
}
.ql-editor table.table-minimal th,
.ql-editor table.table-minimal td {
    border: none !important;
    border-bottom: 1px solid var(--bs-border-color, #e2e8f0) !important;
}

/* 10. Tema Grilla Ejecutiva / Corporate */
.ql-editor table.table-corporate {
    border: 1px solid #cbd5e1 !important;
    border-top: 4px solid #1e3a8a !important;
}
.ql-editor table.table-corporate th {
    background-color: #f1f5f9 !important;
    color: #1e3a8a !important;
    font-weight: 700;
    border-color: #cbd5e1 !important;
}
.ql-editor table.table-corporate td {
    border-color: #e2e8f0 !important;
}

/* Efecto hover en filas */
.ql-editor table tr:hover td {
    background-color: rgba(99, 102, 241, 0.08) !important;
}

/* Menú Flotante de Herramientas para Tablas */
.quill-table-toolbar {
    position: absolute;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 8px;
    background-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.82rem;
    animation: fadeIn 0.15s ease-out;
}
.quill-table-toolbar button,
.quill-table-toolbar .dropdown-toggle {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
}
.quill-table-toolbar .dropdown-menu {
    font-size: 0.82rem;
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}
.quill-table-toolbar .dropdown-item {
    color: #e2e8f0;
    padding: 6px 12px;
}
.quill-table-toolbar .dropdown-item:hover {
    background-color: #334155;
    color: #ffffff;
}
.quill-table-selected {
    outline: 2px dashed #4f46e5 !important;
    outline-offset: 2px;
}

/* Primera Columna Destacada */
.ql-editor table.table-highlight-first-col td:first-child {
    font-weight: 700 !important;
    background-color: rgba(99, 102, 241, 0.08) !important;
    border-right: 2px solid var(--bs-border-color, #cbd5e1) !important;
}

/* Barra de Búsqueda y Filtro de Tabla */
.quill-table-filter-container {
    animation: fadeIn 0.2s ease-out;
}
.quill-table-filter-container input::placeholder {
    color: #94a3b8;
}

/* Modo Lectura Estricto - Ocultar Barras de Herramientas, Menús de Edición, Grabación, Adjuntos y Metadatos de Edición */
.is-read-mode .ql-toolbar,
#editor-body-container.is-read-mode .ql-toolbar,
.is-read-mode #quill-image-toolbar,
.is-read-mode #quill-table-toolbar,
.is-read-mode #note-cover-actions,
.is-read-mode #voice-recorder-btn,
.is-read-mode #attachment-upload-btn-label,
.is-read-mode .btn-attachment-insert,
.is-read-mode .btn-attachment-edit,
.is-read-mode .btn-attachment-delete,
.is-read-mode .btn-link-delete,
.is-read-mode #note-metadata-collapse,
.is-read-mode .note-metadata-toggle-bar,
#editor-body-container.is-read-mode #note-metadata-collapse,
#editor-body-container.is-read-mode .note-metadata-toggle-bar,
#quill-image-toolbar.d-none,
#quill-table-toolbar.d-none {
    display: none !important;
}

/* Mostrar Barra de Metadatos Solo Lectura Únicamente en Modo Lectura */
#note-metadata-read-only-bar {
    display: none;
}

.is-read-mode #note-metadata-read-only-bar,
#editor-body-container.is-read-mode #note-metadata-read-only-bar {
    display: flex !important;
}

/* Ocultar Banner de Modo Lectura en pantallas móviles (< 992px) */
@media (max-width: 991.98px) {
    #read-mode-banner {
        display: none !important;
    }
}

/* Estilos Gestor de Archivos (Files Hub) */
.file-hub-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.file-hub-card .hover-zoom {
    transition: transform 0.3s ease;
}

.file-hub-card:hover .hover-zoom {
    transform: scale(1.05);
}