/*file: js-css/style.css*/

@import url('core-static.css');
@import url('features.css');

/* =========================================================
   MAIN LAYOUT STYLES (Header, Editor, Sidebar, SEO, Responsive)
   ========================================================= */

/* Page Layout Wrappers */
.page-wrapper {
    display: flex;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
}

/* Sidebar Container */
.notes-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100%;
    overflow: hidden !important;
    background-color: var(--toolbar-bg);
    border-right: 1px solid var(--border-color);
    padding: 0 0.5rem 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease-out;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
    padding: 0 0.25rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    flex-shrink: 0;
}

.notes-sidebar h3 {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0;
    text-align: center;
    color: var(--text-color);
    letter-spacing: 0.5px;
}

.sidebar-collapse-btn {
    position: absolute;
    right: 0;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.85;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.sidebar-collapse-btn:hover {
    opacity: 1;
    color: var(--primary-color);
    background-color: var(--hover-bg);
}

#newNoteBtn {
    width: 100%;
    height: 28px;
    min-height: 28px;
    box-sizing: border-box;
    margin: 0.15rem 0 0.25rem 0;
    padding: 0 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem; 
    flex-shrink: 0;
}

/* Collapsed Sidebar Rules (Desktop >=769px) */
@media (min-width: 769px) {
    .notes-sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
        padding: 0 0.25rem 0.75rem 0.25rem;
    }
    .notes-sidebar.collapsed .sidebar-header { justify-content: center; }
    .notes-sidebar.collapsed h3 { display: none; }
    .notes-sidebar.collapsed .sidebar-collapse-btn { position: relative; transform: rotate(180deg); }
    
    .notes-sidebar.collapsed #newNoteBtn { font-size: 0; padding: 0.35rem; justify-content: center; height: 28px; min-height: 28px; }
    .notes-sidebar.collapsed #newNoteBtn i { margin: 0; font-size: 0.85rem; }
    
    .notes-sidebar.collapsed .sidebar-search-container,
    .notes-sidebar.collapsed .sidebar-section-header,
    .notes-sidebar.collapsed .note-item-title,
    .notes-sidebar.collapsed .note-item-menu-btn,
    .notes-sidebar.collapsed .full-storage-label { display: none !important; }
    
    .notes-sidebar.collapsed .compact-storage-badge {
        display: block !important;
        font-size: 0.62rem;
        font-weight: 800;
        text-align: center;
        color: var(--primary-color);
        padding: 2px 0;
    }

    .notes-sidebar.collapsed .note-item { justify-content: center; padding: 0.35rem 0.2rem !important; }
    .notes-sidebar.collapsed .note-count { margin: 0; font-size: 0.8rem; text-align: center; }
    
    .notes-sidebar.collapsed .sidebar-archive-section {
        display: block !important;
        padding-top: 4px;
    }
    .notes-sidebar.collapsed .btn-archive-trigger {
        justify-content: center !important;
        padding: 6px 0 !important;
    }
    .notes-sidebar.collapsed .btn-archive-trigger span {
        display: none !important;
    }
    .notes-sidebar.collapsed .btn-archive-trigger i {
        margin: 0 !important;
        font-size: 0.95rem !important;
    }
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.2rem 0;
    margin-bottom: 0.4rem;
    flex-shrink: 0;
}

.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
    width: 100%;
}

.btn-sidebar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 5px 6px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.btn-sidebar i {
    font-size: 0.8rem;
    width: 16px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.85;
}

.btn-sidebar:hover { background-color: var(--hover-bg); }
.btn-sidebar:hover i { color: var(--primary-color); opacity: 1; }

/* Sidebar Search Container & Hotkey Badge */
.sidebar-search-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.35rem;
    width: 100%;
    flex-shrink: 0;
}

.sidebar-search-icon {
    position: absolute;
    left: 8px;
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.85;
    pointer-events: none;
}

.sidebar-search-input {
    width: 100%;
    padding: 4px 44px 4px 24px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--editor-bg);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.sidebar-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

body.dark-mode .sidebar-search-input:focus { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }
body.eye-comfort .sidebar-search-input:focus { box-shadow: 0 0 0 2px rgba(140, 93, 30, 0.3); }

.search-hotkey-badge {
    position: absolute;
    right: 8px;
    font-size: 0.58rem;
    font-weight: 700;
    font-family: inherit;
    padding: 1px 4px;
    border-radius: 4px;
    background-color: var(--toolbar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    opacity: 0.7;
    pointer-events: none;
    line-height: 1.2;
}

.sidebar-search-clear {
    position: absolute;
    right: 4px;
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.85;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.sidebar-search-clear:hover {
    opacity: 1;
    color: var(--danger-color);
}

/* Sidebar Section Headers */
.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 2px 4px;
    font-size: 0.62rem !important;
    font-weight: 600;
    text-transform: none !important;
    letter-spacing: 0.3px;
    color: var(--text-color);
    opacity: 0.75;
    flex-shrink: 0;
}

/* Active Notes Container (Fixed 445px for 12 Tabs with no clipping) */
.notes-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    max-height: 445px;
    min-height: 0;
    padding-right: 2px;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.notes-list::-webkit-scrollbar {
    width: 4px;
}

.notes-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

/* Zero-Layout Shift Note Items */
.note-item {
    box-sizing: border-box !important;
    padding: 0.35rem 0.5rem !important;
    background: var(--editor-bg);
    border-radius: 6px; 
    cursor: pointer;
    border: 1px solid var(--border-color) !important;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease; 
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 1px 0 !important;
    flex-shrink: 0;
    min-height: 32px;
}

.note-item:hover { 
    background: var(--hover-bg); 
    border-color: var(--primary-color) !important; 
}

/* High-Contrast Active Note Highlights */
.note-item.active {
    background: #d0e8d3 !important;
    color: #0d3810 !important;
    border-color: #1b5e20 !important;
    box-shadow: none !important;
}

body.dark-mode .note-item.active {
    background: #1b3d1c !important;
    color: #a5d6a7 !important;
    border-color: #66bb6a !important;
}

body.eye-comfort .note-item.active {
    background: #e4cc9c !important;
    color: #2e1a00 !important;
    border-color: #6d420f !important;
}

.note-item.pinned {
    border-left: 3px solid var(--primary-color) !important;
}

.note-pin-icon {
    font-size: 0.65rem;
    color: var(--primary-color);
    margin-right: 4px;
}

/* Note Count (# Number) Styling */
.note-count {
    font-size: 0.7rem;
    color: #1b5e20;
    margin-right: 2px;
    font-weight: 800;
    min-width: 18px;
    text-align: left;
    line-height: 1;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    flex-shrink: 0;
}

body.dark-mode .note-count {
    color: #81c784;
}

body.eye-comfort .note-count {
    color: #6d420f;
}

.note-item.active .note-count {
    color: #0d3810 !important;
    background: transparent !important;
    padding: 0 !important;
}

body.dark-mode .note-item.active .note-count {
    color: #a5d6a7 !important;
}

body.eye-comfort .note-item.active .note-count {
    color: #2e1a00 !important;
}

.note-item-title {
    flex: 1;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 2px;
    line-height: 1.2;
}

.note-item-title.editing { display: none; }

.note-item-rename-input {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    outline: none;
    color: var(--text-color);
    background-color: var(--editor-bg);
    line-height: 1.2;
    font-size: 0.75rem;
}

.note-item-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.75;
    font-size: 0.75rem;
    padding: 2px 4px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.18s ease, background-color 0.18s ease;
    margin-left: 2px;
    flex-shrink: 0;
}

.note-item:hover .note-item-menu-btn,
.note-item.active .note-item-menu-btn {
    opacity: 0.95;
}

.note-item-menu-btn:hover {
    opacity: 1 !important;
    background-color: var(--hover-bg);
    color: var(--primary-color);
}

/* Sidebar Archive Section */
.sidebar-archive-section {
    display: none;
    flex-shrink: 0;
    padding-top: 5px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    margin-top: auto;
}

.sidebar-archive-section.visible {
    display: block !important;
}

.btn-archive-trigger {
    position: relative;
    border: 1px solid var(--border-color);
    background-color: var(--editor-bg);
    border-radius: 6px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap !important;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.btn-archive-trigger i {
    font-size: 0.8rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.btn-archive-trigger span {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
    line-height: 1.2;
}

.btn-archive-trigger:hover {
    border-color: var(--primary-color);
    background-color: var(--hover-bg);
}

/* Compact Circular/Pill Badge */
.archive-count-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    background-color: rgba(46, 125, 50, 0.18);
    color: #1b5e20;
    border-radius: 999px;
    flex-shrink: 0 !important;
    text-align: center;
}

body.dark-mode .archive-count-badge {
    background-color: rgba(76, 175, 80, 0.25);
    color: #a5d6a7;
}

body.eye-comfort .archive-count-badge {
    background-color: rgba(140, 93, 30, 0.25);
    color: #4a2e05;
}

.archive-modal-content {
    max-width: 460px !important;
    width: 90% !important;
    border-radius: 14px;
    padding: 1.25rem !important;
}

.archive-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.2rem;
}

.archived-notes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.archive-modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background-color: var(--toolbar-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    gap: 8px;
    flex-wrap: nowrap !important;
}

.archive-item-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.archive-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0 !important;
}

.btn-archive-action {
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.18s ease;
    white-space: nowrap !important;
}

.btn-archive-action.restore {
    background-color: var(--primary-color);
    color: white;
}

.btn-archive-action.delete {
    background-color: var(--danger-color);
    color: white;
}

.btn-archive-action:hover {
    opacity: 0.88;
}

/* Main Area Container */
.main-content {
    flex-grow: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 100%;
    min-height: 100dvh; 
}

/* =========================================================
   HEADER & BUTTON CONTRAST ENHANCEMENTS
   ========================================================= */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.85rem;
    min-height: 38px;
    height: 38px;
    box-sizing: border-box;
    background-color: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo { 
    display: flex; 
    align-items: center; 
    gap: 0.4rem; 
}
.logo i { font-size: 0.95rem; color: var(--primary-color); }
.logo h1 { font-size: 0.92rem; font-weight: 800; color: var(--text-color); margin: 0; letter-spacing: -0.2px; }

.header-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.header-actions .btn-secondary {
    background-color: var(--editor-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    transition: all 0.18s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.header-actions .btn-secondary i {
    font-size: 0.72rem;
    color: var(--primary-color);
    transition: opacity 0.15s ease, color 0.15s ease;
    margin-right: 3px;
}

.header-actions .btn-secondary:hover {
    background-color: var(--hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.header-actions .btn-secondary:hover i {
    color: var(--primary-color);
}

body.dark-mode .header-actions .btn-secondary {
    background-color: #262626;
    border-color: #3e3e3e;
    color: #e0e0e0;
}

body.dark-mode .header-actions .btn-secondary i {
    color: #81c784;
}

body.dark-mode .header-actions .btn-secondary:hover {
    background-color: #333333;
    border-color: #4CAF50;
    color: #4CAF50;
}

body.dark-mode .header-actions .btn-secondary:hover i {
    color: #4CAF50;
}

body.eye-comfort .header-actions .btn-secondary {
    background-color: #fdf6e3;
    border-color: #dfcfb2;
    color: #3e3223;
}

body.eye-comfort .header-actions .btn-secondary i {
    color: #8c5d1e;
}

body.eye-comfort .header-actions .btn-secondary:hover {
    background-color: #f2e3be;
    border-color: #8c5d1e;
    color: #8c5d1e;
}

body.eye-comfort .header-actions .btn-secondary:hover i {
    color: #8c5d1e;
}

.header-actions .btn-ai-header {
    position: relative !important;
    overflow: visible !important;
    padding-right: 0.65rem !important;
    background-color: rgba(142, 36, 170, 0.12) !important;
    color: #6a1b9a !important;
    border: 1px solid rgba(142, 36, 170, 0.45) !important;
    border-radius: 5px !important;
    font-weight: 800;
}

.header-actions .btn-ai-header i { color: #6a1b9a !important; font-size: 0.75rem; }

.header-actions .btn-ai-header:hover {
    background-color: rgba(142, 36, 170, 0.22) !important;
    border-color: #6a1b9a !important;
    color: #4a148c !important;
}

body.dark-mode .header-actions .btn-ai-header {
    background-color: rgba(206, 147, 216, 0.18) !important;
    color: #e1bee7 !important;
    border-color: rgba(206, 147, 216, 0.5) !important;
}

body.dark-mode .header-actions .btn-ai-header i { color: #e1bee7 !important; }

body.dark-mode .header-actions .btn-ai-header:hover {
    background-color: rgba(206, 147, 216, 0.28) !important;
    color: #f3e5f5 !important;
    border-color: #ce93d8 !important;
}

body.eye-comfort .header-actions .btn-ai-header {
    background-color: rgba(140, 93, 30, 0.18) !important;
    color: #5d3a08 !important;
    border-color: rgba(140, 93, 30, 0.5) !important;
}

body.eye-comfort .header-actions .btn-ai-header i { color: #5d3a08 !important; }

body.eye-comfort .header-actions .btn-ai-header:hover {
    background-color: rgba(140, 93, 30, 0.28) !important;
    color: #2e1a00 !important;
    border-color: #6d420f !important;
}

/* Ko-fi Support Button */
.header-actions .btn-kofi {
    background-color: rgba(183, 28, 28, 0.1) !important;
    color: #b71c1c !important;
    border: 1px solid rgba(183, 28, 28, 0.45) !important;
    border-radius: 5px !important;
    font-weight: 800;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
}

.kofi-svg-icon {
    color: #b71c1c !important;
    margin-right: 2px;
    display: inline-block;
    vertical-align: middle;
    pointer-events: none;
}

.header-actions .btn-kofi:hover {
    background-color: rgba(183, 28, 28, 0.2) !important;
    border-color: #b71c1c !important;
    color: #7f0000 !important;
}

body.dark-mode .header-actions .btn-kofi {
    background-color: rgba(255, 138, 128, 0.18) !important;
    color: #ff8a80 !important;
    border-color: rgba(255, 138, 128, 0.5) !important;
}

body.dark-mode .kofi-svg-icon { color: #ff8a80 !important; }

body.dark-mode .header-actions .btn-kofi:hover {
    background-color: rgba(255, 138, 128, 0.28) !important;
    border-color: #ff8a80 !important;
    color: #ffffff !important;
}

body.eye-comfort .header-actions .btn-kofi {
    background-color: rgba(140, 93, 30, 0.15) !important;
    color: #5d3a08 !important;
    border-color: rgba(140, 93, 30, 0.45) !important;
}

body.eye-comfort .kofi-svg-icon { color: #5d3a08 !important; }

body.eye-comfort .header-actions .btn-kofi:hover {
    background-color: rgba(140, 93, 30, 0.25) !important;
    border-color: #6d420f !important;
    color: #2e1a00 !important;
}

.btn-beta-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: #ffffff;
    font-size: 0.40rem !important;
    font-weight: 800;
    line-height: 1;
    padding: 1px 3px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    pointer-events: none;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

body.dark-mode .btn-beta-badge {
    background: linear-gradient(135deg, #ab47bc, #ce93d8);
    color: #121212;
    border-color: rgba(255, 255, 255, 0.4);
}

body.eye-comfort .btn-beta-badge {
    background: linear-gradient(135deg, #6d420f, #8c5d1e);
    color: #fdf6e3;
    border-color: rgba(253, 246, 227, 0.6);
}

.btn-toggle-notes {
    display: none;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    background-color: var(--editor-bg);
    color: var(--text-color);
    border-radius: 5px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    font-size: 0.8rem;
}

.theme-toggle-circle {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    background-color: var(--editor-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 0.78rem;
}

.theme-toggle-circle:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

body.dark-mode .theme-toggle-circle { color: #f59e0b; border-color: #3e3e3e; background-color: #262626; }
body.dark-mode .theme-toggle-circle:hover { color: #fbbf24; border-color: #f59e0b; background-color: #333333; }

body.eye-comfort .theme-toggle-circle { color: #8c5d1e; border-color: #dfcfb2; background-color: #fdf6e3; }
body.eye-comfort .theme-toggle-circle:hover { color: #724915; background-color: #f2e3be; border-color: #8c5d1e; }

.btn-login {
    background-color: var(--editor-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    transition: all 0.18s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn-login:hover { 
    background-color: var(--hover-bg); 
    border-color: var(--primary-color); 
    color: var(--primary-color);
}
.btn-login i { color: #c5221f; font-size: 0.75rem; margin-right: 3px; }

body.dark-mode .btn-login { 
    background-color: #262626; 
    color: #f1f3f4; 
    border-color: #3e3e3e; 
}

body.dark-mode .btn-login:hover { 
    background-color: #333333; 
    border-color: #4CAF50; 
    color: #81c784; 
}

body.eye-comfort .btn-login { 
    background-color: #fdf6e3; 
    color: #3e3223; 
    border-color: #dfcfb2; 
}

body.eye-comfort .btn-login:hover { 
    background-color: #f2e3be; 
    border-color: #8c5d1e; 
    color: #8c5d1e; 
}

.auth-container { display: flex; align-items: center; margin: 0 0.25rem; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 6px 2px 2px;
    background-color: var(--hover-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease;
    height: 24px;
}

.user-profile:hover { border-color: var(--primary-color); }
.user-avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }

.user-name {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-color);
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    font-size: 0.72rem;
}

.btn-logout:hover { background-color: rgba(211, 47, 47, 0.1); }
.v-divider { width: 1px; height: 14px; background-color: var(--border-color); margin: 0 0.2rem; opacity: 0.6; }
.hide-mobile { display: block; }

.mobile-menu-container { 
    position: relative !important; 
    margin-left: 0.25rem; 
}

.btn-toggle-menu-circle {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background-color: var(--editor-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    font-size: 0.78rem;
}

.btn-toggle-menu-circle:hover,
.btn-toggle-menu-circle.active { background-color: var(--hover-bg); color: var(--primary-color); border-color: var(--primary-color); }

.mobile-dropdown {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    right: 0 !important;
    left: auto !important;
    margin: 0 !important;
    background-color: var(--editor-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    min-width: 170px;
    padding: 5px;
    z-index: 2100;
    gap: 3px;
    transform-origin: top right;
}

.mobile-dropdown.show { 
    display: flex !important; 
    animation: dropdownPop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.dropdown-item {
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 8px;
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 6px;
    white-space: nowrap; 
    font-family: inherit;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dropdown-item i {
    font-size: 0.75rem;
    color: var(--primary-color);
    background-color: rgba(46, 125, 50, 0.12);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-right: 8px;
    transition: background-color 0.2s ease;
}

body.dark-mode .dropdown-item i { background-color: rgba(128, 203, 196, 0.18); color: #80cbc4; }
body.eye-comfort .dropdown-item i { background-color: rgba(140, 93, 30, 0.18); color: #8c5d1e; }

.dropdown-item:hover { 
    background-color: var(--hover-bg); 
    border-color: var(--border-color);
}

.dropdown-item:hover i { 
    background-color: var(--primary-color);
    color: white;
}

body.dark-mode .dropdown-item:hover i { background-color: #80cbc4; color: #121212; }
body.eye-comfort .dropdown-item:hover i { background-color: #8c5d1e; color: #fdf6e3; }

/* TOOLBAR */
.toolbar {
    position: sticky;
    top: 38px;
    z-index: 999;
    display: flex;
    align-items: center;
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    padding: 0.15rem 0.5rem;
    margin: 4px 10px;
    background-color: var(--toolbar-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    gap: 0.25rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex-shrink: 0;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar::-webkit-scrollbar { display: none; }

body.dark-mode .toolbar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body.eye-comfort .toolbar {
    box-shadow: 0 1px 4px rgba(80, 60, 30, 0.08);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0 0.25rem;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    height: 18px;
}

.toolbar-group:last-child { 
    border-right: none; 
}

.toolbar-group.segmented-group {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0 0.25rem;
    gap: 0.15rem;
}

.segmented-group .toolbar-btn {
    border-radius: 4px;
    height: 24px;
    width: 24px;
}

.toolbar-btn {
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    background-color: transparent;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.toolbar-btn i {
    font-size: 0.72rem;
}

.toolbar-btn:hover {
    background-color: var(--hover-bg);
}

.toolbar-btn.active { 
    background-color: rgba(46, 125, 50, 0.18); 
    color: #1b5e20; 
    border-color: rgba(46, 125, 50, 0.4);
}

body.dark-mode .toolbar-btn.active { 
    background-color: rgba(76, 175, 80, 0.28); 
    color: #a5d6a7; 
    border-color: rgba(76, 175, 80, 0.5);
}

body.eye-comfort .toolbar-btn.active { 
    background-color: rgba(140, 93, 30, 0.25); 
    color: #5d3a08; 
    border-color: rgba(140, 93, 30, 0.5);
}

.toolbar-select {
    padding: 0 1.1rem 0 0.4rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background-color: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    height: 24px;
    font-size: 0.72rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%23333333%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-13%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2013l128%20128c3.6%203.6%207.8%205.4%2013%205.4s9.4-1.8%2013-5.4l128-128c3.6-3.6%205.4-7.8%205.4-13%200-5-1.8-9.4-5.4-13z%27%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.3rem center;
    background-size: 0.5em auto;
    flex-shrink: 0;
}

.toolbar-select:hover {
    background-color: var(--hover-bg);
    border-color: var(--border-color);
}

.toolbar-select:focus {
    border-color: var(--primary-color);
    background-color: var(--editor-bg);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.toolbar-select option {
    background-color: var(--editor-bg);
    color: var(--text-color);
    padding: 6px 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

#pasteModeSelect:focus option[value="smart"] { font-size: 0.72rem; }

body.dark-mode .toolbar-select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%23e0e0e0%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-13%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2013l128%20128c3.6%203.6%207.8%205.4%2013%205.4s9.4-1.8%2013-5.4l128-128c3.6-3.6%205.4-7.8%205.4-13%200-5-1.8-9.4-5.4-13z%27%2F%3E%3C%2Fsvg%3E");
}

body.eye-comfort .toolbar-select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%238c5d1e%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-13%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2013l128%20128c3.6%203.6%207.8%205.4%2013%205.4s9.4-1.8%2013-5.4l128-128c3.6-3.6%205.4-7.8%205.4-13%200-5-1.8-9.4-5.4-13z%27%2F%3E%3C%2Fsvg%3E");
}

.ml-auto { margin-left: auto; }
.color-pickers { align-items: center; }
.color-tool { display: flex; align-items: center; position: relative; margin-right: 2px; }

.toolbar-color-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    background-color: transparent;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.toolbar-color-label:hover { background-color: var(--hover-bg); }
.toolbar-color-label i { pointer-events: none; font-size: 0.7rem; }
.toolbar-color-picker { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.toolbar-hex-input {
    width: 58px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0 3px;
    font-size: 0.65rem;
    font-weight: 500;
    background-color: var(--editor-bg);
    color: var(--text-color);
    position: absolute;
    display: none;
    top: 105%;
    left: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.color-tool:hover .toolbar-hex-input,
.color-tool:focus-within .toolbar-hex-input { display: block; }

/* Editor Container */
.editor-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-color: var(--editor-bg);
    position: relative;
}

/* Drag and Drop Visual Overlay */
.drag-drop-overlay {
    position: absolute;
    inset: 10px;
    border: 2px dashed var(--primary-color);
    background-color: rgba(46, 125, 50, 0.08);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 100;
    pointer-events: none;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s ease;
}

.drag-drop-overlay i { font-size: 2.2rem; color: var(--primary-color); }
.drag-drop-overlay p { font-size: 0.95rem; font-weight: 600; color: var(--text-color); }

body.dark-mode .drag-drop-overlay { background-color: rgba(76, 175, 80, 0.12); border-color: #4CAF50; }
body.dark-mode .drag-drop-overlay i { color: #4CAF50; }

body.eye-comfort .drag-drop-overlay { background-color: rgba(140, 93, 30, 0.12); border-color: #8c5d1e; }
body.eye-comfort .drag-drop-overlay i { color: #8c5d1e; }

/* WORKSPACE SCROLL CONTAINMENT & PLACEHOLDER ISOLATION */
.editor {
    flex: 1;
    padding: 1.5rem 2rem 3.5rem 2rem;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    outline: none;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: var(--text-color);
    background-color: var(--editor-bg);
    min-height: 100%;
    caret-color: var(--primary-color);
}

.editor p, .editor div, .editor span, .editor li { line-height: inherit; }

body.dark-mode .editor { caret-color: #4CAF50; }
body.eye-comfort .editor { caret-color: #8c5d1e; }

.editor:empty:before { 
    content: "Start typing your notes here..."; 
    color: #757575; 
    font-style: italic; 
    pointer-events: none;
}

body.dark-mode .editor:empty:before { color: #aaaaaa; }
body.eye-comfort .editor:empty:before { color: #7a6b52; }

body.dark-mode .editor, body.dark-mode .editor * { color: var(--text-color) !important; }
body.dark-mode .editor a:not(.wiki-link):not(.toc-item-link), body.dark-mode .editor a:not(.wiki-link):not(.toc-item-link) * { color: var(--secondary-color) !important; }

body.eye-comfort .editor, body.eye-comfort .editor * { color: var(--text-color) !important; }
body.eye-comfort .editor a:not(.wiki-link):not(.toc-item-link), body.eye-comfort .editor a:not(.wiki-link):not(.toc-item-link) * { color: var(--secondary-color) !important; }

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0.75rem;
    background-color: var(--toolbar-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-color);
    flex-shrink: 0;
    min-height: 26px;
    position: relative;
}

.status-left { display: flex; align-items: center; gap: 0.4rem; flex: 1; }

.status-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.status-right {
    display: block;
    text-align: right;
    font-size: 0 !important;
    flex: 1;
}

.status-right span {
    font-size: 0.75rem;
    display: block;
    line-height: 1.2;
    color: var(--text-color);
    font-weight: 600;
}

#charCount::after { content: " characters"; font-weight: normal; opacity: 0.85; }
#wordCount::after { content: " words"; font-weight: normal; opacity: 0.85; }

.status-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.8;
    padding: 2px 6px;
    font-size: 0.85rem;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    border-radius: 4px;
}

.status-btn:hover { opacity: 1; color: var(--primary-color); background-color: var(--hover-bg); }
.status-btn.active { color: var(--primary-color); opacity: 1; }
body.dark-mode .status-btn.active { color: #4CAF50; }
body.eye-comfort .status-btn.active { color: #8c5d1e; }

/* SEO Content Section */
.seo-content {
    padding: 1.25rem 1.5rem;
    background-color: var(--toolbar-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-color);
}

.seo-container-dense {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.seo-col { display: flex; flex-direction: column; gap: 0.4rem; }

.seo-content h2,
.seo-title {
    font-size: 15px !important;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0 0 0.2rem 0;
    line-height: 1.3;
}

.seo-content h3,
.seo-subtitle {
    font-size: 13.5px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 0.4rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.seo-text { font-size: 0.8rem; line-height: 1.5; color: var(--text-color); margin-bottom: 0.4rem; }

.seo-mini-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.mini-feat {
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-color);
}

.mini-feat i { color: var(--primary-color); font-size: 0.8rem; }

.seo-list-dense {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.seo-list-dense li { font-size: 0.8rem; line-height: 1.35; margin-bottom: 0; display: block; color: var(--text-color); }

.seo-list-dense li i {
    color: var(--primary-color);
    font-size: 0.75rem;
    width: 18px;
    text-align: center;
    display: inline-block;
    margin-right: 0.3rem;
}

.seo-content b, .seo-content strong { font-weight: 800; color: var(--text-color); }
.seo-content i, .seo-content em { font-style: italic; }
.seo-content u { text-decoration: underline; }

.seo-privacy-badge {
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: 0.72rem;
    color: var(--primary-color);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Footer Styles */
.site-footer {
    background-color: var(--toolbar-bg);
    padding: 0 1.5rem 1.25rem;
    margin-top: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.72rem;
    color: var(--text-color);
    font-weight: 600;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.footer-links { display: flex; gap: 0.6rem; align-items: center; }
.footer-links a { color: inherit; text-decoration: none; transition: color 0.2s ease; font-weight: 700; }
.footer-links a:hover { color: var(--primary-color); text-decoration: underline; }

.separator { opacity: 0.6; }
.copyright { margin: 0; }

.brand-link { color: var(--primary-color); text-decoration: none; font-weight: 800; transition: opacity 0.2s ease; }
.brand-link:hover { text-decoration: underline; opacity: 0.9; }

/* View Locked State */
body.view-locked .seo-content,
body.view-locked .site-footer { display: none !important; }
body.view-locked .main-content { overflow: hidden; }
body.view-locked .container { height: 100dvh; min-height: unset; }

/* Full Width Mode */
body.full-width .notes-sidebar,
body.full-width .btn-toggle-notes { display: none; }
body.full-width .main-content { width: 100%; }

/* Glassmorphic Share Modal Styles */
.share-modal-compact {
    max-width: 360px !important;
    border-radius: 14px !important;
    padding: 1rem 1.25rem !important;
    background: var(--editor-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow) !important;
    backdrop-filter: blur(10px);
}

.share-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.35rem;
}

.share-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(46, 125, 50, 0.12);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.share-modal-title {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    color: var(--text-color) !important;
    letter-spacing: -0.3px;
}

.social-icons-modern {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 0.75rem;
}

.social-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--toolbar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.2s ease;
    color: var(--text-color);
}

.social-badge i { transition: transform 0.2s ease; }

.social-badge:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    border-color: transparent;
}

.social-badge.whatsapp:hover { background-color: #25D366; color: #ffffff; }
.social-badge.facebook:hover { background-color: #1877F2; color: #ffffff; }
.social-badge.twitter:hover { background-color: #1DA1F2; color: #ffffff; }
.social-badge.telegram:hover { background-color: #229ED9; color: #ffffff; }
.social-badge.linkedin:hover { background-color: #0A66C2; color: #ffffff; }
.social-badge.reddit:hover { background-color: #FF4500; color: #ffffff; }
.social-badge.pinterest:hover { background-color: #E60023; color: #ffffff; }

.share-copy-box {
    margin: 0.15rem auto 0 auto;
    width: calc(100% - 3px);
}

.share-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--toolbar-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 2px 2px 8px;
    gap: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.share-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.12);
}

.share-link-icon {
    font-size: 0.7rem;
    color: var(--primary-color);
    opacity: 0.85;
    flex-shrink: 0;
}

.share-copy-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 0.7rem;
    color: var(--text-color);
    outline: none;
    font-weight: 600;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-copy-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.18s ease;
}

.share-copy-btn:hover {
    background: var(--primary-color);
    filter: brightness(0.9);
    transform: scale(1.04);
}

.share-copy-btn.copied {
    background: var(--primary-color) !important;
    animation: copyPulse 0.3s ease;
}

@keyframes copyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

body.dark-mode .share-copy-btn { background: #4CAF50; color: #121212; }
body.eye-comfort .share-copy-btn { background: #8c5d1e; color: #fdf6e3; }

/* Mobile-First Controls */
@media (max-width: 768px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }

    .header { 
        height: 42px !important;
        min-height: 42px !important;
        padding: 0.35rem 0.65rem !important;
        background-color: var(--toolbar-bg); 
    }

    .btn-toggle-notes,
    .theme-toggle-circle,
    .btn-toggle-menu-circle,
    .header-actions .btn-secondary,
    .header-actions .btn-ai-header,
    .header-actions .btn-kofi,
    .btn-login {
        min-height: 32px !important;
        min-width: 32px !important;
        font-size: 0.82rem !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 0.5rem !important;
    }

    .notes-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px !important;
        height: 100dvh;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-out;
        box-shadow: 5px 0 18px rgba(0,0,0,0.25);
        background-color: var(--toolbar-bg); 
        padding: 0 0.65rem 0.85rem 0.65rem !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    .notes-sidebar.open { transform: translateX(0); }

    .sidebar-archive-section.visible {
        display: block !important;
        flex-shrink: 0 !important;
        margin-top: auto !important;
        padding-top: 8px !important;
        border-top: 1px solid var(--border-color) !important;
    }
    
    #newNoteBtn { padding: 0.5rem 0.6rem; font-size: 0.82rem; height: 34px; margin-bottom: 0.4rem; }
    
    .note-item { 
        padding: 0.45rem 0.6rem !important; 
        border-radius: 6px; 
        min-height: 38px;
        margin-bottom: 1px !important;
        margin-top: 1px !important;
    }
    
    .note-item-title { font-size: 0.78rem; }
    .main-content { width: 100%; }

    .header-left, .logo { gap: 0.4rem; }
    .logo h1 { font-size: 1rem; line-height: 1.2; color: var(--text-color); }
    .logo i { font-size: 1.1rem; }
    .hide-mobile { display: none !important; }

    .toolbar { 
        position: sticky;
        height: 38px !important;
        min-height: 38px !important;
        margin: 2px 6px 4px 6px !important;
        padding: 0.3rem 0.5rem !important; 
        gap: 0.25rem; 
        background-color: var(--toolbar-bg); 
        top: 42px; 
        border-radius: 16px !important;
        clip-path: inset(0 round 16px) !important;
        overflow-x: scroll !important; 
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin !important;
        scrollbar-color: var(--primary-color) var(--border-color) !important;
    }

    .toolbar::after {
        content: '';
        position: absolute;
        bottom: 1.5px;
        left: 20px;
        right: 20px;
        height: 1.5px;
        background: linear-gradient(90deg, var(--primary-color) 35%, var(--border-color) 35%);
        border-radius: 10px;
        pointer-events: none;
        opacity: 0.85;
    }

    .toolbar::-webkit-scrollbar {
        -webkit-appearance: none !important;
        appearance: none !important;
        display: block !important;
        height: 1.5px !important;
        background: var(--border-color) !important;
    }

    .toolbar::-webkit-scrollbar-track {
        background: var(--border-color) !important;
        height: 1.5px !important;
    }

    .toolbar::-webkit-scrollbar-thumb {
        background: var(--primary-color) !important;
        height: 1.5px !important;
        border-radius: 2px !important;
    }

    .toolbar-btn,
    .toolbar-color-label {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.82rem !important;
    }

    .toolbar-btn i {
        font-size: 0.82rem !important;
    }

    .toolbar-select {
        height: 30px !important;
        font-size: 0.78rem !important;
        padding: 0 1.1rem 0 0.4rem !important;
    }

    .toolbar-group { 
        height: 22px !important;
        padding: 0 0.15rem; 
        gap: 0.25rem !important;
    }
    
    .editor { 
        padding: 0.75rem 0.85rem 4rem 0.85rem !important; 
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    .editor h1 { font-size: 1.25rem !important; margin: 0.4rem 0; }
    .editor h2 { font-size: 1.1rem !important; margin: 0.35rem 0; }
    .editor h3 { font-size: 0.98rem !important; margin: 0.3rem 0; }
    .editor p { margin-bottom: 0.4rem !important; }

    .status-bar {
        flex-direction: row;
        justify-content: space-between;
        gap: 5px;
        padding: 0.2rem 0.5rem calc(0.2rem + env(safe-area-inset-bottom, 0px)) 0.5rem;
        font-size: 0.7rem;
        background-color: var(--toolbar-bg); 
        z-index: 10;
    }
    
    .status-center { position: static; transform: none; flex: 0 0 auto; order: 2; }
    .status-left { flex: 1; order: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .status-right { flex: 1; order: 3; }
    .status-right span { font-size: 0.7rem; }
    
    .seo-content { padding: 1.25rem 0.75rem; background-color: var(--toolbar-bg); }
    .seo-container-dense { grid-template-columns: 1fr; gap: 1.25rem; }
    .seo-mini-features { grid-template-columns: 1fr 1fr; }

    .history-body-layout {
        flex-direction: column;
        height: 500px;
    }

    .snapshot-list {
        width: 100%;
        height: 160px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.5rem;
    }
}

@media (max-width: 680px) {
    .ai-grid-basic,
    .ai-grid-extended { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .site-footer { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
    .footer-content { flex-direction: column; gap: 0.75rem; text-align: center; padding-bottom: 0; }
    .footer-links { flex-wrap: wrap; justify-content: center; line-height: 1.5; gap: 0.4rem 0.75rem; }
}

@media (max-width: 480px) {
    .header-left, .logo { gap: 0.3rem; }
    .logo i { font-size: 1rem; }
    .logo h1 { font-size: 0.95rem; white-space: nowrap; }
    .toolbar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.35rem; }
    .toolbar-group { border-right: none; }

    .ai-modal-content {
        padding: 0.75rem !important;
        width: 92% !important;
        max-height: calc(100dvh - env(safe-area-inset-top, 10px) - env(safe-area-inset-bottom, 10px) - 20px) !important;
    }

    .ai-banner-container { gap: 3px !important; font-size: 0.62rem !important; }
    .ai-banner-badge { padding: 1px 5px !important; }
    .ai-section-label { margin: 4px 0 2px 2px !important; font-size: 0.62rem !important; }
    .ai-actions-grid { grid-template-columns: 1fr; gap: 5px !important; }
    .ai-opt-btn { padding: 5px 6px !important; }
    .note-item-title { font-size: 0.72rem !important; }
    .download-modal-content { padding: 0.85rem !important; }
    .download-options-grid { grid-template-columns: repeat(1, 1fr); gap: 6px !important; }
    .download-option-btn { font-size: 0.72rem !important; padding: 6px 8px !important; }
    .download-option-btn i:first-child { margin-right: 6px !important; font-size: 0.85rem !important; }
    .social-icons-modern {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        justify-items: center;
    }
    .social-badge {
        width: 42px;
        height: 42px;
        font-size: 1rem;
        border-radius: 10px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
        overflow: visible;
        font-family: var(--editor-font-family, 'Times New Roman', serif) !important;
        font-size: var(--editor-font-size, 12pt) !important;
        line-height: var(--editor-line-height, 1.4) !important;
    }

    .header, .toolbar, .status-bar, .modal, .notes-sidebar,
    #notesOverlay, .btn-toggle-notes, .header-actions, .mobile-menu-container,
    .seo-content, .site-footer, #toast-container, .wiki-autocomplete-menu {
        display: none !important;
    }
    
    .page-wrapper, .main-content, .container, .editor-container { 
        display: block; 
        height: auto; 
        overflow: visible; 
        width: 100%; 
    }

    .editor {
        padding: 0; 
        overflow: visible; 
        box-shadow: none; 
        border: none;
        font-family: inherit !important; 
        font-size: inherit !important;
        line-height: inherit !important; 
        height: auto !important;
    }
    
    .editor p, .editor li, .editor h1, .editor h2, .editor h3 { color: black !important; }
    .editor a { color: black !important; text-decoration: underline; }
}