:root {
    /* Light Theme (Notion Style) */
    --bg-color: #ffffff;
    --sidebar-bg: #f7f7f5;
    --card-bg: #ffffff;
    --text-primary: #37352f;
    --text-secondary: #9a9a97;
    --border-color: #e9e9e7;
    --accent-color: #2383e2;
    --danger-color: #eb5757;
    --danger-hover: #fbecec;
    --item-hover: #efefed;
    --item-active: #e1e1df;
    --active-border: #d3d3d1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    
    /* Squared Notion UI variables */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-full: 99px; /* Kept for pill buttons if needed */
}

[data-theme="dark"] {
    /* Dark Theme (Notion Style) */
    --bg-color: #191919;
    --sidebar-bg: #202020;
    --card-bg: #191919;
    --text-primary: #ffffff;
    --text-secondary: #9b9b9b;
    --border-color: #2f2f2f;
    --accent-color: #2eaadc;
    --danger-color: #ff7369;
    --danger-hover: #ff736933;
    --item-hover: #2f2f2f;
    --item-active: #3f3f3f;
    --active-border: #4f4f4f;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    height: 100vh;
    overflow: hidden;
}

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

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

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
    z-index: 10;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    white-space: nowrap;
}

/* --- COMPACT SIDEBAR MODE (Desktop Only) --- */
@media (min-width: 769px) {
    .sidebar.compact {
        width: 80px;
    }
    .sidebar.compact .brand-text-group,
    .sidebar.compact .new-note-text,
    .sidebar.compact .note-item-title,
    .sidebar.compact .note-item-preview,
    .sidebar.compact .action-btn span {
        opacity: 0;
        max-width: 0;
        margin: 0;
        padding: 0;
        pointer-events: none;
    }
    .sidebar.compact .sidebar-top-row {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    .sidebar.compact .sidebar-header,
    .sidebar.compact .notes-list,
    .sidebar.compact .sidebar-footer {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .sidebar.compact .brand-container {
        justify-content: center;
        width: 100%;
        gap: 0;
    }
    /* Uniform buttons in compact mode */
    .sidebar.compact .new-note-pill,
    .sidebar.compact .action-btn,
    .sidebar.compact #toggle-sidebar-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: var(--radius-full) !important;
        margin: 0 auto;
        gap: 0 !important;
    }
    .sidebar.compact .sidebar-footer {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    .sidebar.compact .note-item {
        padding: 0;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        border-radius: var(--radius-full);
        margin: 0 auto 0.25rem auto;
        gap: 0 !important;
    }
    .sidebar.compact .note-item-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        color: var(--text-secondary);
        margin: 0;
    }
    .sidebar.compact .note-item.active .note-item-icon {
        color: var(--text-primary) !important;
    }
}


.sidebar-header {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.new-note-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0.85rem;
    border-radius: var(--radius-full);
    background-color: var(--text-primary);
    color: var(--bg-color); /* Alto contraste */
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.new-note-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    opacity: 0.9;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    width: 42px; /* Aumentado para emparejar dos líneas */
    height: 42px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

[data-theme="dark"] .brand-logo {
    filter: invert(1);
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: 0;
}

.icon-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.6rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.icon-btn:hover {
    background-color: var(--item-hover);
    color: var(--text-primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.icon-btn i {
    font-size: 1.2rem;
}

.icon-btn.danger {
    color: var(--danger-color);
    border-color: transparent;
    background: transparent;
}

.icon-btn.danger:hover {
    background-color: var(--danger-hover);
    color: var(--danger-color);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.notes-list::-webkit-scrollbar {
    width: 6px;
}
.notes-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.note-item {
    padding: 0.5rem 0.75rem;
    margin: 2px 0.5rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    border: none;
    background-color: transparent;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.note-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem; /* For emojis */
    line-height: 1;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.note-item:hover {
    background-color: var(--item-hover);
}

.note-item.active {
    background-color: var(--item-active);
    font-weight: 600;
}

.note-item-title {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    flex: 1;
}

.note-item-preview {
    display: none; /* Notion doesn't show previews in the sidebar */
}

.sidebar-footer {
    padding: 1.2rem;
    transition: padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-btn {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.action-btn:hover {
    background-color: var(--item-hover);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-sm);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color);
    transition: width 0.3s ease;
}

/* --- FORMAT SIDEBAR --- */
.format-sidebar {
    position: fixed;
    top: 0;
    right: -360px;
    height: 100vh;
    width: 360px;
    background-color: var(--card-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    z-index: 1000;
}

.format-sidebar.open {
    right: 0;
    box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}

.format-sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.format-sidebar-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.format-sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.format-sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.format-sidebar-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.format-section {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.format-section.divider-top {
    border-top: 1px solid var(--border-color);
}

.target-selector {
    display: flex;
    gap: 0.25rem;
    background-color: var(--bg-color);
    padding: 0.35rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem;
    border-radius: var(--radius-full);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-secondary);
}

.radio-label:has(input:checked) {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm), 0 1px 3px rgba(0,0,0,0.05);
    color: var(--text-primary);
}

.radio-label input {
    display: none;
}

.custom-color-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#color-wheel-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Floating effect directly on the wheel and slider */
.IroWheel {
    border: none !important;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.IroSlider {
    border: none !important;
    margin-top: 1.5rem !important; /* Proper spacing from wheel */
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

.hex-input-group {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.75rem 1.25rem;
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.hex-input-group:focus-within {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.reset-color-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-color-btn:hover {
    background-color: var(--danger-hover);
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.hex-prefix {
    color: var(--text-secondary);
    font-weight: 700;
    margin-right: 0.5rem;
}

.hex-text-input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    width: 100%;
    outline: none;
    text-transform: uppercase;
}

.palette-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.palette-title::before, .palette-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.predefined-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

.palette-item {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(128, 128, 128, 0.2);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.palette-item:hover {
    transform: scale(1.4) translateY(-2px);
    border-color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 10;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    text-align: center;
}

.empty-icon-wrapper {
    background-color: var(--card-bg);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.empty-state p {
    font-size: 1.125rem;
    font-weight: 600;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-top-bar {
    padding: 1.5rem 2rem 0 2rem;
    display: flex;
    justify-content: flex-end;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background-color: var(--card-bg);
    padding: 0.4rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.divider {
    width: 1px;
    height: 1.5rem;
    background-color: var(--border-color);
    margin: 0 0.25rem;
}

.editor-area-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    justify-content: stretch;
    align-items: stretch;
}

.editor-area-wrapper::-webkit-scrollbar {
    width: 8px;
}
.editor-area-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.editor-card {
    width: 100%;
    max-width: none;
    background-color: var(--bg-color);
    padding: 1rem 4rem 4rem 4rem;
    border-radius: 0;
    box-shadow: none;
    border: none;
    display: flex;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.4s ease-out;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.note-title-input {
    width: 100%;
    font-size: 2.5rem;
    font-weight: 800;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    flex: 1;
    font-family: inherit;
    line-height: 1.1;
}

.note-title-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.4;
}

/* QUILL EDITOR OVERRIDES PARA QUE SE VEA INCREIBLE */

#quill-editor-container {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.5rem 0 1rem 0 !important;
    margin-bottom: 1rem;
    position: sticky;
    top: -3rem; /* Stick to the top when scrolling down */
    background: var(--bg-color); /* Match background */
    z-index: 10;
}

/* Animations for Quill tools */
.ql-toolbar.ql-snow button,
.ql-toolbar.ql-snow .ql-picker {
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    border-radius: var(--radius-full) !important;
}

.ql-toolbar.ql-snow button:hover,
.ql-toolbar.ql-snow .ql-picker:hover {
    transform: scale(1.15);
    background-color: var(--item-hover) !important;
}

/* Rounded look for color pickers and dropdowns */
.ql-snow .ql-picker-options {
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border-color) !important;
    padding: 8px !important;
    background-color: var(--card-bg) !important;
}



.ql-container.ql-snow {
    border: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
}

.ql-editor {
    padding: 0 !important;
    line-height: 1.7;
    min-height: 300px;
}

.ql-editor.ql-blank::before {
    color: var(--text-secondary);
    font-style: normal;
    opacity: 0.5;
    left: 0;
}

/* Custom HEX Picker Button Icon */
.ql-snow .ql-toolbar button.ql-hexPicker {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ql-snow .ql-toolbar button.ql-hexPicker::after {
    content: "#";
}

/* Adapt toolbar icons for dark mode */
[data-theme="dark"] .ql-snow .ql-stroke {
    stroke: var(--text-primary);
}
[data-theme="dark"] .ql-snow .ql-fill, 
[data-theme="dark"] .ql-snow .ql-stroke.ql-fill {
    fill: var(--text-primary);
}
[data-theme="dark"] .ql-snow .ql-picker {
    color: var(--text-primary);
}
[data-theme="dark"] .ql-snow .ql-picker-options {
    background-color: var(--sidebar-bg);
    border-color: var(--border-color);
}

/* Format specifically the checklist */
.ql-editor li[data-list="checked"] > .ql-ui:before {
    content: '\2713' !important; /* Checkmark */
    background: var(--accent-color);
    color: white;
    border-radius: 4px;
    border-color: var(--accent-color);
}

/* Adjust font families for picker to match what we included */
.ql-font-roboto {
  font-family: 'Roboto Mono', monospace;
}
.ql-font-merriweather {
  font-family: 'Merriweather', serif;
}

/* Override Quill Checklist to look like iOS Reminders */
.ql-editor li[data-list="unchecked"]::before,
.ql-editor li[data-list="checked"]::before {
    content: '' !important;
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 50% !important;
    margin-right: 8px !important;
    margin-left: -26px !important;
    vertical-align: middle !important;
    position: relative !important;
    top: 2px !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    background-color: transparent !important;
    cursor: pointer !important;
}

.ql-editor li[data-list="checked"]::before {
    background-color: var(--text-primary) !important;
    border-color: var(--text-primary) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-size: 12px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}
[data-theme="dark"] .ql-editor li[data-list="checked"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

.icon-btn svg, .note-item-icon svg, #theme-toggle svg, .lucide-4x svg { stroke-width: 2px !important; }
.icon-btn svg { width: 20px; height: 20px; }
.note-item-icon svg { width: 24px; height: 24px; margin: 0 auto; }
.lucide-4x { width: 64px !important; height: 64px !important; color: var(--text-secondary); opacity: 0.5; }


/* --- AI Assistant Modal (iOS Glassmorphism) --- */
.ai-magic-btn { color: #8b5cf6 !important; }
.ai-magic-btn:hover { background-color: #8b5cf615 !important; color: #7c3aed !important; }
.ai-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.ai-modal-overlay.active { opacity: 1; pointer-events: all; }
.ai-modal-card { background: var(--bg-color); width: 90%; max-width: 420px; border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px var(--border-color); transform: translateY(20px) scale(0.95); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); overflow: hidden; display: flex; flex-direction: column; }
.ai-modal-overlay.active .ai-modal-card { transform: translateY(0) scale(1); }
.ai-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); background: var(--card-bg); }
.ai-modal-title { display: flex; align-items: center; gap: 0.75rem; color: #8b5cf6; }
.ai-modal-title h3 { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.ai-icon-anim { animation: pulse-magic 2s infinite ease-in-out; }
@keyframes pulse-magic { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.15); opacity: 0.7; } }
.ai-modal-content { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.ai-api-desc, .ai-prompt-desc { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.4; margin: 0; }
.ai-input-group { display: flex; align-items: center; gap: 0.75rem; background: var(--bg-color); border: 1px solid var(--border-color); padding: 0.75rem 1rem; border-radius: var(--radius-md); transition: border-color 0.2s; }
.ai-input-group:focus-within { border-color: #8b5cf6; box-shadow: 0 0 0 2px #8b5cf633; }
.ai-input-group input { flex: 1; border: none; background: transparent; color: var(--text-primary); outline: none; font-size: 0.95rem; }
.ai-input-group i { color: var(--text-secondary); }
.ai-primary-btn { background: #8b5cf6; color: white; border: none; padding: 0.85rem; border-radius: var(--radius-full); font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 0.95rem; }
.ai-primary-btn:hover { background: #7c3aed; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.ai-help-link { font-size: 0.8rem; color: var(--text-secondary); text-align: center; text-decoration: underline; cursor: pointer; }
.ai-action-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.ai-action-btn { background: var(--card-bg); border: 1px solid var(--border-color); padding: 1rem 0.5rem; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; cursor: pointer; transition: all 0.2s; color: var(--text-primary); font-size: 0.75rem; font-weight: 600; text-align: center; }
.ai-action-btn:hover { background: #8b5cf611; border-color: #8b5cf655; transform: translateY(-2px); }
.ai-loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 0; gap: 1rem; color: var(--text-secondary); font-weight: 500; font-size: 0.95rem; }
.ai-spinner { animation: spin 1s linear infinite; color: #8b5cf6; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.ai-secondary-btn { background: transparent; border: none; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; text-decoration: underline; margin-top: 0.5rem; }
.ai-secondary-btn:hover { color: var(--text-primary); }


/* --- MOBILE RESPONSIVE UI --- */
.mobile-only { display: none !important; }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); z-index: 999; opacity: 0; transition: opacity 0.3s ease; }
.mobile-overlay.active { display: block; opacity: 1; }

@media (max-width: 768px) {
    .mobile-only { display: flex !important; }
    #toggle-sidebar-btn { display: none !important; }
    
    .sidebar { 
        position: fixed; 
        left: -100%; 
        top: 0; 
        height: 100dvh; /* Fixes mobile browser UI clipping */
        width: 100%; 
        max-width: none; 
        z-index: 1000; 
        box-shadow: none; 
        transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
    }
    .sidebar.mobile-open { left: 0; }
    
    .format-sidebar { 
        width: 100%; 
        max-width: none; 
        right: -100%; 
        z-index: 1000; 
        height: 100dvh; /* Fixes mobile browser UI clipping */
        transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s ease;
    }
    .format-sidebar.open { right: 0; }
    
    .format-sidebar-content {
        padding-bottom: 4rem; /* Extra space at the bottom so the last colors are always fully scrollable */
        -webkit-overflow-scrolling: touch;
    }
    
    .editor-top-bar { 
        padding: 0.8rem 1rem !important; 
        justify-content: space-between !important;
    }
    .toolbar-actions { 
        width: auto !important; 
        justify-content: flex-end; 
        gap: 0.25rem;
    }
    
    .editor-area-wrapper {
        padding: 0;
    }
    
    .editor-card { 
        margin: 0 !important;
        padding: 1rem 1.5rem !important;
        border-radius: 0; 
        border-left: none;
        border-right: none;
        border-bottom: none;
        height: calc(100vh - 60px); 
    }
    
    .note-title-input {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }
    
    .ql-toolbar.ql-snow {
        padding: 0.5rem 0 !important;
    }
    
    .empty-state {
        padding: 2rem;
    }
    
    #empty-state-menu-btn {
        width: 100% !important;
        margin-top: 2rem !important;
    }
}

/* --- CUSTOM ICONS (EMOJI PICKER) --- */
.title-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.note-icon-container { position: relative; }
.note-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; background: transparent; border: none; color: var(--text-secondary); font-size: 1rem; font-weight: 500; cursor: pointer; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); transition: background 0.2s; user-select: none; }
.note-icon-btn:hover { background: var(--item-hover); color: var(--text-primary); }
.note-icon-btn.has-icon { padding: 0.5rem; }
.note-icon-btn.has-icon svg { width: 32px; height: 32px; stroke-width: 1.5px; }
.emoji-picker-popup { position: absolute; top: 100%; left: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 1rem; width: 300px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; z-index: 500; max-height: 250px; overflow-y: auto; margin-top: 0.5rem; }
.emoji-btn { background: transparent; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; padding: 0.5rem; border-radius: var(--radius-sm); transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.emoji-btn:hover { background: var(--item-hover); }


.note-item-icon { color: var(--text-primary); }
.note-icon-btn.has-icon { color: var(--text-primary) !important; }


/* --- NEW QUILL FONTS --- */
.ql-font-poppins { font-family: 'Poppins', sans-serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="poppins"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="poppins"]::before { content: 'Poppins'; font-family: 'Poppins', sans-serif; }
.ql-font-nunito { font-family: 'Nunito', sans-serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="nunito"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="nunito"]::before { content: 'Nunito'; font-family: 'Nunito', sans-serif; }
.ql-font-fira-code { font-family: 'Fira Code', monospace; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="fira-code"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="fira-code"]::before { content: 'Fira Code'; font-family: 'Fira Code', monospace; }
.ql-font-lora { font-family: 'Lora', serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="lora"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="lora"]::before { content: 'Lora'; font-family: 'Lora', serif; }
.ql-font-comic-neue { font-family: 'Comic Neue', cursive; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="comic-neue"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="comic-neue"]::before { content: 'Comic Neue'; font-family: 'Comic Neue', cursive; }


/* --- CHECKED TEXT STYLE --- */
.ql-editor li[data-list="checked"] { color: var(--text-secondary); text-decoration: line-through; opacity: 0.7; transition: all 0.2s ease; }


.brand-text-group, .new-note-text, .note-item-title, .note-item-preview, .action-btn span { transition: opacity 0.3s ease, max-width 0.3s ease, margin 0.3s ease; white-space: nowrap; overflow: hidden; max-width: 300px; }

