/* Language loading - prevent flash of wrong language */
body.lang-loading [data-lang] {
    visibility: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force cursor visibility for all browsers including Edge */
html,
body {
    cursor: default;
}

/* Global editor cursor fix - highest priority */
#editor,
#editor[contenteditable="true"] {
    cursor: text !important;
    caret-color: currentColor !important;
    pointer-events: auto !important;
}

.editor-container {
    cursor: text !important;
    pointer-events: auto !important;
}

/* Screen Reader Only - Hide visually but keep for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Mobile-first optimizations */
:root {
    /* Modern Color Palette - Slate & Blue */

    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #d3d3d3;
    /* Slate-100 - Gray-toned for editor */
    --bg-tertiary: #e2e8f0;
    /* Slate-200 */
    --bg-hover: #cbd5e1;
    /* Slate-300 */

    /* Glass effect backgrounds */
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-strong: rgba(255, 255, 255, 0.95);
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f8fafc;

    --text-primary: #0f172a;
    /* Slate-900 */
    --text-secondary: #475569;
    /* Slate-600 */
    --text-tertiary: #94a3b8;
    /* Slate-400 */

    --border-color: #e2e8f0;
    /* Slate-200 */
    --border-hover: #cbd5e1;
    /* Slate-300 */
    --border-subtle: rgba(148, 163, 184, 0.2);
    --border-default: rgba(148, 163, 184, 0.4);
    --border-strong: #cbd5e1;

    /* Primary colors */
    --primary-color: #2563eb;
    /* Blue-600 */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    /* Blue-700 */
    --primary-active: #1e40af;
    --primary-light: rgba(37, 99, 235, 0.1);
    --primary-text: #ffffff;

    /* Status colors */
    --danger-color: #ef4444;
    /* Red-500 */
    --success-color: #22c55e;
    /* Green-500 */
    --warning-color: #f59e0b;
    /* Amber-500 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    --viewport-height: 100vh;
    --sidebar-width: 260px;
}

/* Mobile toolbar overflow - hidden by default */
.mobile-toolbar-overflow {
    display: none !important;
}

/* Base mobile overlay/menu styles (work on all widths) */
.REMOVED-mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    display: none;
    align-items: flex-start;
    justify-content: flex-end;
    /* open from right */
}

.REMOVED-mobile-menu-overlay.show {
    display: flex;
}

.REMOVED-mobile-menu {
    background: white;
    width: 280px;
    height: 100%;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    /* start off-screen to the right */
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 20001;
}

.REMOVED-mobile-menu.show {
    transform: translateX(0);
}

/* Desktop - explicitly hide mobile elements */
@media (min-width: 769px) {

    .mobile-toolbar-overflow {
        display: none !important;
    }

    .mobile-toolbar-dropdown {
        display: none !important;
    }

    /* Ensure menu groups are visible on desktop */
    .menu-group {
        display: flex !important;
    }
}

/* Prevent zoom on input focus */
input,
textarea,
select {
    font-size: 16px;
    /* Prevent zoom on iOS */
}

/* Touch-friendly button sizing */
button,
.toolbar-button,
.menu-item {
    min-height: 44px;
    /* Apple's recommended touch target size */
    min-width: 44px;
}

/* Scrollbar styling for mobile */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: var(--viewport-height, 100vh);
    /* Support for mobile virtual keyboard */
    transition: padding-top 0.3s ease-out;
    cursor: default;
    /* Removed !important to allow child elements to override */
}

/* Sidebar */
:root {
    --sidebar-width: 260px;
}

.sidebar-toggle {
    display: none;
    /* desktop default: hidden */
    border: none;
    background: transparent;
    font-size: 20px;
    width: 48px;
    /* Increased for better touch target */
    height: 48px;
    /* Increased for better touch target */
    margin-right: 8px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    /* Remove blue highlight on mobile */
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-toggle:active {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
}

/* Expand touch area for mobile */
.sidebar-toggle::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: transparent;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 20000;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Prevent scroll bounce and improve touch handling */
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-weight: 600;
}

.sidebar-close {
    border: none;
    background: transparent;
    font-size: 18px;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.sidebar-content {
    padding: 8px 8px 24px;
}

.sidebar-section {
    margin-bottom: 12px;
}

.sidebar-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin: 12px 8px 6px;
}

.sidebar .menu-item {
    width: 100%;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 19999;
    display: none;
    /* default hidden until sidebar opens */
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar only on mobile/tablet */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .menu-group {
        display: none !important;
    }

    /* Ensure sidebar is visible on mobile */
    .sidebar {
        z-index: 30000 !important;
        width: 280px !important;
    }

    .sidebar-overlay {
        z-index: 29999 !important;
    }

    /* Ensure sidebar toggle button is visible and accessible */
    .sidebar-toggle {
        z-index: 10001 !important;
        position: relative !important;
    }
}

/* On desktop, hide sidebar widgets entirely */
@media (min-width: 1025px) {

    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay {
        display: none !important;
    }
}

/* Hide old top menu when sidebar is used */
/* legacy: ensure top menu stays on desktop */

.title-bar {
    background: var(--bg-primary);
    height: 32px;
    border-bottom: none;
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: relative;
    z-index: 1000;
}

.menu-bar {
    background: var(--bg-secondary);
    height: 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
}

.app-icon {
    width: auto;
    height: 32px;
    margin-right: 12px;
    background-image: none;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-logo-text {
    display: block;
    /* Show on desktop */
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
}

.app-logo-image {
    height: 110px;
    width: auto;
    max-width: 500px;
    object-fit: contain;
    display: block;
}

.file-tabs {
    background: var(--bg-primary);
    height: 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: end;
    border: none;
    outline: none;
    padding-left: 12px;
    margin: 0;
    border-top: none;
}

.tab {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 0 30px 0 10px;
    margin-right: 2px;
    position: relative;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    height: 26px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    min-width: 100px;
    max-width: 200px;
    overflow: hidden;
}

.tab:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.tab.active {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--bg-primary);
    margin-bottom: -1px;
    border-color: var(--border-hover);
    box-shadow: 0 -1px 3px var(--shadow-sm);
    z-index: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.tab-close {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 2px;
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.tab-close:hover {
    background: var(--bg-hover);
    opacity: 1;
    color: var(--text-primary);
}

.tab:not(:hover) .tab-close {
    opacity: 0.4;
}

.tab-filename-input {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    width: 100%;
    padding: 0;
    margin: 0;
    outline: none;
    min-width: 60px;
    max-width: 150px;
}

.tab-filename-input:focus {
    background: var(--bg-primary);
    border: 1px solid var(--primary-color);
    border-radius: 2px;
    padding: 1px 3px;
    margin: -1px -3px;
}

.toolbar {
    background: var(--bg-primary);
    height: 36px;
    /* box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1), 0 2px 0 0 var(--text-secondary); */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* align left to enable natural overflow */
    padding: 0 8px;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    z-index: 100;
    /* Always show scrollbar space to prevent height changes between modes */
    /* padding-bottom: 8px; */
    /* min-height: 50px; */
}

/* Toolbar separator override - convert white inline styles to theme colors */
.toolbar>div[style*="background: white"] {
    background: var(--border-color, #e1e1e1) !important;
}

.toolbar>div[style*="background: white"][style*="width"] {
    background: var(--border-color, #e1e1e1) !important;
}

/* Toolbar SVG separator color override */
.toolbar svg line[stroke="white"],
.toolbar svg line[stroke="#ffffff"],
.toolbar svg[style*="white"],
.toolbar svg[style*="ffffff"] {
    stroke: var(--border-color, #e1e1e1) !important;
}

/* Show horizontal scrollbar explicitly */
.toolbar {
    scrollbar-width: thin;
}

.toolbar::-webkit-scrollbar {
    height: 8px;
}

.toolbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.toolbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Desktop: show a thin horizontal scrollbar when overflowing */
@media (min-width: 769px) {
    .toolbar {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        /* Firefox */
        /* Thumb and track colors for Firefox */
        scrollbar-color: rgba(0, 120, 212, 0.28) rgba(0, 0, 0, 0.04);
    }

    .toolbar::-webkit-scrollbar {
        height: 8px;
        display: block;
    }

    .toolbar::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.04);
    }

    .toolbar::-webkit-scrollbar-thumb {
        background: rgba(0, 120, 212, 0.25);
        border-radius: 4px;
        border: 1px solid rgba(255, 255, 255, 0.4);
    }

    .toolbar .toolbar-section {
        flex-shrink: 0;
    }

}

/* Responsive toolbar for small screens */
@media (max-width: 1400px) {
    .toolbar {
        padding: 0 12px;
        gap: 3px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #editor {
        padding: 20px 24px;
    }

    .toolbar-section {
        margin-right: 12px;
        padding-right: 12px;
        gap: 3px;
        flex-shrink: 0;
        border-right: 1px solid var(--border-color, #e1e1e1);
    }

    .toolbar-button {
        width: 30px;
        height: 30px;
        font-size: 15px;
        min-width: 30px;
    }

    .toolbar-dropdown {
        min-width: 90px;
        max-width: 130px;
        font-size: 12px;
        padding: 3px 8px;
    }

    .menu-title {
        padding: 5px 10px;
        font-size: 13px;
    }

    .more-tools-section::before {
        display: block;
    }

    .more-tools-btn {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
    }

    .more-tools-section {
        min-width: 36px !important;
    }
}

@media (max-width: 1200px) {
    .toolbar {
        padding: 0 8px;
        gap: 2px;
        height: 36px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #editor {
        padding: 18px 20px;
    }

    .toolbar-section {
        margin-right: 8px;
        padding-right: 8px;
        gap: 2px;
        flex-shrink: 0;
    }

    .toolbar-button {
        width: 28px;
        height: 28px;
        font-size: 14px;
        min-width: 28px;
    }

    .toolbar-dropdown {
        min-width: 80px;
        max-width: 120px;
        font-size: 11px;
        padding: 2px 6px;
    }

    .menu-title {
        padding: 4px 8px;
        font-size: 12px;
    }

    .more-tools-section::before {
        display: block;
    }

    .more-tools-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }

    .more-tools-icon {
        font-size: 18px !important;
    }
}

@media (max-width: 768px) {

    .REMOVED-mobile-menu-toggle:hover {
        background: #f5f5f5;
        border-color: #0078d4;
    }

    .REMOVED-mobile-menu-toggle:active {
        background: #e9ecef;
        border-color: #0078d4;
    }

    /* Hide top menu bar and toolbar on phones; use sidebar */
    .menu-group {
        display: none !important;
    }

    .toolbar {
        display: none !important;
    }

    /* Force all toolbar sections to be visible */
    .toolbar-section {
        display: flex !important;
        flex-shrink: 0;
    }

    /* Show all toolbar sections; allow horizontal scroll */
    .toolbar-section:nth-child(1),
    .toolbar-section:nth-child(2),
    .toolbar-section:nth-child(3),
    .toolbar-section:nth-child(4),
    .toolbar-section:nth-child(5),
    .toolbar-section:nth-child(6),
    .toolbar-section:nth-child(7),
    .toolbar-section:nth-child(8) {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .toolbar {
        height: 44px;
        padding: 0 8px;
        gap: 3px;
        flex-wrap: nowrap;
        min-height: 44px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #editor {
        padding: 16px 18px;
    }


    /* ==========================================================================
   MOBILE DESIGN SYSTEM (Glass & Modern)
   ========================================================================== */

    /* 1. Visibility Logic */

    /* Default: Hide mobile elements on desktop */
    .mobile-only {
        display: none !important;
    }

    /* Mobile Breakpoint (< 768px) */
    @media (max-width: 768px) {

        /* Show mobile elements */
        .mobile-only {
            display: flex !important;
        }

        button.mobile-only,
        a.mobile-only {
            display: flex !important;
        }

        div.mobile-only {
            display: flex !important;
        }

        /* Hide desktop elements */
        .title-bar,
        .sidebar,
        .sidebar-toggle,
        .sidebar-overlay,
        .file-tabs,
        .toolbar,
        .status-bar,
        .ai-dialog {
            display: none !important;
        }

        /* Override Body / Layout for Mobile */
        body {
            background: #f8fafc;
            /* Slate-50 */
            padding: 0 !important;
            overflow: hidden !important;
            /* Managed by specific scroll containers */
            position: fixed;
            /* Prevent body scroll */
            width: 100%;
            height: 100%;
        }

        .app-container,
        .main-content {
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        /* Adjust Editor Container for Mobile */
        .editor-container {
            margin: 0 !important;
            padding: 16px !important;
            border-radius: 20px 20px 0 0 !important;
            background: #fff !important;
            box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05) !important;
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            margin-top: 10px !important;
            /* Padding for bottom nav */
            padding-bottom: 80px !important;
            border: none !important;
            min-height: auto !important;
        }

        #editor {
            padding: 0 !important;
            min-height: 50vh;
            font-size: 16px !important;
            /* Prevent iOS zoom */
        }
    }


    /* 2. Mobile Component Styles (Scoped) */

    /* Color Variables for Mobile Section */
    .mobile-header,
    .mobile-toolbar-container,
    .mobile-bottom-nav,
    .mobile-overflow-drawer {
        --glass-bg: rgba(255, 255, 255, 0.85);
        --glass-border: rgba(255, 255, 255, 0.5);
        --primary: #2563eb;
        --text-main: #0f172a;
        --text-sub: #64748b;
    }

    /* Mobile Header */
    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        height: 56px;
        width: 100%;
    }

    .header-inner {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 0 20px;
        height: 100%;
        width: 100%;
    }

    .header-logo {
        font-weight: 700;
        font-size: 20px;
        color: var(--text-main);
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .logo-text {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 800;
        letter-spacing: -0.5px;
    }

    .header-logo svg {
        width: 32px;
        height: 32px;
    }


    /* Mobile Format Bar */
    .mobile-format-bar {
        position: sticky;
        top: 56px;
        z-index: 99;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 10px 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .format-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 44px;
        height: 40px;
        border: none;
        background: transparent;
        border-radius: 10px;
        color: var(--text-sub);
        font-size: 13px;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .format-btn svg {
        width: 20px;
        height: 20px;
    }

    .format-btn:active {
        transform: scale(0.95);
        background: rgba(0, 0, 0, 0.05);
    }

    .format-btn.primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 0 16px;
        min-width: auto;
    }

    .format-btn.primary:active {
        opacity: 0.9;
    }

    .format-btn.primary svg {
        width: 18px;
        height: 18px;
    }

    .format-label {
        font-size: 14px;
        font-weight: 600;
    }

    .format-divider {
        width: 1px;
        height: 24px;
        background: rgba(0, 0, 0, 0.1);
    }


    /* Bottom Navigation */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 1000;
    }

    .bottom-nav-inner {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 60px;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: #94a3b8;
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        width: 60px;
    }

    .nav-item svg {
        width: 24px;
        height: 24px;
        transition: transform 0.2s;
    }

    .nav-item.active {
        color: var(--primary);
    }

    .nav-item.active svg {
        transform: translateY(-2px);
    }


    /* Format Menu Bottom Sheet */
    .format-menu-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .format-menu-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .format-menu-bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        background: #fff;
        border-radius: 28px 28px 0 0;
        z-index: 2001;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .format-menu-bottom-sheet.open {
        transform: translateY(0);
    }

    .sheet-handle {
        width: 48px;
        height: 5px;
        background: #e2e8f0;
        border-radius: 3px;
        margin: 12px auto;
        flex-shrink: 0;
    }

    .sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px 16px;
        border-bottom: 1px solid #f1f5f9;
        flex-shrink: 0;
    }

    .sheet-title {
        font-size: 18px;
        font-weight: 700;
        color: #0f172a;
        margin: 0;
    }

    .sheet-close {
        width: 36px;
        height: 36px;
        border: none;
        background: #f1f5f9;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .sheet-close:active {
        background: #e2e8f0;
        transform: scale(0.95);
    }

    .sheet-close svg {
        width: 20px;
        height: 20px;
        color: #64748b;
    }

    .sheet-content {
        padding: 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .format-section {
        margin-bottom: 28px;
    }

    .format-section:last-child {
        margin-bottom: 0;
    }

    .section-title {
        font-size: 13px;
        font-weight: 600;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin: 0 0 14px;
    }

    .section-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .format-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 16px 8px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .format-card svg {
        width: 24px;
        height: 24px;
        color: #475569;
    }

    .format-card span {
        font-size: 11px;
        font-weight: 500;
        color: #64748b;
    }

    .format-card:active {
        background: #e2e8f0;
        border-color: #cbd5e1;
        transform: scale(0.96);
    }

    .color-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .color-trigger {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .color-trigger:active {
        background: #e2e8f0;
        border-color: #cbd5e1;
    }

    .color-preview {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .color-trigger span:last-child {
        font-size: 13px;
        font-weight: 500;
        color: #475569;
    }

    /* Fix mobile toast position */
    @media (max-width: 768px) {
        #toast-container {
            width: 90% !important;
            left: 5% !important;
            bottom: 90px !important;
            /* Above nav */
            top: auto !important;
        }

        /* Show AI context menu on mobile */
        .ai-context-menu {
            display: flex !important;
        }
    }

}

/* Restored .toolbar-section rule */
.toolbar-section {
    margin-right: 4px;
    padding-right: 4px;
    gap: 1px;
    flex-shrink: 0;
}

.toolbar-button {
    width: 24px;
    height: 24px;
    font-size: 12px;
    min-width: 24px;
}

.toolbar-dropdown {
    min-width: 60px;
    max-width: 100px;
    font-size: 10px;
    padding: 1px 4px;
}

.menu-title {
    padding: 2px 6px;
    font-size: 11px;
}

.more-tools-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
}

.more-tools-icon {
    font-size: 16px !important;
}

/* Make toolbar horizontally scrollable on mobile instead of hiding sections */
.toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    scrollbar-width: none;
    /* Hide scrollbar on Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar on IE/Edge */
    position: relative;
}

/* Mobile Overflow Menu Button */
.mobile-toolbar-overflow {
    display: block !important;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mobile-toolbar-overflow:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.mobile-toolbar-overflow:active {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

/* Mobile Toolbar Dropdown */
.mobile-toolbar-dropdown {
    position: fixed;
    top: 100px;
    /* Below toolbar + title bar */
    left: 8px;
    right: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    max-height: 60vh;
    overflow-y: auto;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.mobile-toolbar-dropdown.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-toolbar-items {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
    justify-content: start;
}

.mobile-toolbar-items .toolbar-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.mobile-toolbar-items .toolbar-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.mobile-toolbar-items .toolbar-dropdown {
    width: 100%;
    min-width: unset;
    max-width: unset;
    height: 44px;
    font-size: 13px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    grid-column: span 2;
}

/* Show dropdown above other elements */
.mobile-toolbar-dropdown[style*="block"] {
    display: block !important;
}

/* Ensure horizontal scrolling is possible and scrollbar visible */
.toolbar {
    scrollbar-width: thin;
}

.toolbar::-webkit-scrollbar {
    height: 8px;
    display: block;
}

.toolbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.toolbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.toolbar-section {
    flex-shrink: 0;
    /* Prevent sections from shrinking */
    display: flex;
}

/* Make individual buttons smaller but still touch-friendly */
.toolbar-button {
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
    margin: 0 1px;
    font-size: 12px;
}

.toolbar-dropdown {
    min-width: 80px;
    font-size: 12px;
}

/* Optimize color palettes for mobile */
.color-palette {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    padding: 12px;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

/* Make remaining sections more compact */
.toolbar-section:nth-child(1),
/* Font section */
.toolbar-section:nth-child(2),
/* Format section */
.toolbar-section:nth-child(3) {
    /* Color section */
    margin-right: 2px;
    padding-right: 2px;
}

@media (max-width: 480px) {
    .toolbar {
        height: 48px;
        padding: 0 8px;
        gap: 4px;
        flex-wrap: nowrap;
        min-height: 48px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-toolbar-overflow {
        display: block !important;
    }

    #editor {
        padding: 14px 16px;
    }

    .toolbar-section {
        margin-right: 6px;
        padding-right: 6px;
        gap: 3px;
        flex-shrink: 0;
    }

    .toolbar-button {
        width: 36px;
        height: 36px;
        font-size: 14px;
        min-width: 36px;
        border: 1px solid #ddd;
        border-radius: 4px;
    }

    .toolbar-dropdown {
        min-width: 80px;
        max-width: 120px;
        font-size: 12px;
        padding: 6px 8px;
        height: 36px;
    }

    .menu-title {
        padding: 1px 4px;
        font-size: 10px;
    }

    .more-tools-btn {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
    }

    /* Show all toolbar sections; allow horizontal scroll */
    .toolbar-section:nth-child(4),
    .toolbar-section:nth-child(5),
    .toolbar-section:nth-child(6) {
        display: flex !important;
    }

    /* Ensure all formatting tools are visible */
    #sup-btn,
    #sub-btn,
    #strike-btn {
        display: inline-flex !important;
    }

    /* Make color section more compact */
    .toolbar-section:nth-child(3) .color-picker {
        margin-right: 1px;
    }

    .more-tools-icon {
        font-size: 14px !important;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .toolbar {
        height: 32px;
        padding: 0 1px;
        gap: 1px;
        flex-wrap: nowrap;
        min-height: 32px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #editor {
        padding: 12px 14px;
    }

    .toolbar-section {
        margin-right: 1px;
        padding-right: 1px;
        gap: 1px;
        flex-shrink: 0;
    }

    .toolbar-button {
        width: 20px;
        height: 20px;
        font-size: 10px;
        min-width: 20px;
    }

    .toolbar-dropdown {
        min-width: 40px;
        max-width: 60px;
        font-size: 8px;
        padding: 1px 2px;
    }

    .menu-title {
        padding: 1px 3px;
        font-size: 9px;
    }

    .more-tools-btn {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
    }

    .more-tools-icon {
        font-size: 12px !important;
    }
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    padding-right: 8px;
    border-right: 1px solid #e1e1e1;
    flex-shrink: 0;
    min-width: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-section:last-child {
    border-right: none;
    margin-right: 0;
    margin-left: auto;
    flex-shrink: 0;
}

.menu-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
}

/* Title bar menu styles */
.title-bar .menu-group {
    margin-left: 20px;
}

.title-bar .menu-title {
    background: transparent;
    border: none;
    color: var(--text-primary, #323130);
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.title-bar .menu-title:hover {
    background: var(--hover-bg, #f3f2f1);
}

.title-bar .menu-title.active {
    background: #0078d4;
    color: white;
}

.menu {
    position: relative;
    display: inline-block;
}

.menu-title {
    padding: 6px 12px;
    cursor: pointer;
    background: transparent;
    border: none;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary, #323130);
    border-radius: 3px;
    position: relative;
}

.menu-title:hover {
    background: var(--hover-bg, #f3f2f1);
}

.menu-title.active {
    background: #0078d4;
    color: white;
}

.toolbar-button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-primary, #323130);
    flex-shrink: 0;
    min-width: 28px;
    transition: all 0.2s ease;
    padding: 0;
    /* Prevent selection loss when clicking buttons */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Prevent text selection within buttons */
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-button:hover {
    background: var(--hover-bg, #f3f2f1);
}

.toolbar-button:active {
    background: var(--hover-bg, #edebe9);
}

/* AI Button - Minimal, no border */
.toolbar-button.ai-button {
    background: transparent;
}

.toolbar-button.ai-button:hover {
    background: transparent;
}

.toolbar-button.ai-button:active {
    transform: scale(0.95);
}

/* Simple color change on hover */
.toolbar-button.ai-button svg {
    transition: stroke 0.2s ease, fill 0.2s ease;
}

.toolbar-button.ai-button:hover svg path,
.toolbar-button.ai-button:hover svg circle {
    stroke: #7c3aed;
    fill: #7c3aed;
}

.toolbar-button.active {
    background: #0078d4;
    color: white;
}

.toolbar-button.recording {
    background: #ff4757;
    color: white;
    animation: toolbarRecordingPulse 1.5s infinite;
}

@keyframes toolbarRecordingPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.2);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(255, 71, 87, 0);
    }
}

.dropdown-button {
    width: auto;
    padding: 0 8px;
    font-size: 13px;
    min-width: 24px;
    height: 26px;
}

.toolbar-dropdown {
    padding: 4px 8px;
    border: 1px solid #d1d1d1;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    background: white;
    color: #323130;
    margin: 0 2px;
    min-width: 100px;
    flex-shrink: 0;
    max-width: 150px;
    transition: all 0.2s ease;
    cursor: pointer;
    /* Prevent selection loss when clicking dropdowns */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-dropdown:focus {
    outline: none;
    border-color: #0078d4;
}

.color-picker {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

/* Color picker button styling */
.color-picker .toolbar-button {
    position: relative;
    overflow: visible;
}

.color-picker .toolbar-button span {
    transition: all 0.2s ease;
    border-radius: 2px;
    padding: 2px 4px;
    min-width: 20px;
    text-align: center;
    display: inline-block;
}

.color-palette {
    display: none;
    position: fixed;
    top: 100px;
    left: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px var(--shadow);
    padding: 8px;
    z-index: 10000;
    grid-template-columns: repeat(8, 20px);
    gap: 4px;
    min-width: 200px;
    pointer-events: auto;
}

.color-palette.show {
    display: grid;
}

.color-option {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.color-option:hover {
    border-color: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: 0 2px 8px var(--shadow);
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 50000;
    margin-top: 2px;
    background: white;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}

/* Hide scrollbar but keep functionality */
.menu-dropdown::-webkit-scrollbar {
    width: 0px;
    display: none;
}

/* Firefox */
.menu-dropdown {
    scrollbar-width: none;
}

/* IE and Edge */
.menu-dropdown {
    -ms-overflow-style: none;
}

/* Title bar dropdown positioning */
.title-bar .menu-dropdown {
    top: 32px;
    /* Title bar height */
}

/* Mobile title bar dropdown positioning fix */
@media (max-width: 768px) {
    .title-bar .menu-dropdown {
        position: fixed !important;
        top: 50px !important;
        /* Title bar (32px) + menu button (18px) */
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        z-index: 100000 !important;
        /* Much higher than editor container */
        background: var(--bg-primary, white) !important;
        border: 1px solid var(--border-color, #e1e1e1) !important;
        border-radius: 4px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
        max-height: calc(100vh - 120px) !important;
        /* Prevent overflow */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .title-bar .menu-dropdown.show {
        display: block !important;
        visibility: visible !important;
    }
}

.menu-dropdown.show {
    display: block !important;
    visibility: visible !important;
}

.menu-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    position: relative;
    color: var(--text-primary, #323130);
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.menu-item svg {
    display: inline-block !important;
    vertical-align: middle;
    margin-right: 8px;
    flex-shrink: 0;
    width: 14px !important;
    height: 14px !important;
    fill: currentColor !important;
    color: var(--text-primary, #323130) !important;
}

.material-icon {
    display: inline-block !important;
    font-size: 14px !important;
    width: 16px;
    height: 16px;
    text-align: center;
    vertical-align: middle;
    margin-right: 8px;
    flex-shrink: 0;
    line-height: 1;
    font-family: 'Material Icons' !important;
    font-weight: normal;
    font-style: normal;
    color: inherit;
    opacity: 1 !important;
    visibility: visible !important;
    text-decoration: none !important;
}

.material-icon:not(.ai-wand-icon) {
    font-style: normal !important;
    text-decoration: none !important;
    color: currentColor !important;
}

.toolbar-button .material-icon {
    margin-right: 0;
    font-size: 16px;
    width: 18px;
    height: 18px;
}

/* AI Magic Icon */
.ai-wand-icon {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    font-size: 16px;
    text-align: center;
    line-height: 16px;
}

.ai-wand-icon::before {
    content: '✨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: var(--accent-primary, #0078d4);
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.9);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.menu-item .ai-icon,
.menu-item .settings-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    flex-shrink: 0;
}

.menu-item:hover {
    background: var(--hover-bg, #f3f2f1);
}

.menu-item:disabled {
    color: var(--text-muted, #a19f9d);
    cursor: default;
}

.menu-item:disabled:hover {
    background: transparent;
}

.menu-separator {
    height: 1px;
    background: var(--border-color, #e1e1e1);
    margin: 4px 0;
}

.shortcut {
    position: absolute;
    right: 12px;
    color: var(--text-secondary, #a19f9d);
    font-size: 12px;
}

.editor-container {
    position: fixed;
    top: 102px;
    left: 0;
    right: 0;
    bottom: 24px;
    z-index: 100;
    background: var(--bg-secondary);
    padding: 0;
    display: flex;
    flex-direction: column;
    cursor: text;
    transition: top 0.3s ease-out;
}

/* Show old toolbar - we'll use it with Quill */
.toolbar {
    display: flex !important;
}

/* Hide Quill's default toolbar - we use custom */
.ql-toolbar {
    display: none !important;
}

/* Quill editor container */
#editor {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Quill toolbar */
.ql-toolbar {
    background: var(--bg-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Quill editor area */
.ql-container {
    flex: 1 !important;
    border: none !important;
    font-family: "Cascadia Code", "Consolas", "Courier New", monospace !important;
    font-size: 14px !important;
    cursor: text !important;
    background-color: var(--bg-secondary) !important;
}

.ql-editor {
    padding: 24px 32px !important;
    color: var(--text-primary) !important;
    cursor: text !important;
    background-color: var(--bg-secondary) !important;
}

/* Force cursor visibility in Quill */
.ql-editor * {
    cursor: text;
}

.ql-editor.ql-blank::before {
    cursor: text;
}

.ql-editor {
    cursor: text;
}

.ql-container {
    cursor: text;
}

#editor {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 24px 32px;
    position: relative;
    font-family: "Cascadia Code", "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.4;
    background-color: var(--bg-secondary) !important;
    overflow: auto;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    cursor: text !important;
    caret-color: var(--text-primary, #000) !important;
    pointer-events: auto !important;
}

/* Force caret and cursor visibility */
#editor {
    caret-color: var(--text-primary, #000) !important;
    cursor: text !important;
}

#editor:focus {
    outline: none !important;
    caret-color: var(--text-primary, #000) !important;
}

/* Ensure text cursor is always visible in editor */
#editor *:not(button):not(a):not(.toolbar-btn) {
    cursor: text;
}

#editor::selection {
    background-color: rgba(255, 255, 255, 0.3);
    color: inherit;
}

#editor::-moz-selection {
    background-color: rgba(255, 255, 255, 0.3);
    color: inherit;
}

#editor p {
    margin: 0;
    min-height: 1.4em;
    display: block;
}

#editor:empty::before {
    content: "";
    display: inline;
}

/* Prevent browser from creating default paragraphs */
#editor * {
    margin: 0 !important;
    padding: 0 !important;
}

#editor br {
    display: block;
}

/* Ensure colored text is visible and properly styled */
#editor span[data-color] {
    display: inline !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    font-family: inherit !important;
    line-height: inherit !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: inherit !important;
}

/* Force the color to be applied */
#editor span[data-color] {
    color: var(--applied-color) !important;
}

/* Ensure the color is always visible */
#editor span[data-color] {
    color: inherit !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    text-decoration: inherit !important;
    font-style: inherit !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    font-family: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    word-spacing: inherit !important;
    text-transform: inherit !important;
    text-shadow: inherit !important;
    box-shadow: none !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

/* Specific color overrides for each color */
#editor span[data-color="#000000"] {
    color: #000000 !important;
}

#editor span[data-color="#ff0000"] {
    color: #ff0000 !important;
}

#editor span[data-color="#00ff00"] {
    color: #00ff00 !important;
}

#editor span[data-color="#0000ff"] {
    color: #0000ff !important;
}

#editor span[data-color="#ffff00"] {
    color: #ffff00 !important;
}

#editor span[data-color="#ff00ff"] {
    color: #ff00ff !important;
}

#editor span[data-color="#00ffff"] {
    color: #00ffff !important;
}

#editor span[data-color="#808080"] {
    color: #808080 !important;
}

#editor span[data-color="#800000"] {
    color: #800000 !important;
}

#editor span[data-color="#008000"] {
    color: #008000 !important;
}

#editor span[data-color="#000080"] {
    color: #000080 !important;
}

#editor span[data-color="#808000"] {
    color: #808000 !important;
}

#editor span[data-color="#800080"] {
    color: #800080 !important;
}

#editor span[data-color="#008080"] {
    color: #008080 !important;
}

#editor span[data-color="#c0c0c0"] {
    color: #c0c0c0 !important;
}

#editor span[data-color="#ffffff"] {
    color: #ffffff !important;
}

/* Fallback for any other colors */
#editor span[style*="color"] {
    display: inline !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    font-family: inherit !important;
    line-height: inherit !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Highlight color styles */
#editor span[data-highlight] {
    display: inline !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    font-family: inherit !important;
    line-height: inherit !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background-color: inherit !important;
}

/* Specific highlight color overrides */
#editor span[data-highlight="#ffff00"] {
    background-color: #ffff00 !important;
}

#editor span[data-highlight="#00ff00"] {
    background-color: #00ff00 !important;
}

#editor span[data-highlight="#00ffff"] {
    background-color: #00ffff !important;
}

#editor span[data-highlight="#ff00ff"] {
    background-color: #ff00ff !important;
}

#editor span[data-highlight="#ffa500"] {
    background-color: #ffa500 !important;
}

#editor span[data-highlight="#ff69b4"] {
    background-color: #ff69b4 !important;
}

#editor span[data-highlight="#98fb98"] {
    background-color: #98fb98 !important;
}

/* Ensure highlight is always visible */
#editor span[data-highlight] {
    background-color: inherit !important;
    color: inherit !important;
    text-decoration: inherit !important;
    font-style: inherit !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    font-family: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    word-spacing: inherit !important;
    text-transform: inherit !important;
    text-shadow: inherit !important;
    box-shadow: none !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

/* Force highlight colors to be visible */
#editor span[data-highlight="#ffff00"] {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

#editor span[data-highlight="#00ff00"] {
    background-color: #00ff00 !important;
    color: #000000 !important;
}

#editor span[data-highlight="#00ffff"] {
    background-color: #00ffff !important;
    color: #000000 !important;
}

#editor span[data-highlight="#ff00ff"] {
    background-color: #ff00ff !important;
    color: #000000 !important;
}

#editor span[data-highlight="#ffa500"] {
    background-color: #ffa500 !important;
    color: #000000 !important;
}

#editor span[data-highlight="#ff69b4"] {
    background-color: #ff69b4 !important;
    color: #000000 !important;
}

#editor span[data-highlight="#98fb98"] {
    background-color: #98fb98 !important;
    color: #000000 !important;
}

/* Preserve formatting when highlight is removed */
#editor span:not([data-highlight]) {
    background-color: transparent !important;
}

/* Ensure text formatting is preserved after highlight removal */
#editor span:not([data-highlight]) b,
#editor span:not([data-highlight]) i,
#editor span:not([data-highlight]) u,
#editor span:not([data-highlight]) strong,
#editor span:not([data-highlight]) em,
#editor span:not([data-highlight]) code,
#editor span:not([data-highlight]) sub,
#editor span:not([data-highlight]) sup {
    background-color: transparent !important;
    color: inherit !important;
}

/* Preserve formatting inside highlighted text */
#editor span[data-highlight] b,
#editor span[data-highlight] i,
#editor span[data-highlight] u,
#editor span[data-highlight] strong,
#editor span[data-highlight] em,
#editor span[data-highlight] code,
#editor span[data-highlight] sub,
#editor span[data-highlight] sup {
    background-color: transparent !important;
    color: inherit !important;
    font-weight: inherit !important;
    font-style: inherit !important;
    text-decoration: inherit !important;
}

/* Ensure proper display of highlighted text with formatting */
#editor span[data-highlight] {
    display: inline !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Preserve line breaks in highlighted text */
#editor span[data-highlight]+br {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure highlighted text maintains proper spacing */
#editor span[data-highlight] {
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
}

/* Handle consecutive highlighted spans */
#editor span[data-highlight]+span[data-highlight] {
    margin-left: 0 !important;
}

/* Ensure proper line spacing for multi-line highlights */
#editor span[data-highlight] {
    line-height: inherit !important;
    vertical-align: baseline !important;
}

/* Preserve spacing around line breaks in highlighted text */
#editor span[data-highlight]+br {
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Handle empty lines in highlighted text */
#editor span[data-highlight]:empty {
    display: none !important;
}

/* Selection styles for better visibility */
#editor ::selection {
    background: var(--accent-primary);
    color: white;
}

#editor ::-moz-selection {
    background: var(--accent-primary);
    color: white;
}

/* Search highlight styles */
.search-highlight {
    background-color: #ffff00 !important;
    color: #000000 !important;
    padding: 1px 2px;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

/* Simple Circular AI Loading Animation */
.ai-loading-simple {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
    min-width: 180px;
}

.ai-loading-spinner-simple {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.ai-loading-text-simple {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Old loading styles (kept for backward compatibility but hidden) */
.ai-loading {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    font-size: 13px;
    color: #64748b;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    animation: aiLoadingFadeIn 0.3s ease;
    width: 300px;
    box-sizing: border-box;
}

.ai-loading-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-loading-content>div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.ai-loading-progress-bar {
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.ai-loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0078d4, #00bcf2);
    border-radius: 2px;
    animation: aiLoadingProgress 2s ease-in-out infinite;
    width: 0%;
}

.ai-loading-elapsed {
    font-size: 11px;
    color: #94a3b8;
    text-align: right;
    margin-top: 4px;
}

@keyframes aiLoadingProgress {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

.ai-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: aiLoadingSpin 1s linear infinite;
    flex-shrink: 0;
}

.ai-loading-text {
    white-space: normal;
    font-weight: 500;
    flex: 1;
    word-break: break-word;
}

@keyframes aiLoadingSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes aiLoadingFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }
}

.ai-loading.hide {
    animation: aiLoadingFadeOut 0.3s ease forwards;
}

@keyframes aiLoadingFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* Auto-detected link styles */
.auto-link {
    color: #0078d4 !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    transition: color 0.2s ease !important;
}

.auto-link:hover {
    color: #106ebe !important;
    text-decoration: underline !important;
}

.auto-link:visited {
    color: #5c2d91 !important;
}

/* Social media link styles */
.social-media-link {
    color: #1da1f2 !important;
    /* Twitter blue color */
    font-weight: 500 !important;
}

.social-media-link:hover {
    color: #0d8bd9 !important;
}

.social-media-link:visited {
    color: #794bc4 !important;
}

#editor:focus {
    outline: none;
}

#editor p {
    margin: 0 0 8px 0;
}

#editor p:last-child {
    margin-bottom: 0;
}

#editor ul,
#editor ol {
    margin: 8px 0;
    padding-left: 20px;
}

#editor ul {
    list-style-type: disc;
}

#editor ul ul {
    list-style-type: circle;
}

#editor ul ul ul {
    list-style-type: square;
}

#editor ol {
    list-style-type: decimal;
}

#editor ol ol {
    list-style-type: lower-alpha;
}

#editor ol ol ol {
    list-style-type: lower-roman;
}

#editor li {
    margin: 4px 0;
    line-height: 1.5;
}

#editor blockquote {
    margin: 8px 0;
    padding: 8px 16px;
    border-left: 4px solid #0078d4;
    background: #f8f9fa;
}

#editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

#editor table td,
#editor table th {
    border: 1px solid var(--border-color, #d1d1d1);
    padding: 8px;
    text-align: left;
    cursor: text !important;
}

#editor table th {
    background: var(--bg-tertiary, #f8f9fa);
    font-weight: bold;
}

/* Todo List Styles */
.todo-list {
    list-style: none;
    padding-left: 20px;
    margin: 12px 0;
    border-left: 2px solid var(--border-color, #e1e1e1);
    background: transparent;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    margin: 8px 0;
    padding: 4px 0;
    cursor: text;
    position: relative;
}

/* Bullet list items */
.bullet-item {
    display: block;
    margin: 8px 0 8px 20px;
    padding: 4px 0;
    cursor: text;
    position: relative;
}

/* Numbered list items */
.numbered-item {
    display: block;
    margin: 8px 0 8px 20px;
    padding: 4px 0;
    cursor: text;
    position: relative;
}

.todo-checkbox {
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid #0078d4;
    border-radius: 2px;
    margin-right: 12px;
    margin-top: 3px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.todo-checkbox:checked {
    background-color: #0078d4;
    border-color: #0078d4;
}

.todo-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 1px;
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.todo-text {
    flex: 1;
    outline: none;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
    color: inherit;
    padding: 2px 4px 2px 8px;
    /* Increased left padding for spacing from checkbox */
    margin: 0;
    min-height: 20px;
    cursor: text;
    word-wrap: break-word;
    white-space: pre-wrap;
    /* Allow text wrapping and proper selection */
    overflow: visible;
    /* Allow selection to work properly */
    text-overflow: unset;
    /* Remove ellipsis to allow full selection */
    user-select: text;
    /* Explicitly allow text selection */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.todo-text:focus {
    background: rgba(0, 120, 212, 0.05);
    border-radius: 2px;
    outline: none;
    white-space: pre-wrap;
    /* Keep consistent wrapping behavior */
    overflow: visible;
}

.todo-text[data-placeholder]:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
}

.todo-checkbox:hover {
    border-color: #005a9e;
    background-color: rgba(0, 120, 212, 0.1);
}

/* Code block styles */
#editor pre {
    background-color: #f8f8f8;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
}

#editor code {
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.4;
}

#editor pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #24292e;
}

#editor code:not(pre code) {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #d73a49;
    border: 1px solid #e1e4e8;
}

/* Code block copy button */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #24292e;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

#editor pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: #444;
}

.code-copy-btn.copied {
    background: #28a745;
}

/* Table resize styles */
.resizable-table {
    position: relative;
    table-layout: fixed;
}

.resizable-table th,
.resizable-table td {
    position: relative;
    overflow: hidden;
    word-wrap: break-word;
}

.column-resizer {
    position: absolute;
    top: 0;
    right: -2px;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
}

.column-resizer:hover {
    background: #0078d4;
    opacity: 0.7;
}

.column-resizer.resizing {
    background: #0078d4;
    opacity: 1;
}

.table-resize-line {
    position: absolute;
    top: 0;
    width: 2px;
    background: #0078d4;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.8;
}

/* Table corner resize handle */
.table-corner-resizer {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    background: #0078d4;
    cursor: nw-resize;
    border-radius: 2px;
    opacity: 0.7;
    z-index: 15;
}

.table-corner-resizer:hover {
    opacity: 1;
    background: #106ebe;
}

.table-corner-resizer::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 3px;
    height: 3px;
    border-top: 1px solid white;
    border-right: 1px solid white;
}

.table-corner-resizer::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 3px;
    height: 3px;
    border-bottom: 1px solid white;
    border-left: 1px solid white;
}

.table-wrapper {
    position: relative;
    display: inline-block;
    margin: 8px 0;
}

.table-wrapper.resizing {
    outline: 2px dashed #0078d4;
    outline-offset: 2px;
}

.tab-container {
    display: flex;
    align-items: end;
    width: 100%;
    gap: 0;
    border: none;
    outline: none;
    padding-left: 0;
    margin-left: 0;
    position: relative;
    z-index: 50;
}

.tab {
    background: #f8f8f8;
    border: 1px solid #e1e1e1;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 0 30px 0 10px;
    margin-right: 2px;
    position: relative;
    z-index: 50;
    cursor: pointer;
    font-size: 13px;
    color: #323130;
    max-width: 200px;
    min-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    height: 26px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.tab:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.tab.active {
    background: white;
    border-bottom: 1px solid white;
    border-color: #d0d0d0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1;
    margin-bottom: -1px;
    z-index: 10;
}

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: white;
    border-top: 1px solid #e1e1e1;
    padding: 4px 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #605e5c;
    z-index: 100;
    pointer-events: auto;
}

.status-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-info {
    font-size: 11px;
    color: #0078d4;
    font-weight: 500;
}

.designer-credit {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.designer-link {
    color: #888;
    text-decoration: none;
    border-bottom: 1px solid #888;
    cursor: pointer;
    transition: color 0.2s ease;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.designer-link:hover {
    color: #0078d4;
    border-bottom-color: #0078d4;
}

.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-secondary, white);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--shadow, rgba(0, 0, 0, 0.2));
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.modal-header {
    background: var(--bg-tertiary, #f8f9fa);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e1e1e1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary, #323130);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary, #605e5c);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: var(--hover-bg, #e1e1e1);
}

.modal-body {
    padding: 24px;
    color: var(--text-primary);
}

/* AI Configuration Warning */
.ai-config-warning {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffeaa7;
    border-radius: 12px;
    margin-bottom: 16px;
}

.ai-config-warning .warning-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.ai-config-warning h4 {
    color: #856404;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ai-config-warning p {
    color: #664d03;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* AI Input Panel - Right Sidebar Design */
.ai-input-panel {
    position: fixed;
    top: 102px;
    /* Position directly below toolbar (title: 32px + tabs: 28px + toolbar: 42px) */
    right: -400px;
    /* Hidden off-screen initially */
    width: 380px;
    height: calc(100vh - 102px - 24px);
    /* Full height minus toolbar and status bar */
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.15), -1px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 120000;
    /* ensure above overlays/sidebars */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-y: auto;
    transition: right 0.3s ease-out;
    display: block;
    backdrop-filter: blur(2px);
}

.ai-input-panel.show {
    right: 0;
    /* Slide in from right */
}

/* Context menu styles already covered above */

/* Context menu AI icon */
.context-ai-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    margin-right: 4px;
}

.ai-input-container {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.ai-input-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-input-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.15s ease;
    line-height: 1;
}

.ai-input-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.ai-input-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

#ai-prompt-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    max-height: 200px;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

#ai-prompt-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

#ai-prompt-input::placeholder {
    color: #9ca3af;
    font-style: normal;
}

.ai-input-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
}

.ai-actions-row {
    display: flex;
    gap: 8px;
}

.ai-select {
    flex: 1;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0 8px;
}

.ai-action-btn.cancel {
    background: #6b7280;
}

.ai-action-btn.cancel:hover:not(:disabled) {
    background: #4b5563;
}

.ai-live-output {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    background: var(--bg-secondary);
}

.ai-live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ai-mini-btn {
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.ai-mini-btn:hover {
    background: #dfe3e6;
}

.ai-live-output pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

.ai-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: #111827;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 400;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 36px;
}

.ai-action-btn:hover:not(:disabled) {
    background: #374151;
}

.ai-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.ai-quick-btn {
    padding: 6px 8px;
    background: #ffffff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ai-quick-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsiveness for sidebar */
@media (max-width: 768px) {
    .ai-input-panel {
        width: 100vw;
        right: -100vw;
    }

    .ai-input-container {
        padding: 16px;
    }

    .ai-quick-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ai-quick-btn {
        font-size: 12px;
        padding: 10px 16px;
        height: 40px;
    }

    .ai-action-btn {
        height: 44px;
        font-size: 15px;
    }
}

.about-content {
    max-width: 500px;
}

.app-info {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e1e1;
}

.app-info h3 {
    font-size: 24px;
    color: #323130;
    margin-bottom: 8px;
    font-weight: 700;
}

.app-info p {
    color: #605e5c;
    margin: 4px 0;
    font-size: 14px;
}

.features-info,
.developer-info {
    margin-bottom: 20px;
}

.features-info h4,
.developer-info h4 {
    font-size: 16px;
    color: #323130;
    margin-bottom: 12px;
    font-weight: 600;
}

.features-info ul {
    list-style: none;
    padding: 0;
}

.features-info li {
    padding: 6px 0;
    color: #605e5c;
    font-size: 14px;
}

.developer-info p {
    color: #605e5c;
    margin: 8px 0;
    font-size: 14px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 16px 0;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8f9fa;
    border: 2px solid #e1e1e1;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.3s ease;
    color: #323130;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-link[href^="mailto:"],
.social-link[onclick*="toggleEmailDisplay"] {
    background: #ea4335;
    border-color: #ea4335;
    color: white;
}

.social-link[href^="mailto:"]:hover,
.social-link[onclick*="toggleEmailDisplay"]:hover {
    background: #d33b2c;
    border-color: #d33b2c;
}

.social-link[href*="github.com"] {
    background: #24292e;
    border-color: #24292e;
    color: white;
}

.social-link[href*="github.com"]:hover {
    background: #1a1e22;
    border-color: #1a1e22;
}

.social-link[href*="x.com"],
.social-link[href*="twitter.com"] {
    background: #1DA1F2;
    border-color: #1DA1F2;
    color: white;
}

.social-link[href*="x.com"]:hover,
.social-link[href*="twitter.com"]:hover {
    background: #0d8bd9;
    border-color: #0d8bd9;
}

.icon-email,
.icon-github,
.icon-twitter {
    display: block;
    line-height: 1;
    font-size: 20px;
    text-align: center;
}

.email-display {
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

.email-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #323130;
    margin: 0 0 8px 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.copy-email-btn {
    background: #0078d4;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.copy-email-btn:hover {
    background: #106ebe;
}

.copy-email-btn:active {
    background: #005a9e;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }

    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
}

/* AI Menu Styles - Mobile Only */
.ai-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow);
    z-index: 3000;
    opacity: 0;
    transition: all 0.2s ease;
    max-width: 420px;
    width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: none;
    /* Hidden by default on desktop */
}

/* Show only on mobile */
@media (max-width: 768px) {
    .ai-menu {
        display: block;
    }

    /* Hide floating AI toolbar on mobile */
    .floating-ai-toolbar {
        display: none !important;
    }
}

/* On desktop, hide ai-menu and show floating toolbar */
@media (min-width: 769px) {
    .ai-menu {
        display: none !important;
    }

    .ai-context-menu {
        display: none !important;
    }
}

.ai-menu.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.ai-menu-content {
    padding: 0;
}

.ai-menu-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.ai-menu-icon {
    font-size: 22px;
}

.ai-menu-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-menu-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-primary);
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.ai-menu-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.ai-menu-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

.ai-menu-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-menu-body h4 {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 16px 0;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-menu-section {
    margin-bottom: 24px;
}

.ai-menu-section:last-child {
    margin-bottom: 0;
}

.ai-menu-item {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
    position: relative;
}

.ai-menu-item:last-child {
    margin-bottom: 0;
}

.ai-menu-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.ai-menu-item:active {
    transform: translateY(0);
    background: var(--accent-primary);
    color: white;
}

.ai-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* AI Selection Overlay */
.ai-selection-overlay {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ai-selection-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.ai-selection-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.ai-selection-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-selection-btn:active {
    transform: scale(0.95);
}

.ai-selection-icon {
    width: 16px !important;
    height: 16px !important;
    filter: brightness(0) invert(1) !important;
    /* Makes it white */
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.copyright-info {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e1e1e1;
    font-size: 12px;
    color: #888;
}

/* Custom AI Dialog Styles */
.selected-text-preview {
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.text-preview {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    color: #495057;
    background: white;
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.ai-request-section {
    margin-bottom: 20px;
}

.quick-prompts {
    margin-top: 16px;
}

.quick-prompt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-prompt-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-prompt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.quick-prompt-btn:active {
    transform: translateY(0);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.button-icon {
    margin-right: 6px;
}

/* AI Custom Dialog */
.ai-custom-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-custom-dialog.show {
    opacity: 1;
}

.ai-dialog-content {
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    background: var(--bg-secondary, white);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 8px 32px var(--shadow, rgba(0, 0, 0, 0.2));
}

.ai-custom-dialog.show .ai-dialog-content {
    transform: scale(1);
}

.ai-dialog-section {
    margin-bottom: 20px;
}

.ai-dialog-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.ai-dialog-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    background: var(--bg-primary);
    color: var(--text-color);
}

.ai-dialog-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-option-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-option-row label {
    min-width: 100px;
    margin-bottom: 0;
    font-size: 14px;
}

.ai-option-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-color);
    font-size: 14px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-icon {
    font-size: 16px;
}

/* Floating AI Toolbar */
.floating-ai-toolbar {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--shadow);
    padding: 8px;
    backdrop-filter: blur(10px);
}

.floating-ai-toolbar.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-toolbar-content {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ai-toolbar-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ai-toolbar-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-1px);
}

.floating-toolbar-content {
    display: flex;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 3px;
    gap: 2px;
}

.floating-ai-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #374151;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 400;
    min-width: 45px;
    justify-content: center;
}

.floating-ai-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.floating-ai-btn:active {
    background: #e5e7eb;
    transform: scale(0.98);
}

.ai-btn-icon {
    font-size: 14px;
    line-height: 1;
}

.ai-btn-text {
    font-size: 11px;
    font-weight: 500;
}

:root {
    --ai-toolbar-bg: rgba(255, 255, 255, 0.95);
    --ai-toolbar-border: rgba(0, 0, 0, 0.1);
    --ai-toolbar-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --ai-btn-color: #323130;
    --ai-btn-hover-bg: rgba(0, 0, 0, 0.05);
    --ai-btn-hover-color: #0078d4;
    --ai-btn-active-bg: rgba(0, 0, 0, 0.08);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {

    /* Ensure overflow button is visible on all mobile widths */
    .mobile-toolbar-overflow {
        display: block !important;
        visibility: visible !important;
    }

    /* Title Bar Mobile */
    .title-bar {
        padding: 8px 12px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .title-bar .app-icon {
        background: none !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .title-bar .app-logo-text {
        display: block !important;
        /* Show text on mobile */
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #0078d4 !important;
        margin-left: 5px !important;
        text-align: left !important;
        flex: 1 !important;
        margin-top: 0px !important;
        visibility: visible !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        max-width: 50% !important;
    }

    .title-bar .app-logo-image {
        height: 40px !important;
        width: auto !important;
        max-width: 150px !important;
        object-fit: contain !important;
        display: block !important;
        margin-left: 5px !important;
    }

    .menu-group {
        display: flex;
        /* Show menu groups on mobile */
        flex-shrink: 0;
    }

    /* Mobile Menu Toggle - Hidden since toolbar menus work */

    .REMOVED-mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        display: none;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .REMOVED-mobile-menu-overlay.show {
        display: flex;
    }

    .REMOVED-mobile-menu {
        background: white;
        width: 280px;
        height: 100%;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    .REMOVED-mobile-menu.show {
        transform: translateX(0);
    }

    .REMOVED-mobile-menu-header {
        padding: 16px;
        background: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .REMOVED-mobile-menu-close {
        background: none;
        border: none;
        font-size: 20px;
        cursor: pointer;
    }

    .REMOVED-mobile-menu-section {
        padding: 12px 0;
        border-bottom: 1px solid #e9ecef;
    }

    .REMOVED-mobile-menu-section h3 {
        font-size: 14px;
        font-weight: 600;
        color: #666;
        padding: 0 16px 8px;
        margin: 0;
    }

    .REMOVED-mobile-menu-item {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        color: #333;
        text-decoration: none;
        font-size: 14px;
        cursor: pointer;
        transition: background 0.2s ease;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    .REMOVED-mobile-menu-item:hover {
        background: #f8f9fa;
    }

    .REMOVED-mobile-menu-item:active {
        background: #e9ecef;
    }

    .REMOVED-mobile-menu-item .icon {
        margin-right: 12px;
        width: 16px;
        text-align: center;
    }

    /* File Tabs Mobile */
    .file-tabs {
        overflow-x: auto;
        padding: 0 8px;
        height: 32px;
    }

    .tab-container {
        min-width: max-content;
    }

    .tab {
        min-width: 100px;
        max-width: 150px;
        height: 28px;
        font-size: 12px;
        padding: 0 28px 0 8px;
        max-width: 150px;
    }

    .tab-filename {
        font-size: 12px;
    }

    /* Toolbar Mobile */
    .toolbar {
        flex-wrap: wrap;
        padding: 8px;
        overflow-x: auto;
    }

    .toolbar-section {
        margin: 2px;
        min-width: max-content;
    }

    .toolbar-button {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 36px;
        height: 36px;
    }

    .toolbar-dropdown {
        font-size: 12px;
        padding: 4px 6px;
        min-width: 80px;
    }

    /* Editor Mobile */
    .editor-container {
        padding: 8px;
    }

    #editor {
        font-size: 14px;
        line-height: 1.5;
        padding: 12px;
    }

    /* Status Bar Mobile */
    .status-bar {
        padding: 6px 12px;
        font-size: 11px;
        height: 28px;
        justify-content: space-between;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .designer-credit {
        display: none;
        /* Hide on mobile to save space */
    }

    /* Add more status info on mobile */
    #status-text {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Modal Mobile Improvements */
    .modal-content {
        max-width: 95vw;
        max-height: 85vh;
        margin: 10px;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-body {
        padding: 16px;
        max-height: calc(85vh - 120px);
    }

    /* Floating AI Toolbar Mobile */
    .floating-ai-toolbar {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 40px);
        max-width: 350px;
    }

    .floating-toolbar-content {
        border-radius: 16px;
        padding: 6px;
    }

    .floating-ai-btn {
        padding: 12px 8px;
        min-width: 50px;
        flex: 1;
        border-radius: 10px;
    }

    .ai-btn-text {
        font-size: 10px;
        font-weight: 500;
    }

    .ai-btn-icon {
        font-size: 16px;
    }

    /* Modal Mobile */
    .modal-content {
        margin: 20px 16px;
        max-height: calc(100vh - 40px);
        width: calc(100% - 32px);
        max-width: none;
    }

    .modal-body {
        padding: 16px;
    }

    /* Context Menu Mobile */
    .context-menu {
        max-width: calc(100vw - 20px);
        font-size: 14px;
    }

    .context-menu-item {
        padding: 12px 16px;
    }

    /* Toast Mobile - REMOVED */
}

/* Show hamburger also on small tablets */
@media (max-width: 1024px) {
    .REMOVED-mobile-menu-toggle {
        display: flex !important;
    }

    .mobile-toolbar-overflow {
        display: block !important;
    }
}

/* Extra Small Mobile (320px and below) */
@media (max-width: 480px) {
    .title-bar {
        padding: 6px 8px;
    }

    .toolbar {
        padding: 4px;
    }

    .toolbar-section {
        margin: 1px;
    }

    .toolbar-button {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 32px;
        height: 32px;
    }

    .floating-toolbar-content {
        padding: 4px;
        border-radius: 20px;
    }

    .floating-ai-btn {
        padding: 8px 6px;
        margin: 0 1px;
    }

    .ai-btn-text {
        display: none;
    }

    .modal-content {
        margin: 10px 8px;
        width: calc(100% - 16px);
    }

    #editor {
        font-size: 13px;
        padding: 8px;
    }
}

.modal {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 24px;
    min-width: 400px;
}

/* Mobile responsive for standard modals */
@media (max-width: 768px) {
    .modal {
        min-width: unset !important;
        max-width: 95vw !important;
        width: calc(100vw - 20px) !important;
        margin: 10px !important;
        padding: 20px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 480px) {
    .modal {
        max-width: 98vw !important;
        width: calc(100vw - 10px) !important;
        margin: 5px !important;
        padding: 16px !important;
        max-height: 95vh !important;
    }

    .modal-buttons {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .modal-button {
        min-width: 100px !important;
        padding: 12px 16px !important;
    }
}

.modal-title {
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 16px;
    color: #323130;
}

.modal-content {
    margin-bottom: 16px;
}

.modal-buttons {
    text-align: right;
    gap: 8px;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-input {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid #d1d1d1;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.modal-textarea {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid #d1d1d1;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.modal-textarea:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.modal-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.modal-label {
    font-size: 13px;
    margin-bottom: 8px;
    color: #323130;
    display: flex;
    align-items: center;
}

.modal-button {
    padding: 8px 16px;
    border: 1px solid transparent;
    background: #f3f2f1;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
    color: #323130;
}

.modal-button.primary {
    background: #0078d4;
    color: white;
}

.modal-button:hover {
    background: #edebe9;
}

.modal-button.primary:hover {
    background: #106ebe;
}

.modal-button:active {
    background: #e1dfdd;
}

.modal-button.primary:active {
    background: #005a9e;
}

.ai-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    position: relative;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.ai-icon::before {
    content: "🤖";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: white;
}

.toolbar-button:hover .ai-icon {
    filter: hue-rotate(270deg) saturate(1.8) brightness(1.2);
    transform: scale(1.1);
    animation: aiGlow 1.5s ease-in-out infinite;
}

.toolbar-button:hover .settings-icon {
    filter: brightness(1.2);
    transform: scale(1.1);
    animation: settingsSpin 0.6s ease-in-out;
}

@keyframes settingsSpin {
    0% {
        transform: scale(1.1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(180deg);
    }

    100% {
        transform: scale(1.1) rotate(360deg);
    }
}

@keyframes aiGlow {

    0%,
    100% {
        filter: hue-rotate(270deg) saturate(1.8) brightness(1.2);
        transform: scale(1.1);
    }

    50% {
        filter: hue-rotate(270deg) saturate(2.0) brightness(1.4);
        transform: scale(1.15);
    }
}

.new-tab-btn {
    width: 28px;
    height: 26px !important;
    min-height: 26px !important;
    background: var(--bg-tertiary, #f8f8f8);
    border: 1px solid var(--border-color, #e1e1e1);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary, #605e5c);
    transition: all 0.2s ease;
    padding: 0;
    margin-bottom: -1px;
}

.new-tab-btn:hover {
    background: var(--hover-bg, #f0f0f0);
    color: var(--text-primary, #323130);
    border-color: var(--border-light, #d0d0d0);
    box-shadow: 0 2px 4px var(--shadow, rgba(0, 0, 0, 0.1));
}

.new-tab-btn:active {
    background: var(--hover-bg, #e8e8e8);
    box-shadow: 0 1px 2px var(--shadow, rgba(0, 0, 0, 0.15));
    transform: translateY(1px);
}

/* Resizable Elements */
.resizable-image {
    position: relative;
    cursor: move;
    display: inline-block;
}

.resizable-image:hover {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
}

.resizable-image.selected {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
}

.resizable-image:hover .resize-handle {
    opacity: 1 !important;
    visibility: visible !important;
}

.resizable-image.selected .resize-handle {
    opacity: 1 !important;
    visibility: visible !important;
}

.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #0078d4;
    border: 1px solid white;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

/* Corner positions for image resize handles */
.resize-handle.tl {
    top: -4px;
    left: -4px;
    cursor: nwse-resize;
}

.resize-handle.tr {
    top: -4px;
    right: -4px;
    cursor: nesw-resize;
}

.resize-handle.bl {
    bottom: -4px;
    left: -4px;
    cursor: nesw-resize;
}

.resize-handle.br {
    bottom: -4px;
    right: -4px;
    cursor: nwse-resize;
}

/* Side positions (optional) */
.resize-handle.t {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.resize-handle.b {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.resize-handle.l {
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.resize-handle.r {
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.resize-handle:hover {
    background: #106ebe !important;
    transform: scale(1.2);
}

.resizable-table {
    cursor: move;
}

.resizable-table:hover {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
}

.resizable-table:hover .table-resize-handle {
    opacity: 1 !important;
    visibility: visible !important;
}

.table-resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #0078d4;
    border: 1px solid white;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.table-resize-handle:hover {
    background: #106ebe !important;
    transform: scale(1.2);
}

.new-tab-btn:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.settings-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    position: relative;
    background: #666;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.settings-icon::before {
    content: "⚙️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: white;
}

/* API Test Styles */
.api-test-section {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
}

.test-button {
    background: #0066cc !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: background 0.2s ease !important;
}

.test-button:hover:not(:disabled) {
    background: #0052a3 !important;
}

.test-button:disabled {
    background: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

#api-test-result {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.test-loading {
    color: #0066cc;
    font-style: italic;
}

.test-success {
    border: 1px solid #28a745;
    background: #d4edda;
    color: #155724;
}

.test-error {
    border: 1px solid #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.test-status {
    font-weight: bold;
    margin-bottom: 8px;
}

.test-details {
    font-size: 12px;
    line-height: 1.5;
}

/* Settings Modal Styles */
.settings-modal .custom-modal-content {
    max-width: 650px !important;
    min-width: 550px;
    max-height: 80vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Mobile Settings Modal */
@media (max-width: 768px) {
    .settings-modal .custom-modal-content {
        max-width: 95vw !important;
        min-width: unset !important;
        width: calc(100vw - 20px) !important;
        max-height: 90vh !important;
        margin: 10px !important;
    }

    .settings-modal .custom-modal-body {
        max-height: calc(90vh - 160px) !important;
    }
}

@media (max-width: 480px) {
    .settings-modal .custom-modal-content {
        max-width: 98vw !important;
        width: calc(100vw - 10px) !important;
        max-height: 95vh !important;
        margin: 5px !important;
    }

    .settings-modal .custom-modal-header {
        padding: 16px 16px 0 16px !important;
    }

    .settings-modal .custom-modal-body {
        padding: 0 16px !important;
        max-height: calc(95vh - 140px) !important;
    }

    .settings-modal .custom-modal-buttons {
        padding: 12px 16px !important;
    }
}

.settings-modal .custom-modal-header {
    padding: 20px 20px 0 20px;
    margin-bottom: 0;
    border-bottom: none;
}

.settings-modal .custom-modal-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    background: var(--hover-bg, #f0f8ff);
    color: var(--accent-primary, #0078d4);
    border-radius: 6px;
}

.settings-modal .custom-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #323130);
}

.settings-modal .custom-modal-body {
    flex: 1;
    padding: 0 20px;
    overflow-y: auto;
    max-height: 55vh;
}

.settings-tabs {
    display: flex;
    margin: 0 0 20px 0;
    border-bottom: 1px solid var(--border-color, #e1e1e1);
    gap: 0;
}

.settings-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #605e5c);
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    position: relative;
    margin-bottom: -1px;
}

.settings-tab:hover {
    background: var(--hover-bg, #f8f9fa);
    color: var(--text-primary, #323130);
}

.settings-tab.active {
    color: #0078d4;
    border-bottom-color: #0078d4;
    font-weight: 600;
}

.settings-content {
    padding: 0;
    display: none;
}

#general-settings {
    display: block;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-primary, #323130);
    border-bottom: 1px solid var(--border-color, #f5f5f5);
}

.settings-label:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-label span {
    margin-right: 12px;
    font-weight: 500;
    flex: 1;
}

.settings-label select,
.settings-label input[type="number"] {
    padding: 6px 10px;
    border: 1px solid #d1d1d1;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    min-width: 120px;
    background: white;
    color: #323130;
    transition: all 0.2s ease;
}

.settings-label select:focus,
.settings-label input[type="number"]:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

.settings-label input[type="checkbox"] {
    margin-left: auto;
    width: 16px;
    height: 16px;
    accent-color: #0078d4;
    cursor: pointer;
}

.settings-label input[type="checkbox"]:checked {
    background-color: #0078d4;
}

/* Custom checkbox container */
.settings-label.checkbox-container {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 12px;
    padding: 12px 0;
    font-size: 13px;
    color: #323130;
    border-bottom: 1px solid #f5f5f5;
}

.settings-label.checkbox-container input[type="checkbox"] {
    margin-left: 0;
    margin-right: 12px;
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: #0078d4;
    cursor: pointer;
    flex-shrink: 0;
}

.setting-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.setting-info span {
    font-weight: 500;
    margin-bottom: 4px;
}

.setting-info small {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.settings-modal .custom-modal-buttons {
    padding: 16px 20px;
    background: var(--bg-tertiary, #f8f9fa);
    border-top: 1px solid var(--border-color, #e1e1e1);
    margin-top: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settings-modal .custom-modal-button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-width: 80px;
    background: var(--bg-tertiary, white);
    border: 1px solid var(--border-color, #d1d1d1);
    color: var(--text-primary, #323130);
}

.settings-modal .custom-modal-button.primary {
    background: var(--accent-primary, #0078d4);
    color: white;
    border: none;
}

.settings-modal .custom-modal-button.primary:hover {
    background: var(--accent-hover, #106ebe);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

/* Icon Button Styles */
.settings-modal .custom-modal-button.icon-button {
    padding: 8px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color, #d1d1d1);
    background: var(--bg-tertiary, white);
    color: var(--text-primary, #323130);
}

.settings-modal .custom-modal-button.icon-button:hover {
    background: var(--hover-bg, #f8f9fa);
    border-color: var(--accent-primary, #0078d4);
    transform: translateY(-1px);
}

.settings-modal .custom-modal-button.icon-button.primary {
    background: var(--accent-primary, #0078d4);
    color: white;
    border-color: var(--accent-primary, #0078d4);
}

.settings-modal .custom-modal-button.icon-button.primary:hover {
    background: var(--accent-hover, #106ebe);
    border-color: var(--accent-hover, #106ebe);
}

.button-icon {
    font-size: 16px;
    line-height: 1;
}

/* Toast Notification System - REMOVED */

/* Custom Modal System */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-modal.show {
    opacity: 1;
}

.custom-modal-content {
    background: var(--bg-secondary, white);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 24px;
    min-width: 400px;
    max-width: 500px;
    transform: scale(0.9);
    transition: transform 0.2s ease;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Help and About modals need larger size */
.help-modal .custom-modal-content,
.about-modal .custom-modal-content {
    max-width: 800px;
    width: 90vw;
    max-height: 85vh;
}

.simple-help .custom-modal-content {
    max-width: 750px;
    width: 85vw;
}

.simple-about .custom-modal-content {
    max-width: 600px;
    width: 80vw;
}

/* Mobile responsive for all custom modals */
@media (max-width: 768px) {
    .custom-modal-content {
        min-width: unset !important;
        max-width: 95vw !important;
        width: calc(100vw - 20px) !important;
        margin: 10px !important;
        padding: 20px !important;
        max-height: 90vh !important;
    }
}

@media (max-width: 480px) {
    .custom-modal-content {
        max-width: 98vw !important;
        width: calc(100vw - 10px) !important;
        margin: 5px !important;
        padding: 16px !important;
        max-height: 95vh !important;
    }

    .custom-modal-header {
        margin-bottom: 12px !important;
    }

    .custom-modal-body {
        margin-bottom: 20px !important;
    }

    .custom-modal-buttons {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .custom-modal-button {
        min-width: 100px !important;
        padding: 12px 16px !important;
    }
}

.custom-modal.show .custom-modal-content {
    transform: scale(1);
}

.custom-modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.custom-modal-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.custom-modal.confirm .custom-modal-icon {
    background: #fff8e1;
    color: #f57c00;
}

.custom-modal.error .custom-modal-icon {
    background: #ffebee;
    color: #d32f2f;
}

.custom-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #323130);
}

.custom-modal-body {
    margin-bottom: 24px;
    color: var(--text-secondary, #666);
    line-height: 1.5;
}

.custom-modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color, #d1d1d1);
    border-radius: 4px;
    font-size: 14px;
    margin-top: 8px;
    background: var(--bg-tertiary, white);
    color: var(--text-primary, #333);
}

.custom-modal-input:focus {
    outline: none;
    border-color: var(--accent-primary, #0078d4);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.custom-modal-input[type="number"] {
    appearance: textfield;
}

.custom-modal-input[type="number"]::-webkit-outer-spin-button,
.custom-modal-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Select-specific styling */
select.custom-modal-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/csvg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
    padding-right: 30px;
}

.custom-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.custom-modal-button {
    padding: 10px 20px;
    border: 1px solid var(--border-color, #d1d1d1);
    background: var(--bg-tertiary, white);
    color: var(--text-primary, #333);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.custom-modal-button:hover {
    background: var(--hover-bg, #f8f8f8);
}

.custom-modal-button.primary {
    background: var(--accent-primary, #0078d4);
    border-color: var(--accent-primary, #0078d4);
    color: white;
}

.custom-modal-button.primary:hover {
    background: var(--accent-hover, #106ebe);
}

.custom-modal-button.danger {
    background: #d32f2f;
    border-color: #d32f2f;
    color: white;
}

.custom-modal-button.danger:hover {
    background: #b71c1c;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: var(--bg-secondary, white);
    border: 1px solid var(--border-color, #e1e1e1);
    border-radius: 6px;
    box-shadow: 0 4px 20px var(--shadow, rgba(0, 0, 0, 0.15));
    padding: 6px 0;
    min-width: 180px;
    z-index: 10000;
    display: none;
    font-family: inherit;
    font-size: 13px;
    max-width: 250px;
    overflow: hidden;
}

.context-menu.show {
    display: block !important;
    visibility: visible !important;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary, #323130);
    transition: background-color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-menu-item:hover {
    background-color: var(--hover-bg, #f3f2f1);
}

.context-menu-item.disabled {
    color: var(--text-muted, #a19f9d);
    cursor: default;
}

.context-menu-item.disabled:hover {
    background-color: transparent;
}

.context-menu-separator {
    height: 1px;
    background-color: var(--border-color, #e1e1e1);
    margin: 4px 0;
}

.context-menu-shortcut {
    margin-left: auto;
    color: var(--text-secondary, #a19f9d);
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Strong mobile override: ensure toggle and layers on top */
@media (max-width: 1024px) {
    .menu-group {
        display: none !important;
    }

    .title-bar {
        z-index: 30000 !important;
    }

    .sidebar-toggle {
        display: inline-flex !important;
        z-index: 50002 !important;
    }

    .sidebar {
        z-index: 50001 !important;
    }

    .sidebar-overlay {
        z-index: 50000 !important;
    }
}

/* Final guard: ensure mobile hides top bars and sidebar sits on top */
@media (max-width: 1024px) {
    body .menu-group {
        display: none !important;
    }

    body .sidebar {
        z-index: 50001 !important;
    }

    body .sidebar-overlay {
        z-index: 50000 !important;
    }
}

/* Compact icons in context menu */
.context-menu-item .material-icon {
    margin-right: 0;
    width: 16px;
    height: 16px;
    font-size: 14px;
}

.settings-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    position: relative;
    background: #666;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.settings-icon::before {
    content: "⚙️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: white;
}

.toolbar-button:hover .settings-icon {
    filter: brightness(1.2);
    transform: scale(1.1);
    animation: settingsSpin 0.6s ease-in-out;
}

:root {
    /* Light Theme Colors */
    --bg-primary: #f3f3f3;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-quaternary: #f8f8f8;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --text-muted: #a19f9d;
    --border-color: #e1e1e1;
    --border-light: #e1dfdd;
    --accent-primary: #0078d4;
    --accent-hover: #106ebe;
    --accent-danger: #d32f2f;
    --accent-danger-hover: #b71c1c;
    --shadow: rgba(0, 0, 0, 0.15);
    --hover-bg: #f3f2f1;
    --active-bg: #e3f2fd;
    --success-bg: #e8f5e8;
    --warning-bg: #fff3cd;
    --error-bg: #f8d7da;
}

/* Apply CSS Variables */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    /* cursor: default !important; */
    /* Removed - duplicate, already set above */
}

/* Basic element styles */
* {
    box-sizing: border-box;
}

.title-bar {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

.menu-bar {
    background: var(--bg-tertiary);
    border-bottom-color: var(--border-color);
}

.file-tabs {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

.tab {
    background: var(--bg-quaternary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-secondary);
    border-bottom-color: var(--bg-secondary);
}

.tab-close {
    color: var(--text-secondary);
}

.tab-close:hover {
    background: var(--border-light);
}

.toolbar {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

.toolbar-button {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.toolbar-button:hover {
    background: var(--hover-bg);
    border-color: var(--accent-primary);
}

.toolbar-button.active {
    background: var(--active-bg);
    border-color: var(--accent-primary);
}

.toolbar-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.toolbar-dropdown:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.color-palette {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 4px 20px var(--shadow);
}

.color-option:hover {
    border-color: var(--accent-primary);
}

#editor {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

#editor:focus {
    outline: none;
}

.status-bar {
    background: var(--bg-tertiary);
    border-top-color: var(--border-color);
    color: var(--text-secondary);
}

/* Menu Styles */
.menu-title {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.menu-title:hover,
.menu-title.active {
    background: var(--hover-bg);
}

.menu-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 4px 20px var(--shadow);
}

.menu-item {
    color: var(--text-primary);
}

.menu-item:hover {
    background: var(--hover-bg);
}

.modal-input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.modal-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.modal-button {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.modal-button:hover {
    background: var(--hover-bg);
}

.modal-button.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.modal-button.primary:hover {
    background: var(--accent-hover);
}

/* Custom Modal Styles */
.custom-modal {
    background: rgba(0, 0, 0, 0.5);
}

.custom-modal-content {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 4px 20px var(--shadow);
}

.custom-modal-header {
    border-bottom-color: var(--border-color);
}

.custom-modal-title {
    color: var(--text-primary);
}

.custom-modal-body {
    color: var(--text-secondary);
}

.custom-modal-input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.custom-modal-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

select.custom-modal-input {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/csvg%3e");
}

.custom-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.custom-modal-button {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.custom-modal-button:hover {
    background: var(--hover-bg);
}

.custom-modal-button.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.custom-modal-button.primary:hover {
    background: var(--accent-hover);
}

.custom-modal-button.danger {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    color: white;
}

.custom-modal-button.danger:hover {
    background: var(--accent-danger-hover);
}

/* ============================================================
   LOCK/UNLOCK DIALOG STYLES
   Clean, professional design matching Settings dialog
   ============================================================ */

/* Lock Dialog Modal */
.lock-dialog-modal .custom-modal-content {
    max-width: 520px !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--bg-primary, white);
}

.lock-dialog-modal .custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 0;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px 12px 0 0;
    position: relative;
}

.lock-dialog-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.lock-dialog-icon {
    width: 40px;
    height: 40px;
    background: var(--hover-bg, #f0f8ff);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent-primary, #0078d4);
    flex-shrink: 0;
}

.lock-dialog-title {
    color: var(--text-primary, #111827);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.lock-dialog-subtitle {
    color: var(--text-secondary, #6b7280);
    font-size: 13px;
    margin-top: 2px;
    font-weight: 400;
}

/* Close Button (X) - Settings Style */
.lock-dialog-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.lock-dialog-close:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #111827);
}

.lock-dialog-close:active {
    transform: scale(0.95);
}

.lock-dialog-modal .custom-modal-body {
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
}

.unlock-dialog-modal .custom-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Password Input Groups */
.lock-password-group {
    position: relative;
    margin-bottom: 16px;
}

.lock-password-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.lock-password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.lock-password-input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.lock-password-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
}

.lock-password-input::placeholder {
    color: var(--text-muted);
}

.lock-password-toggle {
    position: absolute;
    right: 8px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lock-password-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: scale(1.1);
}

.lock-password-toggle:active {
    transform: scale(0.95);
}

.lock-password-strength {
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.lock-password-strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.lock-password-strength-bar.weak {
    width: 33%;
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.lock-password-strength-bar.medium {
    width: 66%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.lock-password-strength-bar.strong {
    width: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
}

/* Security Section */
.lock-security-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1.5px solid #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

/* Dark mode adjustments */
[data-theme="dark"] .lock-security-section {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.15) 0%, rgba(253, 230, 138, 0.1) 100%);
    border-color: rgba(245, 158, 11, 0.4);
}

[data-theme="dark"] .lock-security-title {
    color: #fbbf24;
}

[data-theme="dark"] .lock-security-description {
    color: #fcd34d;
}

[data-theme="dark"] .lock-security-option-title {
    color: #fbbf24;
}

[data-theme="dark"] .lock-security-option-desc {
    color: #fcd34d;
}

.lock-security-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.lock-security-icon {
    font-size: 18px;
}

.lock-security-title {
    font-weight: 700;
    font-size: 14px;
    color: #92400e;
    letter-spacing: -0.01em;
}

.lock-security-description {
    font-size: 12px;
    color: #78350f;
    margin-bottom: 12px;
    line-height: 1.5;
}

.lock-security-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lock-security-option:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(2px);
}

[data-theme="dark"] .lock-security-option {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .lock-security-option:hover {
    background: rgba(255, 255, 255, 0.12);
}

.lock-security-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #f59e0b;
    cursor: pointer;
}

.lock-security-option-label {
    flex: 1;
}

.lock-security-option-title {
    font-weight: 600;
    font-size: 12px;
    color: #78350f;
    margin-bottom: 2px;
}

.lock-security-option-desc {
    font-size: 11px;
    color: #92400e;
    line-height: 1.4;
}

.lock-security-inputs {
    margin-left: 28px;
    margin-top: 10px;
    display: none;
}

.lock-security-inputs.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Info Box */
.lock-info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border-left: 3px solid #3b82f6;
}

.lock-info-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.lock-info-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.lock-info-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Modal Buttons - Settings Style */
.lock-dialog-modal .custom-modal-buttons {
    padding: 16px 20px 20px 20px;
    display: flex;
    gap: 10px;
    background: var(--bg-primary, white);
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.lock-dialog-modal .custom-modal-button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-primary, white);
    color: var(--text-primary, #111827);
}

.lock-dialog-modal .custom-modal-button:hover {
    background: var(--hover-bg, #f3f4f6);
}

.lock-dialog-modal .custom-modal-button.primary {
    background: var(--accent-primary, #0078d4);
    border-color: var(--accent-primary, #0078d4);
    color: white;
}

.lock-dialog-modal .custom-modal-button.primary:hover {
    background: var(--accent-hover, #106ebe);
}

.lock-dialog-modal .custom-modal-button.primary:active {
    transform: scale(0.98);
}

/* Unlock Dialog - Settings Style */
.unlock-dialog-modal .custom-modal-content {
    max-width: 460px !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--bg-primary, white);
}

.unlock-dialog-modal .custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 0;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px 12px 0 0;
    position: relative;
}

.unlock-dialog-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.unlock-dialog-icon {
    width: 40px;
    height: 40px;
    background: var(--hover-bg, #f0f8ff);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent-primary, #0078d4);
    flex-shrink: 0;
}

.unlock-dialog-title {
    color: var(--text-primary, #111827);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.unlock-dialog-subtitle {
    color: var(--text-secondary, #6b7280);
    font-size: 13px;
    margin-top: 2px;
    font-weight: 400;
}

/* Close Button - Settings Style */
.unlock-dialog-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.unlock-dialog-close:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #111827);
}

.unlock-dialog-close:active {
    transform: scale(0.95);
}

.unlock-dialog-modal .custom-modal-body {
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
}

.unlock-forgot-btn {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1.5px solid #f59e0b;
    border-radius: 10px;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.unlock-forgot-btn:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

.unlock-forgot-btn:active {
    transform: translateY(0);
}

[data-theme="dark"] .unlock-forgot-btn {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.2) 0%, rgba(253, 230, 138, 0.15) 100%);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

[data-theme="dark"] .unlock-forgot-btn:hover {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.25) 0%, rgba(253, 230, 138, 0.2) 100%);
}

.unlock-dialog-modal .custom-modal-buttons {
    padding: 16px 20px 20px 20px;
    display: flex;
    gap: 10px;
    background: var(--bg-primary, white);
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.unlock-dialog-modal .custom-modal-button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-primary, white);
    color: var(--text-primary, #111827);
}

.unlock-dialog-modal .custom-modal-button:hover {
    background: var(--hover-bg, #f3f4f6);
}

.unlock-dialog-modal .custom-modal-button.primary {
    background: var(--accent-primary, #0078d4);
    border-color: var(--accent-primary, #0078d4);
    color: white;
}

.unlock-dialog-modal .custom-modal-button.primary:hover {
    background: var(--accent-hover, #106ebe);
}

.unlock-dialog-modal .custom-modal-button.primary:active {
    transform: scale(0.98);
}

/* Mobile Responsive Styles for Lock/Unlock Dialogs */
@media (max-width: 768px) {
    .lock-dialog-modal .custom-modal-content,
    .unlock-dialog-modal .custom-modal-content {
        max-width: 95% !important;
        margin: 0 auto;
        border-radius: 12px;
    }

    .lock-dialog-modal .custom-modal-header,
    .unlock-dialog-modal .custom-modal-header {
        padding: 16px;
    }

    .lock-dialog-header-content,
    .unlock-dialog-header-content {
        gap: 10px;
    }

    .lock-dialog-icon,
    .unlock-dialog-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 8px;
    }

    .lock-dialog-title,
    .unlock-dialog-title {
        font-size: 16px;
    }

    .lock-dialog-subtitle,
    .unlock-dialog-subtitle {
        font-size: 12px;
    }

    .lock-dialog-modal .custom-modal-body,
    .unlock-dialog-modal .custom-modal-body {
        padding: 16px;
    }

    .lock-password-input {
        padding: 12px 44px 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .lock-password-toggle {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .lock-security-section {
        padding: 12px;
        margin-bottom: 12px;
    }

    .lock-security-option {
        padding: 10px;
        margin-bottom: 10px;
    }

    .lock-info-box {
        padding: 10px;
    }

    .lock-dialog-modal .custom-modal-buttons,
    .unlock-dialog-modal .custom-modal-buttons {
        padding: 12px 16px;
        flex-direction: column;
    }

    .lock-dialog-modal .custom-modal-button,
    .unlock-dialog-modal .custom-modal-button {
        width: 100%;
        padding: 12px 20px;
    }

    .unlock-forgot-btn {
        padding: 14px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .lock-dialog-modal .custom-modal-content,
    .unlock-dialog-modal .custom-modal-content {
        max-width: 100% !important;
        border-radius: 10px;
        margin: 0 8px;
    }

    .lock-dialog-modal .custom-modal-header,
    .unlock-dialog-modal .custom-modal-header {
        padding: 14px;
    }

    .lock-dialog-header-content,
    .unlock-dialog-header-content {
        gap: 8px;
    }

    .lock-dialog-title,
    .unlock-dialog-title {
        font-size: 15px;
    }

    .lock-password-label {
        font-size: 12px;
    }

    .lock-security-title {
        font-size: 13px;
    }

    .lock-security-description {
        font-size: 11px;
    }
}

/* Recovery Code Dialog */
.recovery-dialog-modal .custom-modal-content {
    max-width: 480px !important;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--border-color);
}

.recovery-dialog-modal .custom-modal-header {
    padding: 0;
    margin-bottom: 0;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 16px 16px 0 0;
}

.recovery-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 24px 20px 24px;
}

.recovery-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.recovery-title {
    color: white;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.recovery-dialog-modal .custom-modal-body {
    padding: 24px;
}

.recovery-code-display {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.recovery-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.recovery-warning-icon {
    font-size: 20px;
}

.recovery-warning-text {
    font-weight: 700;
    font-size: 15px;
    color: #92400e;
}

.recovery-code-box {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.recovery-code-text {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Consolas', monospace;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #1f2937;
    user-select: all;
    word-break: break-all;
}

.recopy-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.recopy-btn:hover {
    background: var(--hover-bg);
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: translateY(-1px);
}

.recovery-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.recovery-description strong {
    color: var(--text-primary);
    font-weight: 600;
}

.recovery-dialog-modal .custom-modal-buttons {
    padding: 0 24px 24px 24px;
}

.recovery-dialog-modal .custom-modal-button.primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.recovery-dialog-modal .custom-modal-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* Password Recovery Dialog */
.recovery-options-dialog .custom-modal-content {
    max-width: 500px !important;
    border-radius: 16px;
}

.recovery-options-dialog .custom-modal-header {
    padding: 0;
    margin-bottom: 0;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 16px 16px 0 0;
}

.recovery-options-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 24px 20px 24px;
}

.recovery-options-title {
    color: white;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.recovery-options-body {
    padding: 24px;
}

.recovery-option-card {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
}

.recovery-option-card.security-question {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #3b82f6;
}

.recovery-option-card.security-question:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.recovery-option-card.recovery-code {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-color: #8b5cf6;
}

.recovery-option-card.recovery-code:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.recovery-option-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.recovery-option-icon {
    font-size: 24px;
}

.recovery-option-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.recovery-option-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.recovery-option-button {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recovery-option-button:hover {
    background: var(--hover-bg);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .lock-dialog-modal .custom-modal-content,
    .unlock-dialog-modal .custom-modal-content,
    .recovery-dialog-modal .custom-modal-content,
    .recovery-options-dialog .custom-modal-content {
        max-width: calc(100vw - 20px) !important;
        border-radius: 16px;
    }

    .lock-dialog-header-content,
    .unlock-dialog-header-content,
    .recovery-header-content,
    .recovery-options-header-content {
        padding: 20px;
    }

    .lock-dialog-icon,
    .unlock-dialog-icon,
    .recovery-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .lock-dialog-title,
    .unlock-dialog-title,
    .recovery-title,
    .recovery-options-title {
        font-size: 18px;
    }

    .lock-dialog-modal .custom-modal-body,
    .unlock-dialog-modal .custom-modal-body,
    .recovery-dialog-modal .custom-modal-body,
    .recovery-options-body {
        padding: 20px;
    }

    .lock-dialog-modal .custom-modal-buttons,
    .unlock-dialog-modal .custom-modal-buttons,
    .recovery-dialog-modal .custom-modal-buttons {
        padding: 12px 20px 20px 20px;
    }

    .lock-dialog-modal .custom-modal-button,
    .unlock-dialog-modal .custom-modal-button,
    .recovery-dialog-modal .custom-modal-button {
        flex: 1;
        padding: 12px 16px;
    }

    .recovery-code-text {
        font-size: 18px;
        letter-spacing: 2px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .lock-security-section {
        background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
        border-color: #f59e0b;
    }

    .lock-security-option {
        background: rgba(0, 0, 0, 0.2);
    }

    .lock-security-option:hover {
        background: rgba(0, 0, 0, 0.3);
    }

    .lock-security-option-title,
    .lock-security-option-desc {
        color: #fef3c7;
    }

    .recovery-option-card.security-question {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
    }

    .recovery-option-card.recovery-code {
        background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
    }

    .recovery-option-button {
        background: rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .recovery-option-button:hover {
        background: rgba(0, 0, 0, 0.4);
    }
}

/* Settings Modal Styles */
.settings-tabs {
    border-bottom-color: var(--border-color);
}

.settings-tab {
    color: var(--text-secondary);
}

.settings-tab:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.settings-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.settings-label {
    color: var(--text-primary);
}

.settings-label select,
.settings-label input[type="number"] {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.settings-label select:focus,
.settings-label input[type="number"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

/* Context Menu Styles */
.context-menu {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 4px 20px var(--shadow);
}

.context-menu-item {
    color: var(--text-primary);
}

.context-menu-item:hover {
    background: var(--hover-bg);
}

.context-menu-item.disabled {
    color: var(--text-muted);
}

.context-menu-separator {
    background: var(--border-color);
}

.context-menu-shortcut {
    color: var(--text-muted);
}

/* Toast Styles */
/* Toast styles - REMOVED */

/* Security Notice Styling */
.security-notice {
    background: var(--security-notice-bg, rgba(255, 235, 59, 0.1));
    border: 1px solid var(--security-notice-border, #ffc107);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.security-notice h4 {
    color: var(--security-notice-title, #f57c00);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.security-notice h4::before {
    content: "🔒";
    margin-right: 8px;
}

.security-notice ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.security-notice li {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.security-notice li::before {
    content: "•";
    color: var(--security-notice-bullet, #4caf50);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.security-notice li:last-child {
    margin-bottom: 0;
}

/* Selection Styles */

/* Focus Styles */

/* AI Loading Overlay */
.ai-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.loading-content {
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    font-size: 48px;
    animation: aiSpinning 2s ease-in-out infinite;
    margin-bottom: 12px;
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: #0078d4;
    margin-bottom: 8px;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.loading-dots span {
    font-size: 24px;
    color: #0078d4;
    animation: loadingDots 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.loading-spinner.button-icon {
    animation: buttonSpinning 1s linear infinite;
    font-size: 16px;
}

@keyframes aiSpinning {
    0% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(90deg) scale(1.1);
    }

    50% {
        transform: rotate(180deg) scale(1);
    }

    75% {
        transform: rotate(270deg) scale(1.1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes buttonSpinning {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes loadingDots {

    0%,
    60%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Animation for theme switching */
body,
.title-bar,
.menu-bar,
.file-tabs,
.tab,
.toolbar,
#editor,
.status-bar,
.menu-title,
.menu-dropdown,
.modal,
.custom-modal-content,
.context-menu {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Heading Dialog Styles */
.heading-dialog .custom-modal-content {
    max-width: 700px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
}

.heading-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.heading-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 60px;
    font-size: 12px;
}

.heading-option:hover {
    border-color: #0078d4;
    background: #f3f9ff;
    transform: translateY(-1px);
}

.heading-option:active {
    transform: translateY(0px);
}

.heading-preview {
    font-weight: bold;
    margin-bottom: 2px;
    display: block;
    line-height: 1.2;
}

.heading-description {
    font-size: 10px;
    color: #666;
    font-weight: normal;
    line-height: 1.2;
}

/* Heading Preview Styles */
.h1-preview {
    font-size: 16px;
    color: #1a1a1a;
}

.h2-preview {
    font-size: 15px;
    color: #2a2a2a;
}

.h3-preview {
    font-size: 14px;
    color: #3a3a3a;
}

.h4-preview {
    font-size: 13px;
    color: #4a4a4a;
}

.h5-preview {
    font-size: 12px;
    color: #5a5a5a;
}

.h6-preview {
    font-size: 11px;
    color: #6a6a6a;
}

.p-preview {
    font-size: 12px;
    color: #666;
    font-weight: normal !important;
}

/* Text case preview styles */
.uppercase-preview {
    text-transform: uppercase;
    color: #d32f2f;
    font-weight: bold;
    font-size: 11px;
}

.lowercase-preview {
    text-transform: lowercase;
    color: #1976d2;
    font-weight: bold;
    font-size: 11px;
}

.capitalize-preview {
    text-transform: capitalize;
    color: #388e3c;
    font-weight: bold;
    font-size: 11px;
}

.sentence-preview {
    color: #f57c00;
    font-weight: bold;
    font-size: 11px;
}

.toggle-preview {
    color: #7b1fa2;
    font-weight: bold;
    font-size: 11px;
}

/* Heading separator */
.heading-separator {
    font-size: 11px;
    font-weight: bold;
    color: #666;
    margin: 12px 0 6px 0;
    padding: 4px 0;
    border-top: 1px solid #e1e1e1;
    text-align: center;
    grid-column: 1 / -1;
}

/* Responsive adjustments for small screens */
@media (max-width: 600px) {
    .heading-dialog .custom-modal-content {
        max-width: 95%;
        width: 95%;
    }

    .heading-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .heading-option {
        min-height: 50px;
        padding: 6px 4px;
        font-size: 11px;
    }

    .heading-preview {
        font-size: inherit;
    }

    .heading-description {
        font-size: 9px;
    }
}

@media (max-width: 400px) {
    .heading-options {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .heading-option {
        min-height: 45px;
        padding: 4px;
        font-size: 10px;
    }
}

/* Text Case Dialog Styles */
.text-case-dialog .custom-modal-content {
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.text-case-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.text-case-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 70px;
    font-size: 12px;
}

.text-case-option:hover {
    border-color: #0078d4;
    background: #f3f9ff;
    transform: translateY(-1px);
}

.text-case-option:active {
    transform: translateY(0px);
}

.case-preview {
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
    line-height: 1.2;
    font-size: 14px;
}

.case-description {
    font-size: 10px;
    color: #666;
    font-weight: normal;
    line-height: 1.2;
}

/* Responsive adjustments for text case dialog */
@media (max-width: 500px) {
    .text-case-dialog .custom-modal-content {
        max-width: 95%;
        width: 95%;
    }

    .text-case-options {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .text-case-option {
        min-height: 60px;
        padding: 8px;
        font-size: 11px;
    }

    .case-preview {
        font-size: 13px;
    }

    .case-description {
        font-size: 9px;
    }
}

/* Additional mobile responsive rules for app logo */

/* Extra small mobile devices (small phones) */
@media (max-width: 480px) {
    body {
        overflow: auto !important;
        height: auto !important;
        min-height: 100vh !important;
    }

    .title-bar .app-icon {
        background: none !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .title-bar {
        padding: 6px 8px;
    }

    .title-bar .app-logo-text {
        display: block !important;
        margin-left: 10px !important;
        font-size: 14px !important;
        font-weight: bold !important;
        color: var(--text-color) !important;
        overflow: visible !important;
        white-space: nowrap !important;
        max-width: none !important;
    }
}

/* Large mobile devices (tablets in portrait) */
@media (min-width: 481px) and (max-width: 768px) {
    .title-bar .app-icon {
        width: 32px;
        height: 32px;
        margin-right: 10px;
    }
}

/* ============================================================================
   CHATGPT-STYLE MODERN SETTINGS MODAL
   ============================================================================ */

/* Modal Background */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-modal.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.settings-modal-content {
    background: var(--bg-secondary, #ffffff);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    box-shadow:
        0 4px 6px -1px var(--shadow, rgba(0, 0, 0, 0.1)),
        0 2px 4px -1px var(--shadow, rgba(0, 0, 0, 0.06));
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.settings-modal.show .settings-modal-content {
    transform: scale(1) translateY(0);
}

/* Header */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-tertiary, #ffffff);
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #111827);
}

.settings-close {
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    padding: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #374151);
}

/* Layout */
.settings-layout {
    display: flex;
    height: calc(80vh - 140px);
    min-height: 300px;
    max-height: 450px;
}

/* Sidebar */
.settings-sidebar {
    width: 200px;
    background: var(--bg-tertiary, #fafafa);
    border-right: 1px solid var(--border-color, #e5e7eb);
    overflow-y: auto;
}

.settings-nav {
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #374151);
}

.nav-item.active {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #111827);
    border-left-color: var(--text-secondary, #6b7280);
    font-weight: 500;
}

.nav-icon {
    font-size: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content */
.settings-main {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary, white);
}

.settings-content-wrapper {
    padding: 20px;
}

.settings-content {
    display: none;
}

.settings-content.active {
    display: block;
}

/* Section Styling */
.settings-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Setting Cards */
.setting-card {
    background: var(--bg-tertiary, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-card:hover {
    border-color: var(--border-light, #d1d5db);
}

.setting-header {
    flex: 1;
}

.setting-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    margin-bottom: 2px;
    display: block;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    line-height: 1.3;
}

/* Form Controls */
.setting-select,
.setting-input {
    padding: 6px 8px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 4px;
    font-size: 13px;
    background: var(--bg-tertiary, white);
    color: var(--text-primary, #374151);
    transition: all 0.15s ease;
    min-width: 120px;
}

.setting-select:focus,
.setting-input:focus {
    outline: none;
    border-color: var(--border-light, #9ca3af);
    box-shadow: 0 0 0 1px rgba(156, 163, 175, 0.3);
}

/* Toggle Switch */
.setting-toggle {
    position: relative;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    display: inline-block;
    width: 36px;
    height: 20px;
    background: var(--border-light, #d1d5db);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-label:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-secondary, white);
    top: 2px;
    left: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.toggle-input:checked+.toggle-label {
    background: var(--accent-primary, #6b7280);
}

.toggle-input:checked+.toggle-label:before {
    transform: translateX(16px);
}

/* Footer */
.settings-footer {
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-tertiary, #fafafa);
    padding: 12px 20px;
}

.settings-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.action-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.primary-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Action Buttons */
.action-button {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 4px;
    background: var(--bg-tertiary, white);
    color: var(--text-primary, #374151);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.action-button:hover {
    background: var(--hover-bg, #f9fafb);
    border-color: var(--border-light, #9ca3af);
}

.action-button.secondary {
    color: var(--text-secondary, #6b7280);
    font-size: 12px;
}

.action-button.cancel {
    color: #dc2626;
    border-color: var(--border-color, #d1d5db);
}

.action-button.cancel:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

.action-button.primary {
    background: var(--accent-primary, #111827);
    border-color: var(--accent-primary, #111827);
    color: white;
}

.action-button.primary:hover {
    background: var(--accent-hover, #374151);
    border-color: var(--accent-hover, #374151);
}

.action-icon {
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        height: 90vh;
        max-height: 90vh;
    }

    .settings-layout {
        flex-direction: column;
        height: auto;
        max-height: none;
        flex: 1;
    }

    .settings-sidebar {
        width: 100%;
        max-height: 60px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .settings-nav {
        display: flex;
        overflow-x: auto;
        padding: 8px 12px;
        gap: 4px;
    }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 6px 12px;
        font-size: 12px;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: #6b7280;
    }

    .settings-content-wrapper {
        padding: 12px;
        /* Leave extra space for header + tabs + footer on small screens */
        height: calc(90vh - 190px);
        overflow-y: auto;
    }

    .setting-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 8px 12px;
    }

    .settings-actions {
        flex-direction: column;
        gap: 8px;
        padding: 8px 12px;
    }

    .action-group,
    .primary-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .action-button {
        font-size: 11px;
        padding: 4px 6px;
    }

    .action-button.secondary {
        font-size: 10px;
    }
}

/* ============================================================================
   AI ASSISTANT MODAL - MINIMAL STYLE (SIMILAR TO SETTINGS)
   ============================================================================ */

/* AI Modal Background */
.ai-assistant-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.1s ease;
}

.ai-assistant-modal.show {
    opacity: 1;
    visibility: visible;
}

/* AI Modal Container */
.ai-modal-content {
    background: var(--bg-secondary, #ffffff);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    box-shadow:
        0 4px 6px -1px var(--shadow, rgba(0, 0, 0, 0.1)),
        0 2px 4px -1px var(--shadow, rgba(0, 0, 0, 0.06));
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: all 0.1s ease;
}

.ai-assistant-modal.show .ai-modal-content {
    transform: scale(1) translateY(0);
}

/* AI Header */
.ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-tertiary, #ffffff);
}

.ai-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #111827);
}

.ai-close {
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    padding: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-close:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #374151);
}

/* AI Content */
.ai-content {
    padding: 20px;
    max-height: calc(70vh - 120px);
    overflow-y: auto;
    color: var(--text-primary);
}

/* AI Sections */
.ai-section {
    margin-bottom: 24px;
}

.ai-section:last-child {
    margin-bottom: 0;
}

.ai-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin-bottom: 12px;
}

/* AI Actions Grid */
.ai-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

/* AI Action Buttons */
.ai-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    background: var(--bg-tertiary, white);
    color: var(--text-primary, #374151);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    min-height: 44px;
}

.ai-action-btn:hover {
    background: var(--hover-bg, #f9fafb);
    border-color: var(--border-light, #d1d5db);
    color: var(--text-primary, #111827);
}

.ai-action-btn:active {
    background: var(--hover-bg, #f3f4f6);
    transform: scale(0.98);
}

/* Mobile Responsive for AI Modal */
@media (max-width: 768px) {
    .ai-modal-content {
        width: 95%;
        max-height: 80vh;
    }

    .ai-content {
        padding: 16px;
        max-height: calc(80vh - 100px);
    }

    .ai-actions {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .ai-action-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px;
    }

    .ai-section {
        margin-bottom: 20px;
    }

    .ai-section-title {
        font-size: 13px;
        margin-bottom: 10px;
    }
}

/* Onboarding Styles */

/* Help Modal Styles */
.help-modal .custom-modal-content {
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
}

.help-modal .custom-modal-body {
    max-height: none;
    overflow-y: visible;
    padding: 20px;
}

.help-content {
    padding: 0;
}

/* Simple Help Page Styles */
.simple-help .custom-modal-content {
    max-width: 700px;
    max-height: 80vh;
}

.help-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 15px;
    color: var(--text-color);
    line-height: 1.5;
    max-height: 70vh;
    overflow-y: auto;
}

.help-page .help-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.help-page .help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.help-page h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
}

.help-page p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 8px;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-key {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--hover-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.shortcut-desc {
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.8;
}

/* Help page feature lists */
.help-page .feature-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.help-page .feature-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
}

.help-page .feature-list li:last-child {
    border-bottom: none;
}

.help-page .feature-list li strong {
    color: var(--primary-color);
    font-weight: 600;
}

.help-page .getting-started-list {
    list-style: decimal;
    padding-left: 20px;
    margin: 12px 0;
}

.help-page .getting-started-list li {
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
}

.help-page h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-page h3:first-child {
    margin-top: 0;
}

/* About Page Styles */
.about-page {
    max-width: 520px;
    margin: 0 auto;
    padding: 12px;
    line-height: 1.5;
    color: var(--text-color);
    max-height: 75vh;
    overflow-y: auto;
}

.about-page .app-info,
.about-page .features-info,
.about-page .privacy-info,
.about-page .developer-info {
    margin-bottom: 16px;
    padding: 14px;
    background: var(--toolbar-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.about-page h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.about-page h4 {
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 4px;
}

.about-page ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-page ul li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.about-page ul li:last-child {
    border-bottom: none;
}

.about-page .emoji {
    font-size: 1.2em;
    min-width: 24px;
    display: inline-block;
    text-align: center;
}

.about-page p {
    margin: 6px 0;
    color: var(--text-color);
    font-size: 0.9em;
}

.about-page .privacy-info p {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 3px;
    padding: 6px;
    margin-top: 8px;
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .about-page {
        padding: 8px;
    }

    .about-page .app-info,
    .about-page .features-info,
    .about-page .privacy-info,
    .about-page .developer-info {
        padding: 10px;
        margin-bottom: 10px;
    }
}

/* Top Banner Alert System */
.top-banner-alert {
    background: transparent;
    border: none;
    box-shadow: none;
    z-index: 30001;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    transform: translateY(-100%);
    transition: all 0.3s ease-out;
}

.top-banner-alert.show {
    transform: translateY(0);
    background: #f3f3f3;
    border: none;
    box-shadow: none;
}

.top-banner-alert-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 12px;
    min-height: 48px;
    max-width: 100%;
    flex-wrap: nowrap;
}

.top-banner-alert-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(var(--primary-color-rgb, 102, 126, 234), 0.15);
}

.top-banner-alert-icon-content {
    font-size: 16px;
    line-height: 1;
}

.top-banner-alert-message {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    overflow: hidden;
    min-width: 0;
    flex-wrap: nowrap;
}

.top-banner-alert-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-color);
    line-height: 1.4;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-banner-alert-text {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.85;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.top-banner-alert-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.top-banner-alert-action-btn {
    background: transparent;
    color: var(--text-color);
    border: none;
    padding: 4px;
    border-radius: 4px;
    font-size: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 28px;
    width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.top-banner-alert-action-btn::before {
    content: "⚙️";
    font-size: 16px;
    display: block;
}

.top-banner-alert-action-btn:hover {
    background: var(--hover-color);
    opacity: 1;
    transform: translateY(-1px);
}

.top-banner-alert-close-btn {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.6;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.top-banner-alert-close-btn:hover {
    opacity: 1;
    background: var(--hover-color);
}

/* Top Banner Alert Types */
.top-banner-alert.warning {
    background: var(--bg-color);
    border: none;
}

.top-banner-alert.warning .top-banner-alert-icon {
    background: rgba(255, 193, 7, 0.2);
    color: #f57c00;
}

.top-banner-alert.error {
    background: var(--bg-color);
    border: none;
}

.top-banner-alert.error .top-banner-alert-icon {
    background: rgba(244, 67, 54, 0.2);
    color: #d32f2f;
}

.top-banner-alert.success {
    background: var(--bg-color);
    border: none;
}

.top-banner-alert.success .top-banner-alert-icon {
    background: rgba(76, 175, 80, 0.2);
    color: #388e3c;
}

.top-banner-alert.info {
    background: var(--bg-color);
    border: none;
}

.top-banner-alert.info .top-banner-alert-icon {
    background: rgba(33, 150, 243, 0.2);
    color: #1976d2;
}

/* Notification animations */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

/* Mobile top banner alert styles */
@media (max-width: 768px) {
    .top-banner-alert-content {
        padding: 8px 12px;
        gap: 8px;
        min-height: 44px;
        max-width: 100%;
        flex-wrap: nowrap;
    }

    .top-banner-alert-icon {
        width: 28px;
        height: 28px;
    }

    .top-banner-alert-icon-content {
        font-size: 14px;
    }

    .top-banner-alert-message {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .top-banner-alert-title {
        font-size: 12px;
    }

    .top-banner-alert-text {
        font-size: 12px;
    }

    .top-banner-alert-action-btn {
        height: 24px;
        width: 24px;
        padding: 3px;
    }

    .top-banner-alert-action-btn::before {
        font-size: 14px;
    }

    .top-banner-alert-close-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .top-banner-alert-actions {
        gap: 6px;
    }
}

/* Help Topic Dialog (onboarding-like style) */
.help-topic-modal .custom-modal-content {
    max-width: 500px;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.help-topic-dialog {
    text-align: center;
    padding: 40px 32px 32px;
}

.help-topic-icon {
    font-size: 64px;
    margin-bottom: 24px;
    line-height: 1;
}

.help-topic-dialog h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

.help-topic-content {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 32px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.help-topic-content ul {
    list-style: none;
    padding: 0;
    text-align: left;
}

.help-topic-content li {
    font-size: 14px;
    line-height: 1.6;
    padding: 8px 0;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-topic-content li:last-child {
    border-bottom: none;
}

.help-topic-content strong {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--hover-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-color);
    margin-right: auto;
}

.help-progress {
    margin-bottom: 32px;
}

.help-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.help-buttons button {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    margin: 4px;
}

.help-buttons .btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.help-buttons .btn-secondary:hover {
    background: var(--hover-color);
}

.help-buttons .btn-primary {
    background: var(--primary-color);
    color: white;
}

.help-buttons .btn-primary:hover {
    background: var(--primary-hover-color);
    transform: translateY(-1px);
}

.help-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.help-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 12px;
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    font-size: 14px;
    line-height: 1.6;
    padding: 8px 0;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-section li:last-child {
    border-bottom: none;
}

.help-section strong {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--hover-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-color);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
}

.btn-link:hover {
    text-decoration: none;
}

/* Mobile adjustments */

.help-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
}

.help-section li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* Help topic mobile adjustments */
.help-topic-dialog {
    padding: 24px 20px 20px;
}

.help-topic-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.help-topic-dialog h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.help-topic-content {
    font-size: 14px;
    margin-bottom: 24px;
}

.help-progress {
    margin-bottom: 24px;
}

.help-buttons {
    flex-direction: column;
    gap: 8px;
}

.help-buttons button {
    width: 100%;
    padding: 12px 20px;
    margin: 0;
}

/* Simple help mobile adjustments */
.shortcut-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.shortcut-key {
    margin-bottom: 4px;
}

.REMOVED-floating-menu-button {
    position: fixed;
    right: 12px;
    bottom: 16px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid #d0d7de;
    background: #ffffff;
    color: #24292f;
    font-size: 20px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 29999;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.REMOVED-floating-menu-button:active {
    transform: translateY(1px);
}

@media (max-width: 1024px) {
    .REMOVED-floating-menu-button {
        display: none !important;
    }
}

/* MOBILE MENU DROPDOWN SCROLL */
@media (max-width: 768px) {

    /* Fix Tools menu overflow on mobile */
    #tools-menu {
        max-height: 60vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* General menu dropdown improvements for mobile */
    .menu-dropdown {
        max-height: calc(100vh - 120px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 100000 !important;
        /* Consistent with title bar dropdowns */
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        min-width: auto !important;
        background: var(--bg-primary, white) !important;
        border: 1px solid var(--border-color, #e1e1e1) !important;
        border-radius: 4px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    }

    .menu-dropdown.show {
        display: block !important;
        visibility: visible !important;
    }

    /* Fix menu icons display */
    .menu-item svg {
        display: inline-block !important;
        vertical-align: middle !important;
        margin-right: 8px !important;
        flex-shrink: 0 !important;
        width: 14px !important;
        height: 14px !important;
        fill: currentColor !important;
        color: #323130 !important;
    }

    .menu-item .material-icon {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 14px !important;
        width: 16px !important;
        height: 16px !important;
        margin-right: 8px !important;
        vertical-align: middle !important;
        flex-shrink: 0 !important;
        font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols", sans-serif !important;
        font-style: normal !important;
        text-decoration: none !important;
        line-height: 1 !important;
        text-align: center !important;
    }

    .menu-item .ai-icon,
    .menu-item .settings-icon {
        display: inline-block !important;
        vertical-align: middle !important;
        margin-right: 8px !important;
        flex-shrink: 0 !important;
    }

    /* Touch-friendly menu items on mobile */
    .menu-item {
        padding: 16px 20px !important;
        /* Even larger touch target */
        min-height: 56px !important;
        /* Increased from 44px for easier tapping */
        display: flex !important;
        align-items: center !important;
        font-size: 16px !important;
        /* Better readability on mobile */
        line-height: 1.3 !important;
        -webkit-tap-highlight-color: rgba(79, 70, 229, 0.2) !important;
        /* Better touch feedback */
        transition: background-color 0.2s ease !important;
        border-radius: 8px !important;
        margin: 2px 8px !important;
        /* Prevent text selection on touch */
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        /* Improve touch response */
        touch-action: manipulation !important;
        position: relative !important;
    }

    .menu-item:active {
        background-color: rgba(79, 70, 229, 0.1) !important;
        transform: scale(0.98) !important;
    }

    .menu-item:hover,
    .menu-item:active {
        background-color: var(--accent-light, #f0f0f0) !important;
        transition: none !important;
        /* Remove transition on active for immediate feedback */
    }

    /* Menu title touch improvements */
    .menu-title {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        padding: 8px 12px !important;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1) !important;
    }

    .menu-separator {
        margin: 4px 0 !important;
        border-top: 1px solid var(--border-color, #e1e1e1) !important;
        height: 1px !important;
    }
}

/* FORCE TOOLBAR VISIBILITY ON MOBILE - CRITICAL OVERRIDE */
@media (max-width: 768px) {

    /* Fix toolbar width and scrolling */
    .toolbar {
        width: 100% !important;
        min-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
        padding: 0 8px !important;
        gap: 4px !important;
        display: flex !important;
        align-items: center !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
    }

    /* Force all toolbar sections to be visible with maximum specificity */
    .toolbar .toolbar-section {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: auto !important;
        height: 44px !important;
        max-height: 44px !important;
        overflow: visible !important;
        flex-shrink: 0 !important;
        min-width: max-content !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Target each section individually with high specificity */
    .toolbar .toolbar-section:nth-child(1),
    .toolbar .toolbar-section:nth-child(2),
    .toolbar .toolbar-section:nth-child(3),
    .toolbar .toolbar-section:nth-child(4),
    .toolbar .toolbar-section:nth-child(5),
    .toolbar .toolbar-section:nth-child(6),
    .toolbar .toolbar-section:nth-child(7),
    .toolbar .toolbar-section:nth-child(8) {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
        min-width: max-content !important;
    }

    /* Force toolbar buttons to be visible */
    .toolbar .toolbar-button {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-width: 36px !important;
        width: 36px !important;
        height: 36px !important;
    }

    /* Force toolbar dropdowns to be visible */
    .toolbar .toolbar-dropdown {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-width: 80px !important;
    }
}

/* CRITICAL FIX: Force menu icons to display - THIS MUST BE AT THE END */
.menu-item .material-icon,
.menu-dropdown .material-icon,
span.material-icon {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 14px !important;
    width: auto !important;
    height: auto !important;
    margin-right: 8px !important;
    vertical-align: middle !important;
    font-family: 'Material Icons' !important;
    font-weight: normal !important;
    font-style: normal !important;
    text-decoration: none !important;
    color: currentColor !important;
    line-height: 1 !important;
    text-align: left !important;
    min-width: 16px !important;
    min-height: 16px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Force emoji icons specifically */
.material-icon:not(.ai-wand-icon):before,
.material-icon:not(.ai-wand-icon):after {
    content: none !important;
}

/* Cache Buster - Last Updated: 2025-09-20 17:05 */

/* ULTIMATE FORCE RULE - OVERRIDE EVERYTHING */
html .menu-item .material-icon,
html .menu-dropdown .material-icon,
html body .material-icon:not(.ai-wand-icon) {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 14px !important;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji" !important;
    margin-right: 8px !important;
    vertical-align: middle !important;
    text-decoration: none !important;
    font-style: normal !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
}

/* Force override any pseudo-element interference */
html .material-icon:not(.ai-wand-icon)::before,
html .material-icon:not(.ai-wand-icon)::after {
    content: none !important;
    display: none !important;
}

/* Complete browser context menu disabling */
#editor,
#editor *,
.editor-container,
.editor-container * {
    -webkit-touch-callout: none !important;
    -webkit-context-menu: none !important;
    -moz-context-menu: none !important;

    -webkit-user-select: text !important;
    -khtml-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    cursor: text !important;
}

/* Ensure cursor is visible in editor - Additional override */
#editor {
    cursor: text !important;
}

.editor-container {
    cursor: text;
}

/* Disable context menu on all text elements except editor */
body:not(#editor),
html {
    -webkit-touch-callout: none;
    -webkit-context-menu: none;
    -moz-context-menu: none;
}

/* Keep text selection enabled only for editor */
#editor {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Custom selection styling */
#editor::selection {
    background: rgba(79, 70, 229, 0.2);
}

#editor::-moz-selection {
    background: rgba(79, 70, 229, 0.2);
}

/* Mobile specific context menu prevention */
@media (max-width: 768px) {
    * {
        -webkit-touch-callout: none !important;
        -webkit-user-callout: none !important;
    }

    #editor,
    #editor * {
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
        cursor: text !important;
    }
}

/* Vertical AI Context Menu */
.ai-context-menu {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 60px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
}

.ai-context-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Hide center icon in vertical layout */
.ai-menu-center {
    display: none;
}

.ai-menu-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.ai-menu-item {
    position: relative;
    width: 50px;
    height: 50px;
    background: var(--accent-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 120, 212, 0.3);
    color: white;
    font-size: 20px;
    transform-origin: center;
}

.ai-menu-item:hover {
    transform: scale(1.1);
    background: var(--accent-hover);
    box-shadow: 0 6px 25px rgba(0, 120, 212, 0.4);
}

.ai-menu-item:active {
    transform: scale(0.95);
}

/* Close button styling - different color */
.ai-menu-item[data-angle="300"] {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.ai-menu-item[data-angle="300"]:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

/* Remove positioning attributes since we're using flexbox */
.ai-menu-item[data-angle="0"],
.ai-menu-item[data-angle="60"],
.ai-menu-item[data-angle="120"],
.ai-menu-item[data-angle="180"],
.ai-menu-item[data-angle="240"],
.ai-menu-item[data-angle="300"] {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
}

/* =============================================
   SPEECH TO TEXT MODAL STYLES (MINIMAL DESIGN)
   ============================================= */

.speech-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.speech-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    width: 85%;
    max-width: 400px;
    max-height: 60vh;
    box-shadow: 0 8px 32px var(--shadow);
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.speech-header {
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    position: relative;
}

.speech-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.speech-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0;
}

.speech-close {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.speech-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.speech-visualizer {
    text-align: center;
    padding: 20px 24px 16px;
}

.wave-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    height: 50px;
    margin-bottom: 12px;
}

.wave-bar {
    width: 4px;
    background: var(--accent-primary);
    border-radius: 2px;
    opacity: 0.3;
    transition: all 0.1s ease;
    height: 8px;
}

.wave-container.recording .wave-bar {
    animation: wave 1.2s ease-in-out infinite;
    opacity: 1;
}

.wave-container.recording .wave-bar:nth-child(1) {
    animation-delay: 0s;
}

.wave-container.recording .wave-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.wave-container.recording .wave-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.wave-container.recording .wave-bar:nth-child(4) {
    animation-delay: 0.3s;
}

.wave-container.recording .wave-bar:nth-child(5) {
    animation-delay: 0.4s;
}

.wave-container.recording .wave-bar:nth-child(6) {
    animation-delay: 0.5s;
}

.wave-container.recording .wave-bar:nth-child(7) {
    animation-delay: 0.6s;
}

.wave-container.recording .wave-bar:nth-child(8) {
    animation-delay: 0.5s;
}

.wave-container.recording .wave-bar:nth-child(9) {
    animation-delay: 0.4s;
}

.wave-container.recording .wave-bar:nth-child(10) {
    animation-delay: 0.3s;
}

.wave-container.recording .wave-bar:nth-child(11) {
    animation-delay: 0.2s;
}

.wave-container.recording .wave-bar:nth-child(12) {
    animation-delay: 0.1s;
}

.wave-container.recording .wave-bar:nth-child(13) {
    animation-delay: 0s;
}

.wave-container.recording .wave-bar:nth-child(14) {
    animation-delay: 0.1s;
}

.wave-container.recording .wave-bar:nth-child(15) {
    animation-delay: 0.2s;
}

.timer {
    font-size: 14px;
    color: var(--accent-primary);
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.speech-transcript {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    margin: 0 24px 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.speech-transcript:empty::before {
    content: 'Metniniz burada görünecek...';
    color: var(--text-secondary);
    font-style: italic;
}

.speech-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px 24px 24px;
}

.action-btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.delete-btn:hover:not(:disabled) {
    background: #ff4757;
    border-color: #ff4757;
    color: white;
    transform: scale(1.1);
}

.record-btn {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    width: 56px;
    height: 56px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.record-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 120, 212, 0.4);
}

.record-btn.recording {
    background: #ff4757;
    border-color: #ff4757;
    animation: recordingPulse 1.5s infinite;
}

.insert-btn:hover:not(:disabled) {
    background: #2ed573;
    border-color: #2ed573;
    color: white;
    transform: scale(1.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes wave {

    0%,
    100% {
        height: 8px;
    }

    50% {
        height: 35px;
    }
}

@keyframes recordingPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(255, 71, 87, 0.1);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 16px rgba(255, 71, 87, 0);
    }
}

/* ================================================
   FLOATING VOICE BUTTON (MOBILE ONLY)
   ================================================ */
.floating-voice-btn {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 950;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
}

.floating-voice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.floating-voice-btn:active {
    transform: scale(0.95);
}

.floating-voice-btn.recording {
    background: linear-gradient(135deg, #ff5757 0%, #ff3232 100%);
    box-shadow: 0 4px 16px rgba(255, 87, 87, 0.5);
    animation: voiceRecordingPulse 1.5s infinite;
}

@keyframes voiceRecordingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 16px rgba(255, 87, 87, 0.5);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 24px rgba(255, 87, 87, 0.7);
    }
}

/* Show floating voice button only on mobile */
@media (max-width: 768px) {
    .floating-voice-btn {
        display: flex !important;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .speech-modal-content {
        width: 92%;
        padding: 20px;
        max-height: 70vh;
    }

    .speech-title {
        font-size: 16px;
    }

    .wave-container {
        height: 40px;
    }

    .action-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .record-btn {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
}

/* AI Context Menu - Vertical List for Text Selection */
.ai-context-menu-vertical {
    position: fixed;
    z-index: 10000;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    display: none;
}

.ai-context-menu-vertical.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    display: block;
}

.ai-context-menu-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-context-menu-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.ai-context-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    text-align: left;
}

.ai-context-item:hover {
    background-color: var(--bg-secondary);
    color: var(--accent-primary);
}

.ai-context-item:active {
    background-color: var(--accent-primary);
    color: white;
}

.ai-context-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.ai-context-label {
    flex: 1;
    white-space: nowrap;
}

/* Cookie Consent Banner Styles */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 16px 20px;
    z-index: 10000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    max-height: none;
    overflow-y: visible;
}

.cookie-consent-banner:not(.hidden) {
    transform: translateY(0);
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-consent-text {
    flex: 1;
    min-width: 250px;
}

.cookie-consent-text h4 {
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

.cookie-consent-text p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.cookie-consent-text a {
    color: #ffcc00 !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    position: relative;
    z-index: 10001;
    pointer-events: auto !important;
    transition: all 0.2s ease !important;
}

.cookie-consent-text a:hover {
    text-decoration: underline !important;
    color: #ffe66d !important;
    text-shadow: 0 0 5px rgba(255, 204, 0, 0.5) !important;
}

.cookie-consent-text a:visited {
    color: #ffcc00 !important;
}

.cookie-consent-text a:link {
    color: #ffcc00 !important;
}

.cookie-consent-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 200px;
    justify-content: flex-end;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    z-index: 10001;
}

.cookie-btn.accept-btn {
    background-color: #667eea;
    color: white;
}

.cookie-btn.accept-btn:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.cookie-btn.reject-btn {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cookie-btn.reject-btn:hover {
    border-color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.cookie-consent-banner.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Mobile responsive cookie banner */
@media (max-width: 768px) {
    .cookie-consent-banner {
        padding: 12px 15px;
        bottom: 0;
    }

    .cookie-consent-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookie-consent-actions {
        width: 100%;
        justify-content: space-between;
    }

    .cookie-consent-text {
        width: 100%;
    }
}

/* Todo List Styles */
.todo-list {
    list-style: none;
    padding-left: 0;
    margin: 1em 0;
}

.todo-item {
    display: flex;
    align-items: center;
    /* Align checkbox and text vertically */
    margin-bottom: 4px;
    position: relative;
}

.todo-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    /* Slightly larger for better touch, but looks small */
    height: 14px;
    border: 1px solid var(--text-tertiary);
    border-radius: 3px;
    margin-right: 10px;
    /* Spacing after checkbox */
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    background-color: transparent;
    transition: all 0.2s ease;
    margin-top: 2px;
    /* Slight adjustment for visual alignment with text */
}

.todo-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.todo-checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

.todo-checkbox:hover {
    border-color: var(--primary-color);
}

.todo-text {
    flex-grow: 1;
    outline: none;
    min-height: 1.5em;
    /* Ensure height for empty todos */
    padding-left: 2px;
}

/* Strikethrough for checked items */
.todo-item[data-checked="true"] .todo-text {
    text-decoration: line-through;
    color: var(--text-tertiary);
    opacity: 0.8;
}

/* Editor Fixes */
#editor {
    cursor: text !important;
    /* Force visible cursor */
    caret-color: auto !important;
    /* Ensure text cursor is visible */
    border-top: 1px solid var(--border-color);
    /* Add top border */
    position: relative;
    z-index: 1;
    /* Ensure editor is above background elements */
}

/* =====================================================
   GRID/CHECKERED BACKGROUND FOR EDITOR
   ===================================================== */

/* Grid pattern for editor - ruled notebook style */
#editor {
    background-image:
        linear-gradient(0deg, transparent 23px, #e5e5e5 23px, #e5e5e5 24px),
        linear-gradient(90deg, transparent 23px, #e5e5e5 23px, #e5e5e5 24px);
    background-size: 24px 24px;
    background-position: 0 0;
    background-attachment: local;
}

/* =====================================================
   CURSOR STYLING
   ===================================================== */

/* Cursor for text input in editor - theme aware */
#editor {
    caret-color: var(--text-primary, #000) !important;
    color: var(--text-primary);
    cursor: text !important;
}

/* Global cursor styling */
body {
    cursor: default;
}

/* Ensure text cursor is visible */
input[type="text"],
textarea,
[contenteditable="true"] {
    caret-color: var(--text-primary, #000);
    cursor: text;
}

/* =====================================================
   FINAL CURSOR FIX - HIGHEST PRIORITY
   ===================================================== */

/* Ultimate fix for mouse cursor visibility in editor */
#editor,
#editor[contenteditable],
#editor[contenteditable="true"],
.editor-container #editor {
    cursor: text !important;
    caret-color: var(--text-primary, #000) !important;
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Ensure editor container allows pointer events */
.editor-container {
    cursor: text !important;
    pointer-events: auto !important;
}

/* Reset any global overrides that might hide cursor */
html:not(.no-cursor) body:not(.no-cursor) #editor {
    cursor: text !important;
}

/* =====================================================
   ABSOLUTE FINAL CURSOR FIX - DO NOT REMOVE
   This must be at the very end of the CSS file
   ===================================================== */

/* Force cursor on html and body */
html {
    cursor: auto !important;
}

body {
    cursor: auto !important;
}

/* Force text cursor on editor with maximum specificity */
html body .editor-container {
    cursor: text !important;
    pointer-events: auto !important;
}

html body .editor-container #editor {
    cursor: text !important;
    pointer-events: auto !important;
}

html body #editor {
    cursor: text !important;
    pointer-events: auto !important;
}

html body #editor[contenteditable="true"] {
    cursor: text !important;
    pointer-events: auto !important;
}

/* Ensure child elements inherit text cursor */
html body #editor * {
    cursor: text !important;
}

/* Override any potential ::before or ::after that might block cursor */
html body #editor::before,
html body #editor::after {
    pointer-events: none !important;
}

/* Edge/Chromium specific fix */
@supports (-ms-ime-align: auto) {
    #editor {
        cursor: text !important;
    }
}

/* WebKit specific fix */
@supports (-webkit-appearance: none) {
    #editor {
        cursor: text !important;
        -webkit-cursor-visibility: visible !important;
    }
}

/* Editor cursor settings */
#editor,
.editor-container {
    background-color: var(--bg-secondary) !important;
    cursor: text !important;
}

#editor {
    color: var(--text-primary) !important;
    caret-color: var(--text-primary) !important;
}

/* Compact Notification Styles */
.top-banner-alert {
    padding: 8px 16px !important;
    min-height: 48px !important;
    /* Fixed height for better alignment consistency */
    font-size: 13px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    box-sizing: border-box !important;
}

.top-banner-content {
    display: flex !important;
    align-items: center !important;
    /* Vertically center icon and text */
    gap: 12px !important;
    flex: 1 !important;
    height: 100% !important;
}

.top-banner-icon {
    font-size: 18px !important;
    width: 24px !important;
    /* Slightly wider to accommodate centering */
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin-top: 0 !important;
    align-self: center !important;
    /* Explicitly tell flex parent to center this item */
}

.top-banner-message {
    font-size: 13px !important;
    line-height: 1.4 !important;
    flex: 1 !important;
    margin-top: 1px !important;
    /* Optical adjustment */
}

.top-banner-close {
    padding: 4px !important;
    font-size: 14px !important;
    line-height: 1 !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Toast Notifications - REMOVED */

/* Enhanced Todo List Styles */
ul[data-checked="true"],
ul[data-checked="false"] {
    pointer-events: none;
}

ul[data-checked="true"]>li,
ul[data-checked="false"]>li {
    pointer-events: auto;
    position: relative;
    padding-left: 24px !important;
    list-style: none !important;
    margin-bottom: 4px !important;
    transition: all 0.2s ease;
}

/* Custom Checkbox Container */
ul[data-checked="true"]>li::before,
ul[data-checked="false"]>li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    /* Align with text */
    width: 16px;
    height: 16px;
    border: 1.5px solid #bdc3c7;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* Checked State - Box */
ul[data-checked="true"]>li::before {
    background-color: var(--primary-color, #4a90e2);
    border-color: var(--primary-color, #4a90e2);
}

/* Checked State - Checkmark */
ul[data-checked="true"]>li::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 7px;
    width: 6px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0.8);
    pointer-events: none;
}

/* Hover Effect */
ul[data-checked="false"]>li:hover::before {
    border-color: var(--primary-color, #4a90e2);
    background-color: rgba(74, 144, 226, 0.05);
}

/* Checked Item Text Strikethrough */
ul[data-checked="true"]>li {
    text-decoration: line-through;
    color: #95a5a6 !important;
    opacity: 0.8;
}

/* Quill Specific Overrides for Checklist */
.ql-editor li[data-list="checked"]>.ql-ui,
.ql-editor li[data-list="unchecked"]>.ql-ui {
    display: none !important;
    /* Hide default Quill checkboxes if they appear */
}



/* Custom Context Menu Compact Styles */
.context-menu,
#context-menu,
.ai-context-menu-vertical {
    padding: 4px 0 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.context-menu-item,
.ai-context-item {
    padding: 6px 12px !important;
    min-height: 28px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    display: flex !important;
    align-items: center !important;
}

.context-menu-item svg,
.context-menu-item .material-icon,
.ai-context-item .ai-context-icon {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    margin-right: 8px !important;
}

.context-menu-separator,
.menu-separator {
    margin: 2px 0 !important;
}

.ai-context-menu-header {
    padding: 6px 12px 4px !important;
    font-size: 11px !important;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   AI ASSISTANT DIALOG - Settings-Style Modern Design
   nootle.io · Consistent Aesthetic
════════════════════════════════════════════════════════════════ */
.ai-dialog {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 400px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 0 0 1px #e4e4e7;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-dialog[style*="flex"] {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.ai-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e4e4e7;
    background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
}

.ai-dialog-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0a0a0b;
}

.ai-wand-icon {
    font-size: 18px;
    color: #4f46e5;
}

.ai-dialog-header-actions {
    display: flex;
    gap: 8px;
}

.ai-dialog-action-btn,
.ai-dialog-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    color: #a1a1aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-dialog-action-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: #4f46e5;
    color: #4f46e5;
}

.ai-dialog-close:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
    transform: rotate(90deg);
}

.ai-dialog-body {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #ffffff;
}

.ai-dialog-input {
    flex: 1;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.5;
    background: #ffffff;
    color: #0a0a0b;
}

.ai-dialog-input::placeholder {
    color: #a1a1aa;
}

.ai-dialog-input:hover {
    border-color: #a1a1aa;
}

.ai-dialog-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.ai-dialog-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #4f46e5;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ai-dialog-send-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transform: translateY(-1px);
}

.ai-dialog-send-btn:active {
    transform: translateY(0);
}

.ai-dialog-settings {
    padding: 16px 20px;
    background: #f8f9fc;
    border-top: 1px solid #e4e4e7;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f4f4f5;
    transition: background 150ms cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0 -4px;
    padding-left: 4px;
    padding-right: 4px;
    border-radius: 6px;
}

.ai-setting-row:last-child {
    border-bottom: none;
}

.ai-setting-row:hover {
    background: rgba(79, 70, 229, 0.08);
}

.ai-setting-row label {
    color: #52525b;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: -0.01em;
}

.ai-dialog-select {
    padding: 8px 12px;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
    color: #0a0a0b;
    outline: none;
    cursor: pointer;
    min-width: 140px;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-dialog-select:hover {
    border-color: #a1a1aa;
}

.ai-dialog-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.ai-dialog-quick-actions {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-top: 1px solid #f4f4f5;
    background: #fafbff;
}

.ai-quick-chip {
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #52525b;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-quick-chip:hover {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}

.ai-live-output {
    border-top: 1px solid #e4e4e7;
    background: #f8f9fc;
    max-height: 200px;
    overflow-y: auto;
}

.ai-live-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f4f4f5;
    font-size: 12px;
    font-weight: 600;
    color: #52525b;
}

.ai-mini-btn {
    padding: 6px 12px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
    color: #52525b;
}

.ai-mini-btn:hover {
    background: #f8f9fc;
    border-color: #a1a1aa;
}

.ai-mini-btn.primary {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.ai-mini-btn.primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

#ai-live-pre {
    padding: 16px;
    margin: 0;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    color: #52525b;
    white-space: pre-wrap;
    background: #ffffff;
    line-height: 1.5;
}

/* ============================================================
   VERSION HISTORY MODAL STYLES
   Matching Settings Dialog design system
   ============================================================ */

.version-history-modal .custom-modal-content {
    max-width: 550px !important;
    width: 90vw;
    max-height: 85vh;
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 0 0 1px #e4e4e7;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.version-history-modal .custom-modal-header {
    padding: 16px 20px;
    background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
    border-bottom: 1px solid #e4e4e7;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.version-history-modal .custom-modal-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0a0a0b;
}

.version-history-modal .custom-modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #71717a;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.version-history-modal .custom-modal-close:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
    transform: rotate(90deg);
}

/* Empty State */
.version-history-empty {
    text-align: center;
    padding: 40px 24px;
}

.version-history-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.version-history-empty-title {
    font-size: 16px;
    font-weight: 500;
    color: #71717a;
    margin-bottom: 8px;
}

.version-history-empty-desc {
    font-size: 14px;
    color: #a1a1aa;
    line-height: 1.5;
    max-width: 300px;
    margin: 0 auto;
}

/* Stats Cards */
.version-history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    background: #f4f4f5;
    border-bottom: 1px solid #e4e4e7;
}

.version-stat-card {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 12px 16px;
}

.version-stat-label {
    font-size: 11px;
    font-weight: 500;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.version-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #0a0a0b;
    letter-spacing: -0.02em;
}

/* Version Timeline */
.version-timeline {
    padding: 16px 20px;
}

.version-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
}

.version-item:last-child {
    margin-bottom: 0;
}

/* Version Indicator (Timeline) */
.version-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.version-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d4d4d8;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #e4e4e7;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.version-indicator.latest .version-dot {
    background: #4f46e5;
    box-shadow: 0 0 0 2px #c7d2fe;
}

.version-line {
    width: 2px;
    flex: 1;
    background: linear-gradient(180deg, #e4e4e7 0%, transparent 100%);
    margin-top: 4px;
    min-height: 40px;
}

/* Version Content Card */
.version-content {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 16px;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.version-item:hover .version-content {
    border-color: #c4c4c9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.version-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.version-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0a0a0b;
}

.version-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    border-radius: 4px;
}

.version-description {
    font-size: 13px;
    color: #52525b;
    margin-bottom: 8px;
    line-height: 1.4;
}

.version-meta {
    font-size: 12px;
    color: #a1a1aa;
}

/* Version Action Buttons */
.version-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.version-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    color: #52525b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.version-btn:hover {
    background: #f4f4f5;
    border-color: #d4d4d8;
    transform: translateY(-1px);
}

.version-btn.primary {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

.version-btn.primary:hover {
    background: #4338ca;
    border-color: #4338ca;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.version-btn.danger {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.version-btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

/* Modal Body */
.version-history-modal .custom-modal-body {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.version-history-modal .custom-modal-body::-webkit-scrollbar {
    width: 6px;
}

.version-history-modal .custom-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.version-history-modal .custom-modal-body::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 3px;
}

.version-history-modal .custom-modal-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}

/* Modal Footer */
.version-history-modal .custom-modal-buttons {
    padding: 16px 20px;
    background: #fafafa;
    border-top: 1px solid #e4e4e7;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

.version-history-modal .custom-modal-button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    color: #52525b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.version-history-modal .custom-modal-button:hover {
    background: #f4f4f5;
    border-color: #d4d4d8;
    transform: translateY(-1px);
}

.version-history-modal .custom-modal-button.primary {
    background: #0a0a0b;
    border-color: #0a0a0b;
    color: #ffffff;
}

.version-history-modal .custom-modal-button.primary:hover {
    background: #27272a;
    border-color: #27272a;
}

/* Diff Modal Styles */
.diff-modal .custom-modal-content {
    max-width: 800px !important;
    width: 90vw;
    max-height: 90vh;
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 0 0 1px #e4e4e7;
    overflow: hidden;
}

.diff-modal .custom-modal-header {
    padding: 16px 20px;
    background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
    border-bottom: 1px solid #e4e4e7;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.diff-modal .custom-modal-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0a0a0b;
}

.diff-modal .custom-modal-body {
    padding: 20px;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

.diff-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e4e4e7;
}

.diff-version {
    font-size: 13px;
    color: #52525b;
}

.diff-version strong {
    color: #0a0a0b;
}

.diff-content {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: #fafafa;
    border-radius: 8px;
    overflow: hidden;
}

.diff-line {
    padding: 4px 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-line.added {
    background: #dcfce7;
    color: #166534;
}

.diff-line.removed {
    background: #fee2e2;
    color: #991b1b;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .version-history-modal .custom-modal-content {
        max-width: 95vw !important;
        width: calc(100vw - 20px);
        margin: 10px;
    }

    .version-history-stats {
        grid-template-columns: 1fr;
        padding: 12px 16px;
    }

    .version-timeline {
        padding: 16px;
    }

    .version-header {
        flex-direction: column;
        gap: 8px;
    }

    .version-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .version-btn {
        flex: 1;
        min-width: 80px;
    }

    .diff-header {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .version-history-modal .custom-modal-content {
        max-width: 98vw !important;
        width: calc(100vw - 10px);
        margin: 5px;
    }

    .version-history-modal .custom-modal-header {
        padding: 12px 16px;
    }

    .version-history-modal .custom-modal-buttons {
        padding: 12px 16px;
    }

    .version-history-modal .custom-modal-button {
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* Material Icons Definition */
.material-icon {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    /* Preferred icon size */
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;

    /* Support for all WebKit browsers. */
    -webkit-font-smoothing: antialiased;
    /* Support for Safari and Chrome. */
    text-rendering: optimizeLegibility;

    /* Support for Firefox. */
    -moz-osx-font-smoothing: grayscale;

    /* Support for IE. */
    font-feature-settings: 'liga';
}

/* Settings Dialog Styles */
.settings-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.settings-dialog-overlay.active {
    display: flex;
}

.settings-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.settings-dialog-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.settings-dialog-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}

.settings-dialog-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.settings-dialog-body {
    display: flex;
    overflow: hidden;
    flex: 1;
}

.settings-sidebar {
    width: 220px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-tab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
}

.settings-tab-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.settings-tab-btn.active {
    background: var(--primary-color, #667eea);
    color: white;
}

.settings-tab-btn .material-icon {
    font-size: 20px;
}

.settings-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.settings-group {
    margin-bottom: 28px;
}

.settings-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    display: block;
}

.setting-description {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.4;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Allow column layout for complex controls like AI Model selection */
.setting-control.column {
    flex-direction: column;
    align-items: stretch;
    width: 60%;
    /* Give it more width relative to label */
}

.setting-select,
.setting-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #111827;
    outline: none;
    min-width: 140px;
}

.setting-select:focus,
.setting-input:focus {
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary-color, #667eea);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* Model Filter Buttons */
.model-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    color: #374151;
}

.filter-btn.active {
    background: var(--primary-color, #667eea);
    color: white;
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Range Slider */
.setting-range-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-range {
    flex: 1;
    min-width: 120px;
}

.setting-range-value {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    min-width: 40px;
    text-align: right;
}

/* Status Messages */
.status-loading {
    color: #f59e0b;
}

.status-success {
    color: #10b981;
}

.status-error {
    color: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-dialog {
        width: 95%;
        max-height: 90vh;
    }

    .settings-sidebar {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 8px;
        overflow-x: auto;
    }

    .settings-tab-btn {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13px;
    }

    .settings-dialog-body {
        flex-direction: column;
    }

    .model-filters {
        gap: 6px;
    }

    .filter-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Toast Notifications - REMOVED */

/* ============================================
   MODERN TABLE MODAL STYLES
   ============================================ */

.table-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.table-modal-overlay.show {
    opacity: 1;
}

.table-modal-container {
    background: var(--editor-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.table-modal-overlay.show .table-modal-container {
    transform: scale(1) translateY(0);
}

/* Header */
.table-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e1e1e1);
    background: var(--header-bg, #fafafa);
}

.table-modal-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary, #0078d4) 0%, var(--accent-secondary, #106ebe) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.table-modal-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
}

.table-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #605e5c);
    transition: all 0.2s ease;
}

.table-modal-close:hover {
    background: var(--hover-bg, #f3f2f1);
    color: var(--text-primary, #1f1f1f);
}

/* Body */
.table-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* Size Section */
.table-size-section {
    margin-bottom: 24px;
}

.table-size-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.table-size-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
}

.table-size-display {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-primary, #0078d4);
    background: var(--accent-light, #e3f2fd);
    padding: 4px 12px;
    border-radius: 6px;
}

/* Grid Selector */
.table-grid-selector {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    padding: 12px;
    background: var(--light-bg, #f8f8f8);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e1e1e1);
}

.grid-cell {
    aspect-ratio: 1;
    background: var(--editor-bg, #ffffff);
    border: 1px solid var(--border-color, #e1e1e1);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.grid-cell:hover {
    transform: scale(1.1);
}

.grid-cell.active {
    background: var(--accent-primary, #0078d4);
    border-color: var(--accent-primary, #0078d4);
    box-shadow: 0 0 8px rgba(0, 120, 212, 0.4);
}

/* Options Section */
.table-options-section {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--light-bg, #f8f8f8);
    border-radius: 12px;
}

.table-option-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.table-option-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--border-color, #c8c6c4);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.table-option-toggle input:checked+.toggle-slider {
    background: var(--accent-primary, #0078d4);
}

.table-option-toggle input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1f1f1f);
}

/* Style Section */
.table-style-section {
    margin-bottom: 8px;
}

.table-style-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
    margin-bottom: 12px;
}

.table-style-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.table-style-card {
    background: var(--light-bg, #f8f8f8);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.table-style-card:hover {
    background: var(--hover-bg, #f3f2f1);
    transform: translateY(-2px);
}

.table-style-card.active {
    border-color: var(--accent-primary, #0078d4);
    background: var(--accent-light, #e3f2fd);
}

.style-preview {
    margin-bottom: 8px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
}

.preview-header {
    height: 12px;
    background: var(--accent-primary, #0078d4);
    border-radius: 2px 2px 0 0;
    margin-bottom: 2px;
}

.preview-default .preview-header {
    background: #0078d4;
}

.preview-striped .preview-header {
    background: #0078d4;
}

.preview-bordered .preview-header {
    background: #333;
}

.preview-minimal .preview-header {
    background: transparent;
    border-bottom: 2px solid #ddd;
}

.preview-row {
    display: flex;
    gap: 2px;
    justify-content: space-between;
}

.preview-row span {
    flex: 1;
    height: 8px;
    background: var(--border-color, #e1e1e1);
    border-radius: 1px;
}

.preview-striped .preview-row:nth-child(2) span {
    background: #f8f9fa;
}

.preview-bordered .preview-row span {
    border: 1px solid #333;
}

.preview-minimal .preview-row span {
    border: none;
    border-bottom: 1px solid #eee;
}

.style-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #605e5c);
}

.table-style-card.active .style-name {
    color: var(--accent-primary, #0078d4);
}

/* Footer */
.table-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, #e1e1e1);
    background: var(--header-bg, #fafafa);
}

.table-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-btn-secondary {
    background: var(--light-bg, #f3f2f1);
    color: var(--text-primary, #1f1f1f);
}

.table-btn-secondary:hover {
    background: var(--hover-bg, #e1e1e1);
}

.table-btn-primary {
    background: linear-gradient(135deg, var(--accent-primary, #0078d4) 0%, var(--accent-secondary, #106ebe) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.table-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 120, 212, 0.4);
}

.table-btn svg {
    flex-shrink: 0;
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
    .table-modal-container {
        background: var(--editor-bg, #1e1e1e);
    }

    .table-modal-header {
        background: var(--header-bg, #252526);
        border-bottom-color: var(--border-color, #3c3c3c);
    }

    .table-modal-title {
        color: var(--text-primary, #ffffff);
    }

    .table-modal-close {
        color: var(--text-secondary, #a0a0a0);
    }

    .table-modal-close:hover {
        background: var(--hover-bg, #2d2d2d);
        color: var(--text-primary, #ffffff);
    }

    .table-size-label,
    .toggle-label,
    .table-style-label {
        color: var(--text-primary, #ffffff);
    }

    .grid-cell {
        background: var(--editor-bg, #2d2d2d);
        border-color: var(--border-color, #3c3c3c);
    }

    .table-option-toggle,
    .table-style-card {
        background: var(--light-bg, #2d2d2d);
    }

    .table-style-card:hover {
        background: var(--hover-bg, #3c3c3c);
    }

    .table-modal-footer {
        background: var(--header-bg, #252526);
        border-top-color: var(--border-color, #3c3c3c);
    }

    .table-btn-secondary {
        background: var(--light-bg, #2d2d2d);
        color: var(--text-primary, #ffffff);
    }

    .table-btn-secondary:hover {
        background: var(--hover-bg, #3c3c3c);
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .table-modal-container {
        width: 95%;
        max-width: none;
        border-radius: 12px;
    }

    .table-modal-header {
        padding: 16px;
    }

    .table-modal-body {
        padding: 16px;
    }

    .table-grid-selector {
        gap: 3px;
        padding: 8px;
    }

    .table-style-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-modal-footer {
        padding: 12px 16px;
    }

    .table-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ============================================
   MODERN CODE MODAL STYLES
   ============================================ */

.code-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.code-modal-overlay.show {
    opacity: 1;
}

.code-modal-container {
    background: var(--editor-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.code-modal-overlay.show .code-modal-container {
    transform: scale(1) translateY(0);
}

/* Header */
.code-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e1e1e1);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.code-modal-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.code-modal-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.code-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
}

.code-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body */
.code-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 160px);
}

/* Code Type Section */
.code-type-section {
    margin-bottom: 24px;
}

.code-type-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
    margin-bottom: 12px;
}

.code-type-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.code-type-card {
    background: var(--light-bg, #f8f8f8);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.code-type-card:hover {
    background: var(--hover-bg, #f3f2f1);
    transform: translateY(-2px);
}

.code-type-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.type-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.type-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
    margin-bottom: 4px;
}

.type-desc {
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #605e5c);
}

.code-type-card.active .type-name {
    color: #667eea;
}

/* Language Section */
.code-language-section {
    margin-bottom: 24px;
}

.code-language-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
    margin-bottom: 12px;
}

.language-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary, #605e5c);
}

.language-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #605e5c);
    pointer-events: none;
}

.language-search {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color, #e1e1e1);
    border-radius: 8px;
    font-size: 14px;
    background: var(--editor-bg, #ffffff);
    color: var(--text-primary, #1f1f1f);
    transition: all 0.2s ease;
}

.language-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
}

.language-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: var(--light-bg, #f8f8f8);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-card:hover {
    background: var(--hover-bg, #f3f2f1);
}

.language-card.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
}

.lang-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.lang-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #605e5c);
    text-align: center;
}

.language-card.active .lang-label {
    color: #667eea;
}

/* Code Input Section */
.code-input-section {
    margin-bottom: 8px;
}

.code-input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f1f1f);
    margin-bottom: 12px;
}

.code-editor-wrapper {
    border: 1px solid var(--border-color, #e1e1e1);
    border-radius: 12px;
    overflow: hidden;
    background: #1e1e1e;
}

.code-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.editor-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
}

.dot.yellow {
    background: #ffbd2e;
}

.dot.green {
    background: #27c93f;
}

.editor-info {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #858585;
    font-family: 'Consolas', 'Monaco', monospace;
}

.code-textarea {
    width: 100%;
    min-height: 150px;
    padding: 16px;
    border: none;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

.code-textarea:focus {
    outline: none;
}

.code-textarea::placeholder {
    color: #6a6a6a;
}

/* Footer */
.code-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, #e1e1e1);
    background: var(--header-bg, #fafafa);
}

.code-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-btn-secondary {
    background: var(--light-bg, #f3f2f1);
    color: var(--text-primary, #1f1f1f);
}

.code-btn-secondary:hover {
    background: var(--hover-bg, #e1e1e1);
}

.code-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.code-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.code-btn svg {
    flex-shrink: 0;
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
    .code-modal-container {
        background: var(--editor-bg, #1e1e1e);
    }

    .code-modal-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .code-type-label,
    .code-language-label,
    .code-input-label {
        color: var(--text-primary, #ffffff);
    }

    .code-type-card,
    .language-card {
        background: var(--light-bg, #2d2d2d);
    }

    .code-type-card:hover,
    .language-card:hover {
        background: var(--hover-bg, #3c3c3c);
    }

    .language-search {
        background: var(--editor-bg, #2d2d2d);
        color: var(--text-primary, #ffffff);
    }

    .code-modal-footer {
        background: var(--header-bg, #252526);
        border-top-color: var(--border-color, #3c3c3c);
    }

    .code-btn-secondary {
        background: var(--light-bg, #2d2d2d);
        color: var(--text-primary, #ffffff);
    }

    .code-btn-secondary:hover {
        background: var(--hover-bg, #3c3c3c);
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .code-modal-container {
        max-width: none;
        border-radius: 12px;
    }

    .code-modal-header {
        padding: 16px;
    }

    .code-modal-body {
        padding: 16px;
    }

    .code-type-options {
        grid-template-columns: 1fr;
    }

    .language-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .code-modal-footer {
        padding: 12px 16px;
    }

    .code-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ============================================
   GITHUB ISSUE BUTTON
   ============================================ */

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.github-issue-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border: none;
    cursor: pointer;
}

.github-issue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.github-issue-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.github-issue-btn span {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .github-issue-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .github-issue-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================
   MOBILE-FIRST GLASS DESIGN (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {

    /* Google Fonts for mobile */
    body {
        font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    }

    /* ============================================
       MOBILE HEADER
       ============================================ */

    .title-bar {
        padding: 8px 12px;
        min-height: 52px;
        background: var(--bg-glass, rgba(255, 255, 255, 0.9)) !important;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
    }

    .sidebar-toggle {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px;
        min-height: 48px;
        font-size: 20px;
    }

    .app-icon {
        flex: 1;
        text-align: center;
    }

    .app-logo-text {
        font-family: 'Space Grotesk', sans-serif !important;
        font-size: 18px;
        font-weight: 700;
    }

    /* Hide desktop menus on mobile */
    .menu-group {
        display: none !important;
    }

    /* ============================================
       MOBILE TOOLBAR
       ============================================ */

    /* Scrollable toolbar */
    .toolbar {
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        background: var(--bg-glass-strong, rgba(255, 255, 255, 0.95)) !important;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
        padding: 6px 12px;
        position: relative;
        z-index: 99;
    }

    .toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar-btn {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 60px;
        height: 52px;
        padding: 6px 10px;
        border: none;
        background: transparent;
        color: var(--text-secondary, #64748b);
        font-size: 11px;
        font-weight: 500;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .toolbar-btn svg,
    .toolbar-btn .material-icon {
        width: 22px;
        height: 22px;
        margin-bottom: 2px;
    }

    .toolbar-btn:active {
        background: var(--primary-light, rgba(37, 99, 235, 0.1));
        color: var(--primary, #2563eb);
        transform: scale(0.95);
    }

    .toolbar-btn.active {
        background: var(--primary, #2563eb);
        color: white;
    }

    /* Fade edges for scroll indication */
    .toolbar::before,
    .toolbar::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        pointer-events: none;
        z-index: 1;
    }

    .toolbar::before {
        left: 0;
        background: linear-gradient(to right, var(--bg-glass-strong, rgba(255, 255, 255, 0.95)), transparent);
    }

    .toolbar::after {
        right: 0;
        background: linear-gradient(to left, var(--bg-glass-strong, rgba(255, 255, 255, 0.95)), transparent);
    }

    /* ============================================
       MOBILE EDITOR AREA
       ============================================ */

    .main-container {
        padding-bottom: 80px !important;
    }

    .editor-wrapper {
        padding: 12px;
    }

    #editor {
        font-size: 16px;
        line-height: 1.7;
        min-height: 60vh;
        border-radius: 16px;
    }

    /* ============================================
       MOBILE BOTTOM NAVIGATION
       ============================================ */

    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-glass-strong, rgba(255, 255, 255, 0.95)) !important;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-top: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
        padding: 6px 12px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .bottom-nav-inner {
        display: flex;
        justify-content: space-around;
        align-items: center;
        max-width: 600px;
        margin: 0 auto;
    }

    .nav-item {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 55px;
        height: 48px;
        padding: 6px;
        border: none;
        background: transparent;
        color: var(--text-tertiary, #94a3b8);
        font-size: 11px;
        font-weight: 500;
        text-decoration: none;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
        position: relative;
    }

    .nav-item svg,
    .nav-item .material-icon {
        width: 22px;
        height: 22px;
        transition: transform 0.2s ease;
        flex-shrink: 0;
    }

    .nav-item:hover {
        background: var(--primary-light, rgba(37, 99, 235, 0.1));
        color: var(--text-secondary, #64748b);
    }

    .nav-item:active {
        transform: scale(0.95);
        background: var(--primary-light, rgba(37, 99, 235, 0.1));
        color: var(--primary, #2563eb);
    }

    .nav-item.active {
        color: var(--primary, #2563eb);
    }

    .nav-item.active svg,
    .nav-item.active .material-icon {
        transform: translateY(-2px);
    }

    .nav-item.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 20px;
        height: 3px;
        background: var(--primary, #2563eb);
        border-radius: 2px 2px 0 0;
    }

    /* ============================================
       MOBILE SIDEBAR
       ============================================ */

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-surface, #ffffff);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 1999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* ============================================
       MOBILE TABS
       ============================================ */

    .tabs-container {
        order: -1;
        background: var(--bg-glass, rgba(255, 255, 255, 0.9)) !important;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs-container::-webkit-scrollbar {
        display: none;
    }

    .tab {
        min-width: 120px;
        max-width: 160px;
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 0;
    }

    .tab:first-child {
        border-top-left-radius: 0;
    }

    .tab:last-child {
        border-top-right-radius: 0;
    }

    /* ============================================
       MOBILE MODALS
       ============================================ */

    .modal-overlay,
    .settings-overlay {
        padding: 16px;
    }

    .modal-content,
    .settings-content {
        max-width: 100%;
        border-radius: 20px;
        max-height: 85vh;
    }

    .modal-header,
    .settings-header {
        padding: 16px;
        border-radius: 20px 20px 0 0;
    }

    .modal-title,
    .settings-title {
        font-size: 18px;
    }

    .modal-body,
    .settings-body {
        padding: 16px;
    }

    .modal-footer,
    .settings-footer {
        padding: 12px 16px;
        border-radius: 0 0 20px 20px;
    }

    .btn {
        min-height: 48px;
        min-width: 48px;
        font-size: 15px;
    }

    /* ============================================
       MOBILE TOAST NOTIFICATIONS
       ============================================ */

    .toast {
        left: 12px;
        right: 12px;
        margin: 0;
        border-radius: 14px;
        padding: 14px 16px;
    }

    /* ============================================
       MOBILE FILE INFO
       ============================================ */

    .file-info {
        flex-wrap: wrap;
        font-size: 12px;
    }

    .file-info-item {
        min-width: 100%;
    }

    /* ============================================
       MOBILE SEARCH
       ============================================ */

    .search-input {
        font-size: 16px;
        height: 48px;
    }

    /* ============================================
       MOBILE ACTION BUTTONS
       ============================================ */

    .icon-btn,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    /* ============================================
       MOBILE DRAWER (OVERFLOW MENU)
       ============================================ */

    .overflow-overlay {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 2000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .overflow-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .overflow-drawer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-surface-elevated, #f8fafc);
        border-radius: 24px 24px 0 0;
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2001;
        max-height: 70vh;
        overflow-y: auto;
    }

    .overflow-drawer.active {
        transform: translateY(0);
    }

    .drawer-handle {
        width: 36px;
        height: 4px;
        background: var(--border-default, rgba(148, 163, 184, 0.4));
        border-radius: 2px;
        margin: 0 auto 16px;
    }

    .drawer-title {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 18px;
        font-weight: 600;
        text-align: center;
        margin-bottom: 16px;
    }

    .drawer-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .drawer-action {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 14px 10px;
        background: var(--bg-primary, #ffffff);
        border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
        border-radius: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .drawer-action:active {
        background: var(--primary-light, rgba(37, 99, 235, 0.1));
        border-color: var(--primary, #2563eb);
    }

    .drawer-action svg {
        width: 24px;
        height: 24px;
        color: var(--text-secondary, #64748b);
    }

    .drawer-action span {
        font-size: 11px;
        font-weight: 500;
        color: var(--text-secondary, #64748b);
        text-align: center;
    }

    /* ============================================
       MOBILE SETTINGS
       ============================================ */

    .settings-section {
        margin-bottom: 20px;
        animation: slideUp 0.4s ease;
    }

    .settings-card {
        border-radius: 16px;
        overflow: hidden;
        border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
    }

    .settings-item {
        padding: 14px 16px;
        min-height: 48px;
    }

    .settings-item-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .settings-item-label {
        font-size: 15px;
    }

    .settings-item-description {
        font-size: 12px;
    }

    /* Toggle switch */
    .toggle {
        width: 50px;
        height: 30px;
    }

    .toggle-slider::before {
        width: 24px;
        height: 24px;
        top: 3px;
        left: 3px;
    }

    .toggle-input:checked+.toggle-slider::before {
        transform: translateX(20px);
    }

    /* ============================================
       MOBILE ANIMATIONS
       ============================================ */

    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes toastIn {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .animate-slide-up {
        animation: slideUp 0.4s ease;
    }

    /* ============================================
       MOBILE TOUCH OPTIMIZATIONS
       ============================================ */

    /* Prevent zoom on input focus */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Smooth scrolling */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    /* ============================================
       HIDE DESKTOP ELEMENTS ON MOBILE
       ============================================ */

    .desktop-only {
        display: none !important;
    }

    /* Ensure mobile elements are visible */
    .mobile-only {
        display: block !important;
    }

    .mobile-only.nav-item {
        display: flex !important;
    }

    .mobile-only.bottom-nav {
        display: flex !important;
    }
}

/* ============================================
   TABLET & SMALL DESKTOP (769px - 1024px)
   ============================================ */

@media (min-width: 769px) {

    /* Hide mobile elements on desktop */
    .bottom-nav,
    .overflow-drawer,
    .overflow-overlay {
        display: none !important;
    }

    .mobile-only {
        display: none !important;
    }
}

/* Dark mode adjustments for mobile */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    body {
        --bg-primary: #0f172a;
        --bg-glass: rgba(30, 41, 59, 0.85);
        --bg-glass-strong: rgba(30, 41, 59, 0.95);
        --bg-surface: #1e293b;
        --bg-surface-elevated: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-tertiary: #64748b;
        --border-subtle: rgba(71, 85, 105, 0.3);
        --border-default: rgba(71, 85, 105, 0.5);
        --border-strong: #475569;
        --primary: #3b82f6;
        --primary-hover: #60a5fa;
        --primary-active: #93c5fd;
        --primary-light: rgba(59, 130, 246, 0.15);
    }

    .title-bar {
        background: var(--bg-glass) !important;
        border-bottom-color: var(--border-subtle) !important;
    }

    .app-logo-text {
        color: var(--text-primary);
    }

    .sidebar-toggle {
        color: var(--text-primary);
    }

    .sidebar-toggle:hover {
        background: var(--bg-surface-elevated);
    }

    .toolbar {
        background: var(--bg-glass-strong) !important;
        border-bottom-color: var(--border-subtle) !important;
    }

    .toolbar-btn {
        color: var(--text-secondary);
    }

    .toolbar-btn:active,
    .toolbar-btn.active {
        background: var(--primary-light);
        color: var(--primary);
    }

    .bottom-nav {
        background: var(--bg-glass-strong) !important;
        border-top-color: var(--border-subtle) !important;
    }

    .nav-item {
        color: var(--text-tertiary);
    }

    .nav-item.active {
        color: var(--primary);
    }

    .nav-item svg {
        stroke: var(--text-tertiary);
    }

    .nav-item.active svg {
        stroke: var(--primary);
    }

    .overflow-drawer {
        background: var(--bg-surface-elevated);
    }

    .drawer-action {
        background: var(--bg-surface);
        border-color: var(--border-subtle);
    }

    .drawer-action svg {
        color: var(--text-secondary);
    }

    .drawer-action span {
        color: var(--text-secondary);
    }

    .drawer-action:active {
        background: var(--primary-light);
        border-color: var(--primary);
    }

    .drawer-handle {
        background: var(--border-default);
    }

    .drawer-title {
        color: var(--text-primary);
    }

    .sidebar {
        background: var(--bg-surface);
    }

    #editor {
        background: var(--bg-surface);
        color: var(--text-primary);
    }

    .editor-wrapper {
        background: var(--bg-primary);
    }
}


/* Fix for toggling sidebar on mobile via Bottom Nav */
@media (max-width: 768px) {
    .sidebar.mobile-visible {
        display: block !important;
        width: 80% !important;
        max-width: 300px;
        z-index: 3000 !important;
        transform: translateX(0) !important;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    }
}

/* ================================================
   ABOUT & HELP MODAL STYLES
   ================================================ */

.about-modal,
.help-modal {
    z-index: 10000;
}

.about-modal-content,
.help-modal-content {
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
}

.about-modal-body,
.help-modal-body {
    padding: 0;
    height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.about-modal-body iframe,
.help-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    flex: 1;
}

.about-logo svg {
    width: 24px;
    height: 24px;
}

.help-icon {
    font-size: 20px;
}

/* Mobile responsive for about/help modals */
@media (max-width: 768px) {
    .about-modal-content,
    .help-modal-content {
        width: 95%;
        max-width: none;
        margin: auto;
    }

    .about-modal-body,
    .help-modal-body {
        height: 75vh;
        min-height: 400px;
    }
}

/* ================================================
   MODERN AI ACTION POPUP (MOBILE) - LIGHT THEME
   ================================================ */

.ai-action-popup {
    position: fixed;
    z-index: 10001;
    display: none;
    pointer-events: none;
}

.ai-action-popup.show {
    display: block;
}

.ai-popup-card {
    position: absolute;
    background: #ffffff;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
                0 2px 8px rgba(0, 0, 0, 0.04),
                0 0 0 1px rgba(0, 0, 0, 0.06);
    width: 280px;
    max-width: calc(100vw - 24px);
    max-height: 380px;
    overflow-y: auto;
    pointer-events: auto;
    transform-origin: top right;
    animation: aiPopupSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-popup-card::-webkit-scrollbar {
    width: 4px;
}

.ai-popup-card::-webkit-scrollbar-track {
    background: transparent;
}

.ai-popup-card::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

@keyframes aiPopupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ai-popup-card.hiding {
    animation: aiPopupSlideOut 0.15s ease-out forwards;
}

@keyframes aiPopupSlideOut {
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
}

.ai-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.ai-popup-title {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.15px;
}

.ai-popup-title svg {
    color: #2563eb;
    flex-shrink: 0;
}

.ai-popup-close {
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.12s ease;
}

.ai-popup-close:active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.94);
}

.ai-popup-actions {
    padding: 6px;
}

.ai-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
    min-height: 46px;
}

.ai-action-btn:active {
    background: rgba(37, 99, 235, 0.06);
    transform: scale(0.98);
}

.ai-action-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.ai-action-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    flex: 1;
}

.ai-action-title {
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.15px;
}

.ai-action-desc {
    color: #6b7280;
    font-size: 11px;
    font-weight: 400;
}

/* Hide desktop circular menu on mobile */
@media (max-width: 768px) {
    .ai-context-menu:not(.desktop-only) {
        display: none !important;
    }
}

/* Hide mobile popup on desktop */
@media (min-width: 769px) {
    .ai-action-popup {
        display: none !important;
    }
}

/* ====================================
   Ollama Bağlantı Durumu Göstergesi
   ==================================== */
.ollama-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background-color: #6c757d;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    cursor: help;
    flex-shrink: 0;
}

.ollama-status-dot.connected {
    background-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: ollama-pulse-green 2s infinite;
}

.ollama-status-dot.disconnected {
    background-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.ollama-status-dot.checking {
    background-color: #f59e0b;
    animation: ollama-pulse-yellow 1s infinite;
}

@keyframes ollama-pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes ollama-pulse-yellow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Dark mode için Ollama status */
body.dark-mode .ollama-status-dot {
    background-color: #4b5563;
}

body.dark-mode .ollama-status-dot.connected {
    background-color: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

body.dark-mode .ollama-status-dot.disconnected {
    background-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

body.dark-mode .ollama-status-dot.checking {
    background-color: #f59e0b;
}