/* Print styles */
        @media print {
            .app-header, .toolbar, .status-bar, .document-header, footer, .cookie-consent, .mobile-menu, .notification {
                display: none !important;
            }
            .editor-container {
                padding: 0;
                max-width: none;
            }
            .editor-content {
                padding: 0;
            }
            .document-page {
                box-shadow: none !important;
                border: none !important;
                margin: 0;
                padding: 0;
                transform: none !important;
            }
            body {
                background-color: white !important;
                color: black !important;
            }
            @page {
                margin: 1.5cm;
            }
        }

        :root {
            /* Updated Color Palette - Modern & Clean */
            --primary: #4361ee;
            --primary-light: #eef2ff;
            --primary-dark: #3a56d4;
            --secondary: #ffc107;
            --red: #ef476f;
            --green: #06d6a0;
            --blue-accent: #4361ee;
            --purple-accent: #7209b7;
            
            /* Neutral Colors */
            --surface-1: #ffffff;
            --surface-2: #f8f9fa;
            --surface-3: #f1f3f4;
            --surface-4: #e8eaed;
            --surface-5: #dadce0;
            
            /* Text Colors */
            --text-primary: #202124;
            --text-secondary: #5f6368;
            --text-tertiary: #80868b;
            --text-disabled: #9aa0a6;
            --text-on-primary: #ffffff;
            
            /* Elevation - Material Design 3 inspired */
            --elevation-1: 0 1px 3px 0 rgba(60, 64, 67, 0.15), 0 1px 2px 0 rgba(60, 64, 67, 0.3);
            --elevation-2: 0 2px 6px 2px rgba(60, 64, 67, 0.15), 0 1px 2px 0 rgba(60, 64, 67, 0.3);
            --elevation-3: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 1px 3px 0 rgba(60, 64, 67, 0.3);
            --elevation-4: 0 6px 10px 4px rgba(60, 64, 67, 0.15), 0 2px 3px 0 rgba(60, 64, 67, 0.3);
            --elevation-5: 0 8px 12px 6px rgba(60, 64, 67, 0.15), 0 4px 4px 0 rgba(60, 64, 67, 0.3);
            
            /* Spacing - consolidated */
            --space-xxs: 2px;
            --space-xs: 4px;
            --space-sm: 8px;
            --space-md: 16px;
            --space-lg: 24px;
            --space-xl: 32px;
            --space-xxl: 48px;
            
            /* Border Radius */
            --radius-xs: 4px;
            --radius-sm: 8px;
            --radius-md: 12px;
            --radius-lg: 16px;
            --radius-xl: 24px;
            --radius-pill: 500px;
            --radius-circle: 50%;
            
            /* Transitions */
            --transition-fast: 0.1s cubic-bezier(0.4, 0, 0.2, 1);
            --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            
            /* Font */
            --font-family-ar: 'Almarai', sans-serif;
            --font-family-en: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
            --font-family: var(--font-family-ar);
            
            /* Z-index layers - FIXED Z-INDEX VALUES */
            --z-base: 1;
            --z-dropdown: 9999;
            --z-modal: 10000;
            --z-toast: 10001;
            --z-sticky: 200;
        }
        
        /* Reset & Base Styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: var(--font-family);
        }
        
        html, body {
            width: 100%;
            height: 100%;
            background-color: var(--surface-2);
            color: var(--text-primary);
            scroll-behavior: smooth;
        }
        
        body {
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
        }
        
        body.rtl {
            direction: rtl;
        }
        
        body.ltr {
            direction: ltr;
        }
        
        /* Typography */
        h1, h2, h3, h4, h5, h6 {
            margin-bottom: var(--space-md);
            font-weight: 700;
            color: var(--text-primary);
            line-height: 1.5;
        }
        
        h1 {
            font-size: clamp(1.25rem, 3vw, 1.5rem);
            font-weight: 600;
        }
        
        h2 {
            font-size: clamp(1.5rem, 4vw, 1.75rem);
        }
        
        h3 {
            font-size: clamp(1.2rem, 3vw, 1.4rem);
        }
        
        p {
            margin-bottom: var(--space-md);
            line-height: 1.6;
        }
        
        /* Layout */
        .container {
            max-width: 1200px;
            width: 100%;
            margin: 0 auto;
            padding: 0 var(--space-md);
        }
        
        main {
            flex: 1;
        }
        
        /* Skip Link for accessibility */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--primary);
            color: white;
            padding: var(--space-sm) var(--space-md);
            z-index: var(--z-toast);
            transition: top 0.3s;
        }
        
        .skip-link:focus {
            top: 0;
        }
        
        /* Header - Fixed layout issues - REDUCED HEIGHT */
        .app-header {
            background-color: var(--primary);
            color: var(--text-on-primary);
            padding: var(--space-sm) 0; /* Reduced from var(--space-md) */
            position: sticky;
            top: 0;
            z-index: var(--z-sticky);
            box-shadow: var(--elevation-2);
        }
        
        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--space-md);
        }
        
        .app-logo {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            color: var(--text-on-primary);
            text-decoration: none;
        }
        
        .app-logo svg {
            width: 32px; /* Reduced from 40px */
            height: 32px; /* Reduced from 40px */
            fill: white;
        }
        
        .logo-text {
            display: flex;
            flex-direction: column;
        }
        
        .app-title {
            font-size: 1.3rem; /* Reduced from 1.5rem */
            font-weight: 700;
            line-height: 1;
            margin: 0;
            color: white;
        }
        
        .app-subtitle {
            font-size: 0.8rem; /* Reduced from 0.9rem */
            color: rgba(255, 255, 255, 0.9);
            font-weight: 400;
        }
        
        /* Header actions container */
        .header-actions {
            display: flex;
            align-items: center;
            gap: var(--space-md);
        }
        
        /* Navigation */
        .app-nav {
            display: flex;
            align-items: center;
            gap: var(--space-md);
            background-color: rgba(255, 255, 255, 0.15);
            border-radius: var(--radius-pill);
            padding: var(--space-xs) var(--space-sm);
        }
        
        .nav-link {
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
            font-weight: 500;
            padding: var(--space-sm) var(--space-md);
            position: relative;
            transition: color var(--transition-normal);
            border-radius: var(--radius-pill);
            white-space: nowrap;
        }
        
        .nav-link:hover, .nav-link:focus {
            color: white;
            background-color: rgba(255, 255, 255, 0.2);
            outline: none;
        }
        
        .nav-link.active {
            color: var(--primary);
            background-color: white;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
        }
        
        /* Mobile menu toggle button */
        .mobile-toggle {
            display: none;
            background: rgba(255, 255, 255, 0.1);
            border: 2px solid rgba(255, 255, 255, 0.3);
            color: white;
            cursor: pointer;
            padding: var(--space-sm);
            border-radius: var(--radius-md);
            transition: all var(--transition-normal);
            min-width: 44px;
            min-height: 44px;
            align-items: center;
            justify-content: center;
        }
        
        .mobile-toggle:hover, .mobile-toggle:focus {
            background-color: rgba(255, 255, 255, 0.2);
            border-color: rgba(255, 255, 255, 0.5);
            transform: scale(1.05);
        }
        
        .mobile-toggle .material-icons-round {
            font-size: 1.5rem;
        }
        
        /* Language Switch Button */
        .language-switch {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: var(--radius-pill);
            padding: var(--space-sm) var(--space-md);
            color: white;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.95rem;
            transition: all var(--transition-normal);
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            min-height: 44px;
            text-decoration: none;
        }
        
        .language-switch:hover, .language-switch:focus {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.25) 100%);
            border-color: rgba(255, 255, 255, 0.5);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            transform: translateY(-1px);
            outline: none;
            color: white;
        }
        
        /* Editor specific styles - ENHANCED FOR MAXIMUM SPACE */
        .editor-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            width: 100%;
            height: calc(100vh - 90px); /* Reduced from 140px for more editor space */
            background-color: var(--surface-2);
        }
        
        /* Document Header - More Compact */
        .document-header {
            background-color: var(--surface-1);
            padding: var(--space-xs) var(--space-md); /* Reduced padding */
            border-bottom: 1px solid var(--surface-4);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--space-md);
            flex-wrap: wrap;
            min-height: 45px; /* Reduced from 60px */
        }
        
        .document-info {
            display: flex;
            align-items: center;
            gap: var(--space-md);
            flex: 1;
        }
        
        .document-title {
            background: none;
            border: none;
            font-size: 1rem; /* Reduced from 1.1rem */
            font-weight: 600;
            color: var(--text-primary);
            padding: var(--space-xs) var(--space-sm);
            border-radius: var(--radius-sm);
            min-width: 200px;
            border: 1px solid transparent;
        }
        
        .document-title:focus {
            background-color: var(--surface-2);
            outline: none;
            border-color: var(--primary);
        }
        
        .document-stats {
            display: flex;
            align-items: center;
            gap: var(--space-md);
            color: var(--text-secondary);
            font-size: 0.8rem; /* Reduced from 0.85rem */
        }
        
        .stat-item {
            display: flex;
            align-items: center;
            gap: var(--space-xs);
        }
        
        .document-actions {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
        }
        
        /* Toolbar - More Compact */
        .toolbar {
            background-color: var(--surface-1);
            padding: var(--space-xs) var(--space-md); /* Reduced padding */
            border-bottom: 1px solid var(--surface-4);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            flex-wrap: wrap;
            overflow-x: auto;
            min-height: 40px; /* Reduced from 50px */
            position: relative;
            z-index: 50; /* Lower than dropdowns */
        }
        
        .toolbar-group {
            display: flex;
            align-items: center;
            gap: var(--space-xs);
            padding: 0 var(--space-sm);
            border-left: 1px solid var(--surface-4);
        }
        
        body.ltr .toolbar-group {
            border-left: none;
            border-right: 1px solid var(--surface-4);
        }
        
        .toolbar-group:first-child {
            border-left: none;
            padding-left: 0;
        }
        
        body.ltr .toolbar-group:first-child {
            border-right: none;
            padding-right: 0;
        }
        
        .toolbar-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 30px; /* Reduced from 32px */
            height: 30px; /* Reduced from 32px */
            border: none;
            background: none;
            color: var(--text-secondary);
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all var(--transition-normal);
            position: relative;
        }
        
        .toolbar-btn:hover {
            background-color: var(--surface-3);
            color: var(--text-primary);
        }
        
        .toolbar-btn.active {
            background-color: var(--primary-light);
            color: var(--primary);
        }
        
        .toolbar-select {
            border: 1px solid var(--surface-4);
            border-radius: var(--radius-sm);
            padding: var(--space-xs) var(--space-sm);
            background-color: var(--surface-1);
            color: var(--text-primary);
            cursor: pointer;
            min-width: 80px;
            font-size: 0.9rem;
            height: 30px; /* Reduced from 32px */
        }
        
        .toolbar-select:focus {
            border-color: var(--primary);
            outline: none;
        }
        
        .color-picker {
            width: 20px;
            height: 20px;
            border: 2px solid var(--surface-4);
            border-radius: var(--radius-xs);
            cursor: pointer;
            margin: var(--space-xs);
        }
        
        /* Editor Area - MAXIMUM SPACE UTILIZATION */
        .editor-area {
            background-color: var(--surface-2);
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        .ruler {
            height: 16px; /* Reduced from 20px */
            background-color: var(--surface-1);
            border-bottom: 1px solid var(--surface-4);
            position: relative;
            overflow: hidden;
        }
        
        .ruler-marks {
            height: 100%;
            background-image: repeating-linear-gradient(
                to right,
                var(--surface-4) 0,
                var(--surface-4) 1px,
                transparent 1px,
                transparent 40px
            );
        }
        
        .editor-content {
            flex: 1;
            overflow-y: auto;
            position: relative;
            padding: var(--space-md) 0; /* Reduced from var(--space-lg) */
            background-color: var(--surface-3);
        }
        
        .pages-container {
            max-width: 900px;
            margin: 0 auto;
            padding: 0 var(--space-md);
        }

        .document-page {
            width: 816px;
            min-height: 1400px; /* INCREASED from 1056px for much taller pages */
            margin: 0 auto var(--space-md) auto; /* Reduced margin between pages */
            padding: 80px; /* Reduced from 96px to give more writing space */
            background-color: white;
            box-shadow: var(--elevation-2);
            border-radius: var(--radius-xs);
            position: relative;
            transform-origin: top center;
            border-bottom: 2px dashed var(--surface-4); /* Reduced from 3px */
            page-break-after: always;
            break-after: page;
        }
        
        .document-page:last-child {
            border-bottom: none;
        }
        
        .document-page::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border: 1px solid var(--surface-4);
            border-radius: var(--radius-xs);
            pointer-events: none;
        }
        
        /* PAGE BREAK VISUAL INDICATOR */
        .document-page::after {
            content: attr(data-page-number);
            position: absolute;
            bottom: -20px; /* Reduced from -25px */
            left: 50%;
            transform: translateX(-50%);
            background: var(--surface-4);
            color: var(--text-secondary);
            padding: 2px 8px; /* Reduced padding */
            border-radius: var(--radius-pill);
            font-size: 11px; /* Reduced from 12px */
            font-weight: 500;
            z-index: 1;
        }
        
        .page-break {
            page-break-before: always;
            break-before: page;
        }
        
        .page-break-line {
            position: absolute;
            bottom: -10px; /* Adjusted for smaller margin */
            left: 50%;
            transform: translateX(-50%);
            width: 90%;
            height: 2px;
            background: linear-gradient(to right, transparent, var(--surface-4), transparent);
            pointer-events: none;
        }
        
        /* ENHANCED EDITOR UI - MUCH TALLER AND MORE SPACIOUS */
        .editor {
            width: 100%;
            min-height: 1600px; /* SIGNIFICANTLY INCREASED from 1000px */
            border: none;
            outline: none;
            font-family: 'Times New Roman', serif;
            font-size: 14px;
            line-height: 1.6;
            color: var(--text-primary);
            resize: none;
            background: transparent;
            overflow: visible;
            padding: 30px 0; /* Increased from 20px for more breathing room */
            cursor: text;
            position: relative;
        }
        
        /* REMOVE ALL CONTENTEDITABLE BORDERS */
        .editor:focus {
            outline: none !important;
            border: none !important;
            box-shadow: none !important;
        }
        
        .editor[contenteditable]:focus {
            outline: none !important;
            border: none !important;
        }
        
        /* SMOOTH TEXT SELECTION */
        .editor::selection {
            background-color: rgba(67, 97, 238, 0.2);
            color: var(--text-primary);
        }
        
        .editor ::-moz-selection {
            background-color: rgba(67, 97, 238, 0.2);
            color: var(--text-primary);
        }
        
        /* Enhanced selection for better visibility */
        .editor *::selection {
            background-color: rgba(67, 97, 238, 0.2);
            color: inherit;
        }
        
        .editor *::-moz-selection {
            background-color: rgba(67, 97, 238, 0.2);
            color: inherit;
        }
        
        /* SMOOTH CURSOR */
        .editor {
            caret-color: var(--primary);
        }
        
        .editor:empty::before {
            content: attr(data-placeholder);
            color: #999;
            cursor: text;
            position: absolute;
            top: 30px; /* Adjusted for new padding */
            left: 0;
            right: 0;
            pointer-events: none;
        }
        
        /* Better word selection */
        .editor {
            user-select: text;
            -webkit-user-select: text;
            -moz-user-select: text;
            -ms-user-select: text;
        }
        
        /* Better paragraph spacing */
        .editor p {
            margin: 0 0 16px 0; /* Increased from 12px for better spacing */
            min-height: 1.4em;
        }
        
        .editor p:last-child {
            margin-bottom: 0;
        }
        
        /* ENHANCED LINE SPACING STYLES - FIXED */
        .editor .line-spacing-1 {
            line-height: 1.0 !important;
        }
        
        .editor .line-spacing-1-5 {
            line-height: 1.5 !important;
        }
        
        .editor .line-spacing-2 {
            line-height: 2.0 !important;
        }
        
        /* GLOBAL LINE SPACING CLASSES - FIXED */
        .line-spacing-single,
        .line-spacing-single * {
            line-height: 1.0 !important;
        }
        
        .line-spacing-onehalf,
        .line-spacing-onehalf * {
            line-height: 1.5 !important;
        }
        
        .line-spacing-double,
        .line-spacing-double * {
            line-height: 2.0 !important;
        }
        
        /* ENHANCED HEADER STYLES - FIXED */
        .editor h1 {
            font-size: 32px !important;
            font-weight: bold !important;
            margin: 24px 0 16px 0 !important;
            line-height: 1.2 !important;
            color: var(--text-primary) !important;
        }
        
        .editor h2 {
            font-size: 24px !important;
            font-weight: bold !important;
            margin: 20px 0 12px 0 !important;
            line-height: 1.3 !important;
            color: var(--text-primary) !important;
        }
        
        .editor h3 {
            font-size: 20px !important;
            font-weight: bold !important;
            margin: 16px 0 10px 0 !important;
            line-height: 1.4 !important;
            color: var(--text-primary) !important;
        }
        
        .editor h4 {
            font-size: 18px !important;
            font-weight: bold !important;
            margin: 14px 0 8px 0 !important;
            line-height: 1.4 !important;
            color: var(--text-primary) !important;
        }
        
        .editor h5 {
            font-size: 16px !important;
            font-weight: bold !important;
            margin: 12px 0 6px 0 !important;
            line-height: 1.4 !important;
            color: var(--text-primary) !important;
        }
        
        .editor h6 {
            font-size: 14px !important;
            font-weight: bold !important;
            margin: 10px 0 4px 0 !important;
            line-height: 1.4 !important;
            color: var(--text-primary) !important;
        }
        
        /* Blockquote styles */
        .editor blockquote {
            border-left: 4px solid var(--primary);
            margin: 16px 0;
            padding: 12px 16px;
            background-color: var(--surface-2);
            font-style: italic;
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
        }
        
        body.ltr .editor blockquote {
            border-left: none;
            border-right: 4px solid var(--primary);
            border-radius: var(--radius-sm) 0 0 var(--radius-sm);
        }
        
        /* Code formatting */
        .editor code {
            background-color: var(--surface-3);
            padding: 2px 6px;
            border-radius: var(--radius-xs);
            font-family: 'Courier New', monospace;
            font-size: 0.9em;
            color: var(--purple-accent);
        }
        
        .editor pre {
            background-color: var(--surface-3);
            padding: 16px;
            border-radius: var(--radius-sm);
            overflow-x: auto;
            margin: 16px 0;
            border: 1px solid var(--surface-4);
        }
        
        .editor pre code {
            background: none;
            padding: 0;
            border-radius: 0;
        }
        
        /* List improvements */
        .editor ul, .editor ol {
            margin: 12px 0;
            padding-right: 24px;
        }
        
        body.ltr .editor ul, 
        body.ltr .editor ol {
            padding-right: 0;
            padding-left: 24px;
        }
        
        .editor li {
            margin-bottom: 6px;
            line-height: 1.6;
        }
        
        /* Table improvements */
        .editor table {
            border-collapse: collapse;
            width: 100%;
            margin: 16px 0;
            border: 1px solid var(--surface-4);
        }
        
        .editor th, .editor td {
            border: 1px solid var(--surface-4);
            padding: 12px;
            text-align: right;
            vertical-align: top;
        }
        
        body.ltr .editor th, 
        body.ltr .editor td {
            text-align: left;
        }
        
        .editor th {
            background-color: var(--surface-3);
            font-weight: bold;
        }
        
        /* Link styling */
        .editor a {
            color: var(--primary);
            text-decoration: underline;
            cursor: pointer;
        }
        
        .editor a:hover {
            color: var(--primary-dark);
        }
        
        /* Image styling */
        .editor img {
            max-width: 100%;
            height: auto;
            margin: 16px 0;
            border-radius: var(--radius-sm);
            box-shadow: var(--elevation-1);
        }
        
        /* Horizontal rule */
        .editor hr {
            border: none;
            border-top: 2px solid var(--surface-4);
            margin: 24px 0;
        }
        
        /* DYNAMIC PAGE MANAGEMENT */
        .page-indicator {
            position: absolute;
            bottom: 10px;
            right: 10px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 4px 8px;
            border-radius: var(--radius-sm);
            font-size: 12px;
            pointer-events: none;
        }
        
        body.ltr .page-indicator {
            right: auto;
            left: 10px;
        }
        
        .document-page.empty {
            display: none;
        }
        
        /* Smooth scrolling */
        .editor-content {
            scroll-behavior: smooth;
        }
        
        /* Remove any webkit appearance */
        .editor {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
        }
        
        /* Status Bar - More Compact */
        .status-bar {
            background-color: var(--surface-1);
            padding: var(--space-xs) var(--space-md);
            border-top: 1px solid var(--surface-4);
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.75rem; /* Reduced from 0.8rem */
            color: var(--text-secondary);
            min-height: 24px; /* Reduced from 30px */
        }
        
        .status-left,
        .status-right {
            display: flex;
            align-items: center;
            gap: var(--space-md);
        }
        
        .zoom-control {
            display: flex;
            align-items: center;
            gap: var(--space-xs);
        }
        
        .zoom-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: var(--space-xs);
            border-radius: var(--radius-xs);
            width: 20px; /* Reduced from 24px */
            height: 20px; /* Reduced from 24px */
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .zoom-btn:hover {
            background-color: var(--surface-3);
        }
        
        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-sm);
            padding: var(--space-sm) var(--space-md);
            font-weight: 600;
            font-size: 0.9rem;
            border: none;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all var(--transition-normal);
            text-decoration: none;
            min-height: 36px;
        }
        
        .btn-primary {
            background-color: var(--primary);
            color: white;
            box-shadow: 0 2px 5px rgba(67, 97, 238, 0.3);
        }
        
        .btn-primary:hover {
            background-color: var(--primary-dark);
            box-shadow: 0 4px 8px rgba(67, 97, 238, 0.4);
            transform: translateY(-1px);
        }
        
        .btn-outline {
            background-color: transparent;
            border: 1px solid var(--surface-4);
            color: var(--text-secondary);
        }
        
        .btn-outline:hover {
            border-color: var(--primary);
            color: var(--primary);
        }
        
        .btn-success {
            background-color: var(--green);
            color: white;
            box-shadow: 0 2px 5px rgba(6, 214, 160, 0.3);
        }
        
        .btn-success:hover {
            background-color: #05c090;
            box-shadow: 0 4px 8px rgba(6, 214, 160, 0.4);
            transform: translateY(-1px);
        }
        
        .btn-danger {
            background-color: var(--red);
            color: white;
            box-shadow: 0 2px 5px rgba(239, 71, 111, 0.3);
        }
        
        .btn-danger:hover {
            background-color: #e63e69;
            box-shadow: 0 4px 8px rgba(239, 71, 111, 0.4);
            transform: translateY(-1px);
        }
        
        /* COMPLETELY FIXED DROPDOWN SYSTEM */
        .dropdown {
            position: relative;
            display: inline-block;
        }
        
        .dropdown-content {
            display: none;
            position: fixed; /* Changed to fixed for better positioning */
            background-color: var(--surface-1);
            min-width: 200px;
            box-shadow: var(--elevation-4);
            border-radius: var(--radius-md);
            z-index: var(--z-dropdown);
            overflow: hidden;
            border: 1px solid var(--surface-4);
            max-height: 400px;
            overflow-y: auto;
        }
        
        .dropdown.active .dropdown-content {
            display: block;
        }
        
        .dropdown-item {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            padding: var(--space-sm) var(--space-md);
            color: var(--text-primary);
            cursor: pointer;
            transition: background-color var(--transition-normal);
            white-space: nowrap;
            text-decoration: none;
        }
        
        .dropdown-item:hover {
            background-color: var(--surface-2);
        }
        
        .dropdown-separator {
            height: 1px;
            background-color: var(--surface-4);
            margin: var(--space-xs) 0;
        }
        
        /* Modal */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: var(--z-modal);
        }
        
        .modal-overlay.active {
            display: flex;
        }
        
        .modal {
            background-color: var(--surface-1);
            border-radius: var(--radius-lg);
            padding: var(--space-xl);
            max-width: 500px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: var(--space-lg);
        }
        
        .modal-title {
            font-size: 1.2rem;
            font-weight: 700;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-secondary);
        }
        
        .modal-body {
            margin-bottom: var(--space-lg);
        }
        
        .modal-footer {
            display: flex;
            gap: var(--space-sm);
            justify-content: flex-end;
        }
        
        .form-group {
            margin-bottom: var(--space-md);
        }
        
        .form-label {
            display: block;
            margin-bottom: var(--space-xs);
            font-weight: 600;
            color: var(--text-primary);
        }
        
        .form-control {
            width: 100%;
            padding: var(--space-sm);
            border: 1px solid var(--surface-4);
            border-radius: var(--radius-sm);
            font-size: 1rem;
        }
        
        .form-control:focus {
            border-color: var(--primary);
            outline: none;
        }
        
        /* Notification */
        .notification {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(-100px);
            background-color: var(--surface-1);
            border-radius: var(--radius-md);
            padding: var(--space-md) var(--space-lg);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            box-shadow: var(--elevation-4);
            z-index: var(--z-toast);
            opacity: 0;
            transition: all var(--transition-normal);
            max-width: 90%;
            width: auto;
        }
        
        .notification.success {
            border-right: 4px solid var(--green);
        }
        
        .notification.error {
            border-right: 4px solid var(--red);
        }
        
        body.ltr .notification.success {
            border-right: none;
            border-left: 4px solid var(--green);
        }
        
        body.ltr .notification.error {
            border-right: none;
            border-left: 4px solid var(--red);
        }
        
        .notification.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }
        
        .notification-icon {
            color: var(--green);
        }
        
        .notification.error .notification-icon {
            color: var(--red);
        }
        
        .notification-message {
            flex: 1;
            font-weight: 600;
        }
        
        .notification-close {
            margin-right: var(--space-md);
            cursor: pointer;
            color: var(--text-tertiary);
            transition: color var(--transition-normal);
        }
        
        body.ltr .notification-close {
            margin-right: 0;
            margin-left: var(--space-md);
        }
        
        .notification-close:hover {
            color: var(--text-primary);
        }
        
        /* Mobile menu */
        .mobile-menu-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
             pointer-events: none;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 999;
            opacity: 0;
            visibility: hidden;
            transition: all var(--transition-normal);
        }
        
        .mobile-menu-overlay.open {
            opacity: 1;
            visibility: visible;
              pointer-events: all;
        }
        
        .mobile-menu {
            position: fixed;
            top: 0;
            right: 0;
            width: 80%;
             max-width: 85vw;
            max-width: 300px;
            height: 100%;
            background-color: var(--surface-1);
            box-shadow: var(--elevation-4);
            transform: translateX(100%);
            transition: transform var(--transition-slow);
            z-index: 1000;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
        }
        
        body.ltr .mobile-menu {
            right: auto;
            left: 0;
            transform: translateX(-100%);
        }
        
        .mobile-menu.open {
            transform: translateX(0);
        }
        
        .mobile-menu-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: var(--space-md);
            background-color: var(--primary);
            color: white;
        }
        
        .mobile-menu-close {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            padding: var(--space-xs);
            border-radius: var(--radius-circle);
            transition: background-color var(--transition-normal);
        }
        
        .mobile-menu-close:hover, .mobile-menu-close:focus {
            background-color: rgba(255, 255, 255, 0.2);
            outline: none;
        }
        
        .mobile-menu-body {
            padding: var(--space-md);
            flex: 1;
        }
        
        .mobile-nav {
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
        }
        
        .mobile-nav-link {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            padding: var(--space-md);
            text-decoration: none;
            color: var(--text-primary);
            border-radius: var(--radius-md);
            transition: all var(--transition-normal);
            font-weight: 500;
        }
        
        .mobile-nav-link:hover, .mobile-nav-link:focus {
            background-color: var(--surface-2);
            outline: none;
        }
        
        .mobile-nav-link.active {
            background-color: var(--primary-light);
            color: var(--primary);
            font-weight: 600;
        }
        
        .mobile-nav-link .material-icons-round {
            font-size: 1.2rem;
            color: var(--text-tertiary);
        }
        
        .mobile-nav-link.active .material-icons-round {
            color: var(--primary);
        }
        
        /* Cookie Consent */
        .cookie-consent {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: var(--surface-1);
            padding: var(--space-lg);
            z-index: var(--z-modal);
            box-shadow: var(--elevation-3);
            transform: translateY(100%);
            transition: transform var(--transition-normal);
        }
        
        .cookie-consent.show {
            transform: translateY(0);
        }
        
        .cookie-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--space-lg);
            max-width: 1200px;
            margin: 0 auto;
        }
        
        .cookie-text {
            flex: 1;
        }
        
        .cookie-text p {
            margin-bottom: 0;
        }
        
        .cookie-buttons {
            display: flex;
            gap: var(--space-md);
        }
        
        /* Footer */
        .footer {
            background-color: var(--primary);
            padding: var(--space-xl) 0;
            color: white;
        }
        
        .footer-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }
        
        .footer-links {
            display: flex;
            gap: var(--space-lg);
            margin-bottom: var(--space-md);
            flex-wrap: wrap;
            justify-content: center;
        }
        
        .footer-link {
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
            transition: color var(--transition-normal);
            font-weight: 500;
            padding: var(--space-xs) var(--space-sm);
        }
        
        .footer-link:hover, .footer-link:focus {
            color: white;
            text-decoration: underline;
            outline: none;
        }
        
        .footer-copyright {
            color: rgba(255, 255, 255, 0.8);
            font-size: 0.9rem;
        }
        
        /* SEO Content Section */
        .seo-content {
            margin: var(--space-xl) 0;
            padding: var(--space-xl);
            background-color: var(--surface-1);
            border-radius: var(--radius-lg);
            box-shadow: var(--elevation-1);
            border: 1px solid var(--surface-4);
        }
        
        .seo-content h2 {
            color: var(--primary);
            font-size: clamp(1.3rem, 3.5vw, 1.6rem);
            margin-bottom: var(--space-lg);
            line-height: 1.4;
            border-bottom: 2px solid var(--primary-light);
            padding-bottom: var(--space-md);
        }
        
        .seo-content h3 {
            color: var(--primary-dark);
            font-size: clamp(1.1rem, 2.5vw, 1.3rem);
            margin-top: var(--space-lg);
            margin-bottom: var(--space-md);
        }
        
        .seo-content p {
            line-height: 1.8;
            margin-bottom: var(--space-md);
            color: var(--text-primary);
            font-size: 1rem;
        }
        
        .seo-content ul {
            list-style: none;
            padding: 0;
            margin: var(--space-md) 0;
        }
        
        .seo-content ul li {
            position: relative;
            padding-right: var(--space-xl);
            margin-bottom: var(--space-sm);
            line-height: 1.6;
        }
        
        body.ltr .seo-content ul li {
            padding-right: 0;
            padding-left: var(--space-xl);
        }
        
        .seo-content ul li::before {
            content: '✓';
            position: absolute;
            right: 0;
            top: 0;
            color: var(--green);
            font-weight: bold;
            font-size: 1.2rem;
        }
        
        body.ltr .seo-content ul li::before {
            right: auto;
            left: 0;
        }
        
        .seo-content strong {
            color: var(--primary-dark);
            font-weight: 700;
        }
        
        /* ENHANCED RESPONSIVE FOR TALLER EDITOR */
        @media (max-width: 768px) {
            .app-nav {
                display: none !important;
            }
            
            .mobile-toggle {
                display: flex !important;
            }
            
            .app-subtitle {
                display: none;
            }
            
            .document-header {
                flex-direction: column;
                align-items: stretch;
                padding: var(--space-xs);
                min-height: 35px; /* Further reduced */
            }
            
            .document-stats {
                justify-content: center;
                font-size: 0.75rem; /* Further reduced */
            }
            
            .toolbar {
                flex-wrap: wrap;
                gap: var(--space-xs);
                padding: var(--space-xs);
                min-height: 35px; /* Further reduced */
            }
            
            .toolbar-group {
                border: none;
                padding: 0;
            }
            
            .editor-container {
                height: calc(100vh - 70px); /* Significantly reduced from 100px */
            }
            
            .document-page {
                padding: var(--space-md);
                margin: 0 var(--space-sm) var(--space-sm) var(--space-sm); /* Reduced margin */
                max-width: calc(100% - 2 * var(--space-sm));
                width: calc(100% - 2 * var(--space-sm));
                min-height: 1200px; /* Increased from mobile default for taller mobile editing */
            }
            
            .editor {
                min-height: 1200px; /* Significantly increased for mobile */
                font-size: 16px;
                padding: var(--space-md) 0; /* Reduced padding to save space */
            }
            
            .modal {
                margin: var(--space-sm); /* Reduced from var(--space-md) */
                width: calc(100% - 2 * var(--space-sm));
            }
            
            .footer-links {
                flex-wrap: wrap;
                justify-content: center;
                gap: var(--space-md);
            }
            
            .cookie-content {
                flex-direction: column;
                align-items: stretch;
            }
            
            .cookie-buttons {
                margin-top: var(--space-md);
            }
            
            .seo-content {
                padding: var(--space-md);
            }
            
            .seo-content h2 {
                font-size: 1.1rem; /* Further reduced */
            }
            
            .seo-content h3 {
                font-size: 1rem; /* Further reduced */
            }
            
            .status-bar {
                min-height: 20px; /* Further reduced */
                font-size: 0.7rem; /* Further reduced */
                padding: 2px var(--space-sm); /* Minimal padding */
            }
        }
        
        /* Animations */
        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateX(-50%) translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
        }
        
        /* Loading indicator for file operations */
        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 2px solid var(--surface-4);
            border-radius: 50%;
            border-top-color: var(--primary);
            animation: spin 1s ease-in-out infinite;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        /* File drop zone */
        .editor.drag-over {
            background-color: var(--primary-light);
            border: 2px dashed var(--primary);
        }
        
        /* Focus styles */
        :focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }
        
        
/* Enhanced Mobile Responsive CSS - Key Improvements */
@media screen and (max-width: 768px) {
    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* Improved header for mobile */
    .header-content {
        flex-wrap: wrap;
        gap: var(--space-xs); /* Further reduced */
        padding: var(--space-xs) 0; /* Further reduced */
    }
    
    .app-logo {
        flex: 1;
        min-width: 0;
    }
    
    .app-title {
        font-size: 1rem; /* Further reduced */
    }
    
    .app-subtitle {
        font-size: 0.7rem; /* Further reduced */
    }
    
    /* Hide desktop navigation completely on mobile */
    .app-nav {
        display: none !important;
    }
    
    /* Show mobile toggle */
    .mobile-toggle {
        display: flex !important;
        min-width: 40px; /* Reduced from 48px */
        min-height: 40px; /* Reduced from 48px */
        touch-action: manipulation;
    }
    
    /* Compact language switch for mobile */
    .language-switch {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.8rem; /* Further reduced */
        min-height: 36px; /* Reduced from 40px */
    }
    
    /* Mobile-optimized toolbar */
    .toolbar {
        flex-wrap: wrap;
        padding: 2px; /* Minimal padding */
        gap: 2px; /* Minimal gap */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        min-height: 32px; /* Further reduced */
    }
    
    .toolbar::-webkit-scrollbar {
        display: none;
    }
    
    /* Collapsible toolbar groups */
    .toolbar-group {
        flex-shrink: 0;
        border: none;
        padding: 0;
        gap: 1px; /* Minimal gap */
    }
    
    /* Larger touch targets for mobile */
    .toolbar-btn {
        width: 36px; /* Reduced from 40px */
        height: 36px; /* Reduced from 40px */
        min-width: 36px;
        min-height: 36px;
        touch-action: manipulation;
        border-radius: var(--radius-xs); /* Smaller radius */
    }
    
    .toolbar-btn .material-icons-round {
        font-size: 18px; /* Reduced from 20px */
    }
    
    /* Mobile-friendly selects */
    .toolbar-select {
        min-width: 60px; /* Reduced from 70px */
        height: 36px; /* Reduced from 40px */
        font-size: 0.8rem; /* Further reduced */
        touch-action: manipulation;
    }
    
    /* Compact document header */
    .document-header {
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-xs);
        gap: var(--space-xs); /* Reduced gap */
        min-height: 30px; /* Further reduced */
    }
    
    .document-info {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-xs); /* Reduced gap */
    }
    
    .document-title {
        font-size: 0.9rem; /* Further reduced */
        padding: var(--space-xs); /* Reduced padding */
        text-align: center;
    }
    
    .document-stats {
        justify-content: center;
        flex-wrap: wrap;
        font-size: 0.7rem; /* Further reduced */
        gap: var(--space-xs); /* Reduced gap */
    }
    
    .document-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Mobile editor optimizations - MAXIMUM HEIGHT */
    .editor-container {
        height: calc(100vh - 60px); /* Significantly reduced for maximum editor space */
    }
    
    .editor-content {
        padding: var(--space-xs) 0; /* Minimal padding */
    }
    
    .pages-container {
        padding: 0 var(--space-xs); /* Minimal padding */
        max-width: 100%;
    }
    
    .document-page {
        width: 100%;
        max-width: 100%;
        margin: 0 0 var(--space-xs) 0; /* Minimal margin */
        padding: var(--space-sm); /* Reduced padding */
        box-shadow: var(--elevation-1);
        border-radius: var(--radius-xs);
        min-height: 1000px; /* Tall mobile editor */
    }
    
    /* Mobile editor with better touch handling - TALLER */
    .editor {
        font-size: 16px !important; /* Prevents zoom on iOS */
        line-height: 1.5;
        min-height: 1000px; /* Much taller for mobile */
        padding: var(--space-sm); /* Minimal padding */
        -webkit-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    
    /* Better mobile dropdowns */
    .dropdown-content {
        position: fixed;
        top: auto !important;
        bottom: 10px;
        left: 10px;
        right: 10px;
        width: calc(100vw - 20px);
        max-width: none;
        max-height: 50vh;
        border-radius: var(--radius-lg);
        box-shadow: var(--elevation-5);
    }
    
    .dropdown-item {
        padding: var(--space-md);
        font-size: 1rem;
        min-height: 48px;
        touch-action: manipulation;
    }
    
    /* Mobile modal improvements */
    .modal {
        margin: var(--space-xs); /* Reduced margin */
        width: calc(100vw - 2 * var(--space-xs));
        max-width: none;
        max-height: calc(100vh - 2 * var(--space-xs));
        border-radius: var(--radius-lg);
    }
    
    .modal-header {
        padding: var(--space-sm); /* Reduced padding */
        border-bottom: 1px solid var(--surface-4);
    }
    
    .modal-body {
        padding: var(--space-sm); /* Reduced padding */
    }
    
    .modal-footer {
        padding: var(--space-sm); /* Reduced padding */
        gap: var(--space-xs); /* Reduced gap */
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile form controls */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--space-sm); /* Reduced padding */
        min-height: 44px; /* Minimum touch target */
        touch-action: manipulation;
    }
    
    /* Status bar mobile optimization - MINIMAL */
    .status-bar {
        flex-wrap: wrap;
        gap: var(--space-xs); /* Reduced gap */
        padding: 2px var(--space-xs); /* Minimal padding */
        font-size: 0.65rem; /* Further reduced */
        min-height: 18px; /* Minimal height */
    }
    
    .status-left,
    .status-right {
        flex: 1;
        justify-content: center;
        gap: var(--space-xs); /* Reduced gap */
        flex-wrap: wrap;
    }
    
    .zoom-control {
        gap: var(--space-xs); /* Reduced gap */
    }
    
    .zoom-btn {
        width: 28px; /* Reduced from 32px */
        height: 28px; /* Reduced from 32px */
        touch-action: manipulation;
    }
    
    /* Mobile cookie consent */
    .cookie-consent {
        padding: var(--space-sm); /* Reduced padding */
    }
    
    .cookie-content {
        flex-direction: column;
        gap: var(--space-sm); /* Reduced gap */
        text-align: center;
    }
    
    .cookie-buttons {
        flex-direction: column;
        gap: var(--space-xs); /* Reduced gap */
    }
    
    .cookie-buttons .btn {
        width: 100%;
    }
    
    /* SEO content mobile optimization */
    .seo-content {
        margin: var(--space-sm) 0; /* Reduced margin */
        padding: var(--space-sm); /* Reduced padding */
    }
    
    .seo-content h2 {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    .seo-content h3 {
        font-size: 1rem;
        margin-top: var(--space-sm); /* Reduced margin */
    }
    
    .seo-content p {
        font-size: 0.85rem; /* Further reduced */
        line-height: 1.5; /* Reduced line height */
    }
    
    .seo-content ul li {
        font-size: 0.85rem; /* Further reduced */
        padding-right: var(--space-md); /* Reduced padding */
        margin-bottom: 2px; /* Minimal margin */
    }
    
    body.ltr .seo-content ul li {
        padding-left: var(--space-md); /* Reduced padding */
        padding-right: 0;
    }
}

/* Ultra-small screens (phones in portrait) - MAXIMUM EDITOR SPACE */
@media screen and (max-width: 480px) {
    .app-title {
        font-size: 0.9rem; /* Further reduced */
    }
    
    .header-actions {
        gap: 2px; /* Minimal gap */
    }
    
    .language-switch span:not(.material-icons-round) {
        display: none;
    }
    
    .toolbar {
        padding: 1px; /* Minimal padding */
        gap: 1px; /* Minimal gap */
        min-height: 28px; /* Further reduced */
    }
    
    .toolbar-btn {
        width: 32px; /* Further reduced */
        height: 32px; /* Further reduced */
        min-width: 32px;
        min-height: 32px;
    }
    
    .toolbar-btn .material-icons-round {
        font-size: 16px; /* Further reduced */
    }
    
    .toolbar-select {
        min-width: 50px; /* Further reduced */
        height: 32px; /* Further reduced */
        font-size: 0.75rem; /* Further reduced */
    }
    
    .document-page {
        padding: var(--space-xs); /* Minimal padding */
        min-height: 900px; /* Still tall but adjusted for very small screens */
    }
    
    .editor {
        padding: var(--space-xs); /* Minimal padding */
        min-height: 900px; /* Tall but manageable for small screens */
    }
    
    .modal {
        margin: 4px; /* Minimal margin */
        width: calc(100vw - 8px);
    }
    
    .editor-container {
        height: calc(100vh - 50px); /* Maximum space for editor */
    }
}

/* Landscape mobile orientation - OPTIMIZED FOR TYPING */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .editor-container {
        height: calc(100vh - 40px); /* Maximum height for landscape */
    }
    
    .editor {
        min-height: calc(100vh - 100px); /* Adaptive height for landscape */
    }
    
    .toolbar {
        padding: 1px; /* Minimal padding */
        min-height: 24px; /* Very compact */
    }
    
    .toolbar-btn {
        width: 28px; /* Compact for landscape */
        height: 28px; /* Compact for landscape */
    }
    
    .document-header {
        padding: 2px var(--space-xs); /* Very minimal */
        min-height: 20px; /* Very compact */
    }
    
    .status-bar {
        min-height: 16px; /* Very minimal */
        padding: 1px var(--space-xs);
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {
    /* All interactive elements should be at least 44px */
    .toolbar-btn,
    .btn,
    .dropdown button,
    .mobile-toggle,
    .language-switch {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Remove hover effects on touch devices */
    .toolbar-btn:hover,
    .btn:hover,
    .nav-link:hover {
        transform: none;
    }
    
    /* Better focus states for accessibility */
    .toolbar-btn:focus,
    .btn:focus {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }
}

/* Additional mobile enhancements */
.mobile-toolbar-expanded {
    display: none;
    width: 100%;
    margin-top: 4px; /* Reduced */
    padding-top: 4px; /* Reduced */
    border-top: 1px solid var(--surface-4);
    flex-wrap: wrap;
    gap: 2px; /* Reduced */
}

.mobile-quick-actions {
    margin-top: var(--space-md); /* Reduced */
    padding-top: var(--space-md); /* Reduced */
    border-top: 1px solid var(--surface-4);
}

.mobile-action-btn {
    width: 100%;
    padding: var(--space-sm); /* Reduced padding */
    margin-bottom: 4px; /* Reduced margin */
    background: var(--surface-2);
    border: none;
    border-radius: var(--radius-xs); /* Smaller radius */
    text-align: right;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-normal);
}

body.ltr .mobile-action-btn {
    text-align: left;
}

.mobile-action-btn:hover {
    background: var(--surface-3);
}

.mobile-action-btn .material-icons-round {
    margin-left: 4px; /* Reduced margin */
    vertical-align: middle;
}

body.ltr .mobile-action-btn .material-icons-round {
    margin-left: 0;
    margin-right: 4px; /* Reduced margin */
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .material-icons-round {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Accessibility improvements for mobile */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}