* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0a;
    --bg-light: #141414;
    --bg-lighter: #1f1f1f;
    --text-white: #f5f5f5;
    --text-gray: #a0a0a0;
    --border-color: #2a2a2a;
    --accent: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-white);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

.screen {
    display: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

.screen.active {
    display: flex;
}

/* ===== LOGIN SCREEN ===== */
.login-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: 20px;
}

.login-card {
    max-width: 400px;
    width: 100%;
    padding: 40px 30px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: cardSlideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card h1 {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 8px;
    color: var(--text-white);
}

.subtitle {
    color: var(--text-gray);
    font-size: clamp(12px, 2vw, 13px);
    margin-bottom: 32px;
    letter-spacing: 1px;
}

input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 14px;
    background: rgba(31, 31, 31, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 16px;
    margin-bottom: 16px;
    font-family: inherit;
    transition: all 0.25s ease;
}

input::placeholder {
    color: rgba(160, 160, 160, 0.5);
}

input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.primary-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    color: var(--bg-dark);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1.5px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 12px;
}

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--text-gray);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

.secondary-btn:active {
    transform: scale(0.98);
}

/* ===== APP LAYOUT ===== */
.app-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 200;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.new-note-btn, .new-folder-btn {
    margin: 8px 16px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    color: var(--bg-dark);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.2px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.new-folder-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    margin-top: 0;
}

.new-note-btn:active, .new-folder-btn:active {
    transform: scale(0.98);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px;
    -webkit-overflow-scrolling: touch;
}

.empty-message {
    padding: 12px;
    text-align: center;
    color: rgba(160, 160, 160, 0.5);
    font-size: 12px;
}

.folder-section {
    margin-bottom: 4px;
}

.folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.folder-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.folder-header.drag-over {
    background: rgba(100, 200, 255, 0.15);
    border: 2px solid rgba(100, 200, 255, 0.5);
    transform: scale(1.03);
    box-shadow: 0 0 20px rgba(100, 200, 255, 0.3);
}

.folder-header:active {
    transform: scale(0.98);
}

.folder-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.folder-icon {
    font-size: 12px;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    color: var(--text-gray);
}

.folder-header.collapsed .folder-icon {
    transform: rotate(-90deg);
}

.folder-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-actions {
    display: none;
    gap: 4px;
    flex-shrink: 0;
}

.folder-header:hover .folder-actions {
    display: flex;
}

.folder-action-btn {
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 3px;
    color: var(--text-gray);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.folder-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
}

.folder-notes {
    padding-left: 20px;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.folder-notes.collapsed {
    max-height: 0;
}

/* ===== UNCATEGORIZED SECTION ===== */
.uncategorized-section {
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.uncategorized-section.drag-over {
    background: rgba(150, 100, 255, 0.15);
    border: 2px solid rgba(150, 100, 255, 0.5);
    box-shadow: 0 0 20px rgba(150, 100, 255, 0.3);
}

.uncategorized-header {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-gray);
    letter-spacing: 0.8px;
}

.note-item {
    padding: 10px 12px;
    margin-bottom: 2px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: move;
    transition: all 0.15s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: none;
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.note-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.1);
}

.note-item.ghost-dragging {
    opacity: 0.8;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    transform: rotate(2deg);
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.note-item:active {
    transform: scale(0.98);
}

.note-item.active {
    background: rgba(255, 255, 255, 0.12);
}

.note-item-title {
    font-weight: 500;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    pointer-events: none;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== ONLINE PRESENCE INDICATOR ===== */
.online-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    color: var(--text-gray);
    transition: all 0.4s ease;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    flex-shrink: 0;
    transition: background 0.4s ease;
    box-shadow: 0 0 0 0 transparent;
    animation: dotPulse 2.5s infinite;
}

@keyframes dotPulse {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
    60%  { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.settings-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-white);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 8px;
}

.settings-btn:active {
    transform: scale(0.98);
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: var(--text-gray);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.logout-btn:active {
    transform: scale(0.98);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95) 0%, rgba(15, 15, 15, 0.95) 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.empty-state-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    display: none;
}

@media (max-width: 768px) {
    .empty-state-header {
        display: block;
    }
}

.empty-state h2 {
    color: var(--text-gray);
    font-size: clamp(14px, 3vw, 16px);
    letter-spacing: 1px;
    font-weight: 500;
    text-align: center;
}

.hint-text {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(160, 160, 160, 0.6);
    font-weight: 400;
    text-align: center;
}

.note-editor {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.editor-header {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: transparent;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    color: #000;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
    align-items: center;
    justify-content: center;
}

.menu-toggle svg {
    pointer-events: none;
    stroke: #000;
}

.menu-toggle:active {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.4);
}

.note-title-input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 700;
    color: var(--text-white);
    outline: none;
    font-family: inherit;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.note-title-input:focus {
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.note-title-input::placeholder {
    color: rgba(160, 160, 160, 0.4);
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.folder-select {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-white);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.8px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.folder-select:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ===== FOLDER POPUP ===== */
.folder-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.folder-popup-overlay.active {
    display: flex;
}

.folder-popup {
    background: linear-gradient(135deg, rgba(25, 25, 25, 0.98) 0%, rgba(20, 20, 20, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: popupSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.folder-popup h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    color: var(--text-white);
}

#folderPopupList {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px;
    -webkit-overflow-scrolling: touch;
}

#folderPopupList::-webkit-scrollbar {
    width: 4px;
}

#folderPopupList::-webkit-scrollbar-track {
    background: transparent;
}

#folderPopupList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.folder-option {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
}

.folder-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(4px);
}

.folder-option:active {
    transform: scale(0.98);
}

.folder-option-icon {
    font-size: 16px;
}

.folder-option-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
}

.folder-option.no-folder {
    border-color: rgba(255, 255, 255, 0.15);
}

.folder-option.no-folder .folder-option-text {
    color: var(--text-gray);
}

.folder-popup-close {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-gray);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.folder-popup-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.folder-popup-close:active {
    transform: scale(0.98);
}

#noteContent {
    flex: 1;
    padding: 20px;
    background: transparent;
    border: none;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-white);
    resize: none;
    outline: none;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#noteContent::placeholder {
    color: rgba(160, 160, 160, 0.4);
}

.editor-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.5) 0%, rgba(20, 20, 20, 0.8) 100%);
    font-size: 12px;
    color: var(--text-gray);
    letter-spacing: 1px;
}

#syncStatusDot {
    font-size: 11px;
    letter-spacing: 0.5px;
    opacity: 0.6;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.icon-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-white);
    cursor: pointer;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.8px;
    font-family: inherit;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn.danger {
    border-color: rgba(255, 107, 107, 0.2);
    color: rgba(255, 160, 160, 0.7);
}

.icon-btn.danger:active {
    border-color: rgba(255, 107, 107, 0.6);
    background: rgba(255, 107, 107, 0.08);
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(31, 31, 31, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== SIDEBAR OVERLAY (Mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 150;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 280px;
        transform: translateX(-100%);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
        background: rgba(20, 20, 20, 1);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .editor-header {
        padding: 12px;
        gap: 8px;
        background: transparent;
    }

    #noteContent {
        padding: 16px;
        font-size: 14px;
    }

    .editor-footer {
        padding: 10px 16px;
        font-size: 11px;
    }

    .icon-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
}

.sidebar-overlay.active {
    display: block;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 280px;
        transform: translateX(-100%);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
        background: rgba(20, 20, 20, 1);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .editor-header {
        padding: 12px;
        gap: 8px;
        background: transparent;
    }

    #noteContent {
        padding: 16px;
        font-size: 14px;
    }

    .editor-footer {
        padding: 10px 16px;
        font-size: 11px;
    }

    .icon-btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    .editor-header {
        gap: 6px;
    }
    .note-title-input {
        flex: 1 1 0;
        min-width: 0;
    }
    .editor-actions {
        gap: 4px;
        flex-shrink: 0;
    }
    .editor-actions .folder-select,
    .editor-actions #deleteNoteBtn,
    .editor-actions #focusModeBtn {
        font-size: 0 !important;
        padding: 0 !important;
        width: 32px;
        height: 32px;
        min-width: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .editor-actions .folder-select::before {
        content: "📁";
        font-size: 15px;
    }
    .editor-actions #deleteNoteBtn::before {
        content: "🗑";
        font-size: 15px;
    }
    .editor-actions #focusModeBtn::before {
        content: "⛶";
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 260px;
        background: rgba(20, 20, 20, 1);
    }

    .login-card {
        padding: 32px 24px;
    }

    .new-note-btn, .new-folder-btn {
        margin: 8px 12px;
        padding: 10px;
        font-size: 11px;
    }

    #noteContent {
        padding: 14px;
        font-size: 14px;
    }

    .editor-footer {
        padding: 8px 14px;
    }

    .menu-toggle {
        width: 40px;
        height: 40px;
    }
}

/* ===== TABS ===== */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
    flex: 1;
    padding: 16px 12px;
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--text-white);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--text-white);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* ===== FILES LIST ===== */
.files-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 2px;
}

.file-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.file-action-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 4px;
    color: var(--text-white);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.file-action-btn.danger {
    color: rgba(255, 150, 150, 0.9);
}

.file-action-btn.danger:hover {
    background: rgba(255, 100, 100, 0.2);
}

/* ===== FILES VIEW (Main Content) ===== */
.files-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
    min-height: 0; /* Crucial for nested flex scrolling */
}

.files-view-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.files-view-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-white);
}

.files-grid {
    flex: 1;
    padding: 20px 20px 100px 20px; /* Added large bottom padding */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    scrollbar-gutter: stable;
}

/* Custom scrollbar for files grid to match theme */
.files-grid::-webkit-scrollbar {
    width: 6px;
}

.files-grid::-webkit-scrollbar-track {
    background: transparent;
}

.files-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.folder-grid-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-gray);
    letter-spacing: 1px;
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-transform: uppercase;
}

.folder-grid-header:first-child {
    margin-top: 0;
}

.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
}

.file-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.file-card:active {
    cursor: grabbing;
}

.file-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.file-card-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.file-card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.file-card-details {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-meta {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
}

.file-card-actions {
    display: flex;
    gap: 8px;
}

.file-card-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--text-white);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-card-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.file-card-btn.danger {
    color: rgba(255, 150, 150, 0.9);
}

.file-card-btn.danger:hover {
    background: rgba(255, 100, 100, 0.2);
}

/* ===== UPLOAD PROGRESS ===== */
.upload-progress {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px 24px;
    min-width: 280px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.upload-progress.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.upload-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 30%;
    background: var(--text-white);
    border-radius: 2px;
    animation: progressMove 1s ease infinite;
}

@keyframes progressMove {
    0% { left: -30%; }
    100% { left: 100%; }
}

#uploadProgressText {
    font-size: 12px;
    color: var(--text-gray);
    letter-spacing: 0.5px;
}

/* ===== FOCUS MODE ===== */
.focus-mode-overlay {
    position: fixed;
    inset: 0;
    background: #1a1a1a;
    color: #c9c5b8;
    z-index: 10000;
    display: none;
    flex-direction: column;
    font-family: 'Roboto', sans-serif;
    transition: background 0.25s ease, color 0.25s ease;
}
.focus-mode-overlay.active {
    display: flex;
}
.focus-mode-overlay.light {
    background: #f5efe0;
    color: #3d3a35;
}
.focus-controls {
    position: absolute;
    top: 20px;
    right: 24px;
    display: flex;
    gap: 10px;
    z-index: 2;
}
.focus-btn {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.focus-btn:hover {
    opacity: 1;
}
#focusContent {
    flex: 1;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 80px 80px 100px 80px;
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: left;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: inherit;
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    line-height: 1.7;
    scrollbar-width: none;
}
#focusContent::-webkit-scrollbar {
    display: none;
}
.focus-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#focusContent::placeholder {
    color: currentColor;
    opacity: 0.35;
}

.editor-actions {
    align-items: stretch;
}
.editor-actions > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
#focusModeBtn {
    padding: 0 12px;
    font-size: 16px;
    min-width: 36px;
}

/* ===== CALENDAR & GROUPS SYSTEM ===== */
.calendar-sidebar-section {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow-y: auto;
}

.calendar-sidebar-section h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-gray);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    animation: itemSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.group-item.active-filter {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.day-cell.faded {
    opacity: 0.25;
}

.day-cell.faded:hover {
    opacity: 0.6;
}

.day-task-item.faded {
    opacity: 0.15;
    filter: grayscale(80%);
    box-shadow: none;
    pointer-events: none;
}

@keyframes itemSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.group-item:hover .folder-actions {
    display: flex;
}

.group-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.group-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-white);
}

.delete-group-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: color 0.2s ease;
}

.delete-group-btn:hover {
    color: #ef4444;
}

.new-group-form {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.new-group-form h4 {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.group-color-picker-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-white);
}

.group-color-picker-container label {
    color: var(--text-gray);
    font-size: 12px;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

/* Calendar Workspace Controls */
.calendar-header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    margin-right: auto;
}

.calendar-nav-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-white);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.25s ease;
}

.calendar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.calendar-nav-btn:active {
    transform: scale(0.95);
}

#calendarYearTitle {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-white);
    min-width: 60px;
    text-align: center;
}

.calendar-nav-btn.today-btn {
    width: auto;
    padding: 0 12px;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.1);
    margin-left: 8px;
}

.calendar-nav-btn.today-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes monthPulse {
    0% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); border-color: rgba(255, 255, 255, 0.06); }
    50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.4); }
    100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); border-color: rgba(255, 255, 255, 0.06); }
}

.month-container.highlight-pulse {
    animation: monthPulse 1s ease-in-out 2;
}

.calendar-year-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.month-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    animation: monthCardSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes monthCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.month-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-align: center;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-gray);
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 4px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.day-cell {
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    padding: 6px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.day-cell.empty {
    background: transparent;
    border: none;
    cursor: default;
    pointer-events: none;
}

.day-cell:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.04);
    z-index: 5;
}

.day-cell.today {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    animation: todayPulse 2s infinite;
}

@keyframes todayPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2); }
    70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.day-number {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-gray);
    margin-bottom: 4px;
    align-self: flex-start;
}
.day-cell.today .day-number {
    color: var(--text-white);
}

.day-tasks-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    max-height: 52px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

.day-tasks-container::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.day-task-item {
    font-size: 8px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    line-height: 1.2;
    border-left: 2px solid;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: taskItemScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes taskItemScaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Event popup specific styles */
.calendar-event-popup {
    max-width: 450px !important;
}

.events-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.events-list::-webkit-scrollbar {
    width: 4px;
}

.events-list::-webkit-scrollbar-track {
    background: transparent;
}

.events-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.event-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 3px solid transparent;
}

.event-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    padding-right: 8px;
}

.event-group-badge {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
}

.event-note {
    font-size: 13px;
    color: var(--text-white);
    line-height: 1.4;
    word-break: break-word;
}

.delete-event-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 11px;
    transition: color 0.2s ease;
}

.delete-event-btn:hover {
    color: #ef4444;
}

.add-event-form {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.add-event-form h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.add-event-form select {
    width: 100%;
    padding: 12px;
    background: rgba(31, 31, 31, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.add-event-form select:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(31, 31, 31, 0.9);
}

.add-event-form textarea {
    width: 100%;
    min-height: 70px;
    padding: 12px;
    background: rgba(31, 31, 31, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

.add-event-form textarea:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(31, 31, 31, 0.9);
}

/* Mobile responsive override: Show only 1 month on mobile screen widths */
@media (max-width: 768px) {
    .calendar-year-grid {
        grid-template-columns: 1fr;
    }
    .month-container:nth-child(2) {
        display: none !important;
    }
}

/* ===== NOTE PREVIEW & MARKDOWN STYLING ===== */
.note-preview-content {
    flex: 1;
    height: 0;
    min-height: 0;
    padding: 20px;
    background: transparent;
    border: none;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-white);
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.note-preview-content p {
    margin-bottom: 1em;
}

.note-preview-content h1, 
.note-preview-content h2, 
.note-preview-content h3, 
.note-preview-content h4, 
.note-preview-content h5, 
.note-preview-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text-white);
    font-weight: 700;
}

.note-preview-content h1 { font-size: 1.8em; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.3em; }
.note-preview-content h2 { font-size: 1.5em; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.3em; }
.note-preview-content h3 { font-size: 1.3em; }
.note-preview-content h4 { font-size: 1.1em; }

.note-preview-content strong {
    font-weight: 700;
}

.note-preview-content em {
    font-style: italic;
}

.note-preview-content u {
    text-decoration: underline;
}

.preview-link {
    color: #3b82f6;
    text-decoration: underline;
    cursor: pointer;
}

.preview-link:hover {
    color: #60a5fa;
}

.preview-image-container {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 100%;
}

.preview-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    object-fit: contain;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s ease;
}

.preview-image:hover {
    transform: scale(1.01);
}

.preview-image-caption {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 6px;
    font-style: italic;
}

/* Make preview button active look distinct */
#previewModeBtn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.note-preview-content code {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #f43f5e; /* Rose color for code highlights */
}

/* ===== OBSIDIAN MARKDOWN EXTENSIONS ===== */
.preview-highlight {
    background-color: rgba(234, 179, 8, 0.25); /* Subtle transparent yellow */
    color: #fef08a; /* Bright yellow text */
    padding: 0 4px;
    border-radius: 3px;
}

.preview-wiki-link {
    color: #14b8a6; /* Teal color for wiki links */
    border-bottom: 1px dashed rgba(20, 184, 166, 0.5);
    cursor: help;
    font-weight: 500;
}

.preview-wiki-link:hover {
    color: #2dd4bf;
    border-bottom-style: solid;
}

.preview-blockquote {
    border-left: 4px solid #a855f7; /* Purple border for blockquotes */
    background: rgba(168, 85, 247, 0.05);
    padding: 12px 18px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

.preview-blockquote p {
    margin: 0;
}

.preview-code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin: 18px 0;
    overflow: hidden;
}

.code-block-header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 14px;
    font-size: 11px;
    color: var(--text-gray);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-code-block code {
    display: block;
    padding: 14px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    color: #e2e8f0;
}

/* Bullet list styles */
.preview-ul {
    list-style-type: disc;
    padding-left: 24px;
    margin: 12px 0;
}

.preview-ul li {
    margin-bottom: 6px;
}

/* Ordered list styles */
.preview-ol {
    list-style-type: decimal;
    padding-left: 24px;
    margin: 12px 0;
}

.preview-ol li {
    margin-bottom: 6px;
}

/* Checklist / Task list styles */
.task-list-item {
    list-style-type: none;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.task-list-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    outline: none;
    background-color: transparent;
    cursor: not-allowed;
    position: relative;
    flex-shrink: 0;
}

.task-list-item input[type="checkbox"]:checked {
    background-color: #10b981;
    border-color: #10b981;
}

.task-list-item input[type="checkbox"]:checked::after {
    content: "✔";
    position: absolute;
    color: white;
    font-size: 11px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.task-list-item span {
    color: var(--text-white);
}

.task-list-item input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    opacity: 0.6;
}

.preview-hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 100%);
    margin: 24px 0;
}

.preview-empty-line {
    height: 12px;
}

/* ===== FOCUS MODE PREVIEW STYLING ===== */
#focusPreview {
    flex: 1;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 80px 80px 100px 80px;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    line-height: 1.7;
    overflow-y: auto;
    min-height: 0;
    height: 0;
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: left;
    box-sizing: border-box;
}

#focusPreview::-webkit-scrollbar {
    display: none;
}

/* Ensure all normal elements inside focusPreview inherit colors and typography */
#focusPreview h1,
#focusPreview h2,
#focusPreview h3,
#focusPreview h4,
#focusPreview h5,
#focusPreview h6,
#focusPreview p,
#focusPreview li,
#focusPreview ul,
#focusPreview ol,
#focusPreview strong,
#focusPreview em,
#focusPreview td,
#focusPreview th,
#focusPreview span,
#focusPreview div {
    font-family: 'Roboto', sans-serif !important;
    color: inherit !important;
}

/* Specific styling adjustments to align with focus mode aesthetics */
#focusPreview h1 {
    font-size: 2em;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    border-bottom: 1px solid currentColor;
    opacity: 0.95;
    padding-bottom: 0.3em;
}

#focusPreview h2 {
    font-size: 1.6em;
    font-weight: 600;
    margin-top: 1.4em;
    margin-bottom: 0.5em;
    border-bottom: 1px solid currentColor;
    opacity: 0.9;
    padding-bottom: 0.2em;
}

#focusPreview h3 {
    font-size: 1.35em;
    font-weight: 600;
    margin-top: 1.3em;
    margin-bottom: 0.4em;
}

#focusPreview h4 {
    font-size: 1.15em;
    font-weight: 600;
    margin-top: 1.2em;
    margin-bottom: 0.3em;
}

#focusPreview p {
    margin-bottom: 1.2em;
    font-size: 18px;
    line-height: 1.7;
}

#focusPreview blockquote {
    border-left: 4px solid currentColor;
    background: rgba(201, 197, 184, 0.08); /* default dark */
    color: inherit !important;
    opacity: 0.85;
    padding: 12px 18px;
    margin: 18px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.focus-mode-overlay.light #focusPreview blockquote {
    background: rgba(61, 58, 53, 0.08); /* light theme */
}

#focusPreview .task-list-item input[type="checkbox"] {
    border-color: currentColor;
    opacity: 0.7;
}

#focusPreview .task-list-item input[type="checkbox"]:checked {
    background-color: #10b981;
    border-color: #10b981;
}

#focusPreview .preview-hr {
    background: linear-gradient(90deg, rgba(201,197,184,0) 0%, rgba(201,197,184,0.2) 50%, rgba(201,197,184,0) 100%);
}

.focus-mode-overlay.light #focusPreview .preview-hr {
    background: linear-gradient(90deg, rgba(61,58,53,0) 0%, rgba(61,58,53,0.2) 50%, rgba(61,58,53,0) 100%);
}

#focusPreview .preview-code-block {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.focus-mode-overlay.light #focusPreview .preview-code-block {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

#focusPreview .preview-code-block code {
    color: inherit !important;
}

#focusPreview .preview-table-container {
    border: 1px solid rgba(201,197,184,0.15);
    background: rgba(0, 0, 0, 0.1);
}

.focus-mode-overlay.light #focusPreview .preview-table-container {
    border: 1px solid rgba(61,58,53,0.15);
    background: rgba(0, 0, 0, 0.03);
}

#focusPreview .preview-table th {
    border-bottom: 2px solid rgba(201,197,184,0.25);
    background: rgba(201,197,184,0.05);
}

.focus-mode-overlay.light #focusPreview .preview-table th {
    border-bottom: 2px solid rgba(61,58,53,0.25);
    background: rgba(61,58,53,0.05);
}

#focusPreview .preview-table td {
    border-bottom: 1px solid rgba(201,197,184,0.1);
}

.focus-mode-overlay.light #focusPreview .preview-table td {
    border-bottom: 1px solid rgba(61,58,53,0.1);
}

#focusPreview .preview-image-container {
    direction: ltr;
    align-items: flex-start;
}

#focusPreviewToggle.active {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

/* ===== TABLE STYLING ===== */
.preview-table-container {
    max-width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    text-align: left;
}

.preview-table th {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 2px solid rgba(255, 255, 255, 0.12);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-white);
}

.preview-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
}

.preview-table tr:last-child td {
    border-bottom: none;
}

.preview-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

