
        :root {
            --space-black: #0a0e17;
            --deep-space: #0f1422;
            --cosmic-purple: #6e3bce;
            --nebula-blue: #3b4cc9;
            --starlight: #a0a8d9;
            --galaxy-edge: #1c233f;
            --accent-neon: #00f3ff;
            --text-primary: #ffffff;
            --text-secondary: #b2b7d3;
            --success: #00ff9d;
            --warning: #ffb800;
            --error: #ff2e7a;
        }

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

        body {
            font-family: 'Space Grotesk', sans-serif;
            background: linear-gradient(135deg, var(--space-black) 0%, var(--deep-space) 100%);
            color: var(--text-primary);
            min-height: 100vh;
            overflow-x: hidden;
            position: relative;
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image:
                radial-gradient(circle at 15% 50%, rgba(110, 59, 206, 0.15) 0%, transparent 20%),
                radial-gradient(circle at 85% 30%, rgba(59, 76, 201, 0.1) 0%, transparent 20%),
                radial-gradient(circle at 50% 80%, rgba(160, 168, 217, 0.1) 0%, transparent 20%);
            pointer-events: none;
            z-index: -1;
        }

        .stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: -1;
        }

        .star {
            position: absolute;
            background-color: white;
            border-radius: 50%;
            animation: twinkle 5s infinite;
        }

        @keyframes twinkle {
            0%, 100% { opacity: 0.2; }
            50% { opacity: 1; }
        }

        .container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 0;
            border-bottom: 1px solid var(--galaxy-edge);
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .logo-icon {
            font-size: 28px;
            color: var(--accent-neon);
        }

        .logo h1 {
            font-family: 'Orbitron', sans-serif;
            font-weight: 700;
            font-size: 28px;
            background: linear-gradient(90deg, var(--cosmic-purple), var(--accent-neon));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .ai-status {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
            color: var(--text-secondary);
            background: rgba(27, 35, 63, 0.5);
            padding: 8px 15px;
            border-radius: 20px;
            border: 1px solid var(--galaxy-edge);
        }

        .ai-status-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: var(--success);
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        .main-content {
            display: flex;
            flex: 1;
            gap: 20px;
        }

        .sidebar {
            width: 280px;
            background: rgba(15, 20, 34, 0.7);
            border-radius: 15px;
            padding: 20px;
            border: 1px solid var(--galaxy-edge);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
        }

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

        .sidebar-section h3 {
            font-size: 16px;
            margin-bottom: 15px;
            color: var(--starlight);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .sidebar-icon {
            color: var(--accent-neon);
            font-size: 18px;
        }

        .doc-list {
            list-style: none;
        }

        .doc-item {
            padding: 10px;
            border-radius: 8px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: space-between;
            color: var(--text-secondary);
        }

        .doc-item-content {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
        }

        .doc-item:hover {
            background: rgba(59, 76, 201, 0.2);
            color: var(--text-primary);
        }

        .doc-item.active {
            background: rgba(59, 76, 201, 0.3);
            color: var(--text-primary);
            border-left: 3px solid var(--accent-neon);
        }

        .doc-item-actions {
            display: flex;
            gap: 5px;
        }

        .doc-item-actions button {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 5px;
            border-radius: 4px;
        }

        .doc-item-actions button:hover {
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.1);
        }

        .btn {
            background: linear-gradient(90deg, var(--cosmic-purple), var(--nebula-blue));
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            font-family: 'Space Grotesk', sans-serif;
            font-weight: 500;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(110, 59, 206, 0.4);
        }

        .btn-outline {
            background: transparent;
            border: 1px solid var(--cosmic-purple);
            color: var(--text-primary);
        }

        .btn-outline:hover {
            background: rgba(110, 59, 206, 0.1);
        }

        .editor-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: rgba(15, 20, 34, 0.7);
            border-radius: 15px;
            overflow: hidden;
            border: 1px solid var(--galaxy-edge);
            backdrop-filter: blur(10px);
        }

        .toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 15px;
            border-bottom: 1px solid var(--galaxy-edge);
            background: rgba(15, 20, 34, 0.9);
        }

        .toolbar-group {
            display: flex;
            gap: 5px;
            padding: 0 8px;
            border-right: 1px solid var(--galaxy-edge);
        }

        .toolbar-group:last-child {
            border-right: none;
        }

        .format-btn {
            background: transparent;
            border: 1px solid var(--galaxy-edge);
            color: var(--text-secondary);
            padding: 8px 10px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 14px;
        }

        .format-btn:hover {
            color: var(--text-primary);
            border-color: var(--cosmic-purple);
        }

        .format-btn.active {
            background: rgba(59, 76, 201, 0.2);
            color: var(--text-primary);
            border-color: var(--cosmic-purple);
        }

        select.format-btn {
            appearance: none;
            background: transparent;
            padding-right: 25px;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b2b7d3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 8px center;
        }

        .editor {
            flex: 1;
            padding: 25px;
            overflow-y: auto;
            font-size: 16px;
            line-height: 1.6;
            outline: none;
            color: var(--text-primary);
            min-height: 400px;
        }
        
        .editor:focus {
            outline: none;
        }
        
        .editor-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
            border-top: 1px solid var(--galaxy-edge);
            background: rgba(15, 20, 34, 0.9);
            font-size: 14px;
            color: var(--text-secondary);
        }

        .word-count {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .ai-features {
            display: flex;
            gap: 10px;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(10, 14, 23, 0.8);
            backdrop-filter: blur(5px);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background: var(--deep-space);
            border-radius: 15px;
            padding: 25px;
            width: 90%;
            max-width: 500px;
            border: 1px solid var(--galaxy-edge);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .modal-header h2 {
            font-size: 20px;
            color: var(--text-primary);
        }

        .close-modal {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            font-size: 24px;
            cursor: pointer;
            transition: color 0.3s ease;
        }

        .close-modal:hover {
            color: var(--text-primary);
        }

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

        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: var(--text-secondary);
            font-size: 14px;
        }

        .form-control {
            width: 100%;
            background: rgba(15, 20, 34, 0.7);
            border: 1px solid var(--galaxy-edge);
            border-radius: 8px;
            padding: 12px;
            color: var(--text-primary);
            font-family: 'Space Grotesk', sans-serif;
        }

        .form-control:focus {
            outline: none;
            border-color: var(--cosmic-purple);
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 20px;
        }

        .toast {
            position: fixed;
            bottom: 20px;
            right: 20px;
            padding: 15px 20px;
            border-radius: 8px;
            background: var(--deep-space);
            border: 1px solid var(--galaxy-edge);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            display: flex;
            align-items: center;
            gap: 10px;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .toast.show {
            transform: translateY(0);
            opacity: 1;
        }

        .toast-success {
            border-left: 3px solid var(--success);
        }

        .toast-error {
            border-left: 3px solid var(--error);
        }

        .toast-icon {
            font-size: 18px;
        }

        .toast-success .toast-icon {
            color: var(--success);
        }

        .toast-error .toast-icon {
            color: var(--error);
        }

        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255,255,255,.3);
            border-radius: 50%;
            border-top-color: var(--accent-neon);
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .color-picker {
            position: relative;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .color-option {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid transparent;
        }

        .color-option.active {
            border-color: white;
        }

        .color-palette {
            display: none;
            position: absolute;
            top: 35px;
            left: 0;
            background: var(--deep-space);
            border: 1px solid var(--galaxy-edge);
            border-radius: 8px;
            padding: 10px;
            z-index: 100;
            width: 200px;
            flex-wrap: wrap;
            gap: 5px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

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

        .palette-color {
            width: 20px;
            height: 20px;
            border-radius: 3px;
            cursor: pointer;
            border: 1px solid var(--galaxy-edge);
        }

        .mobile-toggle {
            display: none;
            background: transparent;
            border: 1px solid var(--galaxy-edge);
            color: var(--text-secondary);
            padding: 10px;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 15px;
        }

        .ai-chat-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 350px;
            height: 450px;
            background: var(--deep-space);
            border: 1px solid var(--galaxy-edge);
            border-radius: 15px;
            display: flex;
            flex-direction: column;
            z-index: 999;
            box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
            transform: translateY(calc(100% + 20px));
            transition: transform 0.3s ease;
        }

        .ai-chat-container.open {
            transform: translateY(0);
        }

        .ai-chat-header {
            padding: 15px;
            border-bottom: 1px solid var(--galaxy-edge);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(15, 20, 34, 0.9);
            border-radius: 15px 15px 0 0;
        }

        .ai-chat-header h3 {
            font-size: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .ai-chat-messages {
            flex: 1;
            padding: 15px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .message {
            max-width: 80%;
            padding: 10px 15px;
            border-radius: 15px;
            font-size: 14px;
            line-height: 1.4;
        }

        .message.user {
            align-self: flex-end;
            background: var(--cosmic-purple);
            border-bottom-right-radius: 5px;
        }

        .message.ai {
            align-self: flex-start;
            background: var(--galaxy-edge);
            border-bottom-left-radius: 5px;
        }

        .ai-chat-input {
            padding: 15px;
            border-top: 1px solid var(--galaxy-edge);
            display: flex;
            gap: 10px;
            background: rgba(15, 20, 34, 0.9);
            border-radius: 0 0 15px 15px;
        }

        .ai-chat-input input {
            flex: 1;
            padding: 10px;
            border-radius: 20px;
            border: 1px solid var(--galaxy-edge);
            background: rgba(15, 20, 34, 0.7);
            color: var(--text-primary);
            outline: none;
        }

        .ai-chat-input input:focus {
            border-color: var(--cosmic-purple);
        }

        .ai-chat-input button {
            background: var(--cosmic-purple);
            border: none;
            border-radius: 20px;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: white;
        }

        .ai-chat-toggle {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--cosmic-purple), var(--nebula-blue));
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .insert-media-btn {
            position: relative;
        }

        .media-options {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            background: var(--deep-space);
            border: 1px solid var(--galaxy-edge);
            border-radius: 8px;
            padding: 10px;
            z-index: 100;
            width: 150px;
            flex-direction: column;
            gap: 5px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        .media-options.show {
            display: flex;
        }

        .media-option {
            padding: 8px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
        }

        .media-option:hover {
            background: rgba(59, 76, 201, 0.2);
        }

        .font-size-picker {
            position: relative;
        }

        .font-size-options {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            background: var(--deep-space);
            border: 1px solid var(--galaxy-edge);
            border-radius: 8px;
            padding: 10px;
            z-index: 100;
            width: 120px;
            flex-direction: column;
            gap: 5px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            max-height: 200px;
            overflow-y: auto;
        }

        .font-size-options.show {
            display: flex;
        }

        .font-size-option {
            padding: 8px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
        }

        .font-size-option:hover {
            background: rgba(59, 76, 201, 0.2);
        }
        
        /* Centered media styles */
        .centered-media {
            display: block;
            margin: 1rem auto;
            max-width: 90%;
            height: auto;
        }
        
        .centered-table {
            margin: 1rem auto;
            width: 100%;
        }

        /* Theme variants */
        body.light-theme {
            --space-black: #f0f2f5;
            --deep-space: #ffffff;
            --cosmic-purple: #6e3bce;
            --nebula-blue: #3b4cc9;
            --starlight: #5a6178;
            --galaxy-edge: #d0d5e0;
            --accent-neon: #008cff;
            --text-primary: #2d3748;
            --text-secondary: #718096;
            --success: #00a56a;
            --warning: #d69e2e;
            --error: #e53e3e;
        }

        body.dark-theme {
            --space-black: #0f0f14;
            --deep-space: #1a1a24;
            --cosmic-purple: #8a5ce6;
            --nebula-blue: #4a61d1;
            --starlight: #a0a8d9;
            --galaxy-edge: #2a3045;
            --accent-neon: #00e6f3;
            --text-primary: #e2e8f0;
            --text-secondary: #a0aec0;
            --success: #00ff9d;
            --warning: #ffb800;
            --error: #ff2e7a;
        }

        @media (max-width: 1024px) {
            .main-content {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                margin-bottom: 20px;
            }

            .toolbar {
                overflow-x: auto;
                padding: 10px;
            }

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

            .ai-chat-container {
                width: 300px;
                height: 400px;
            }
        }

        @media (max-width: 768px) {
            header {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }

            .toolbar-group {
                border-right: none;
                padding: 0;
            }

            .editor {
                padding: 15px;
            }

            .editor-footer {
                flex-direction: column;
                gap: 15px;
                align-items: flex-start;
            }

            .mobile-toggle {
                display: block;
            }

            .sidebar {
                display: none;
            }

            .sidebar.active {
                display: block;
            }

            .ai-chat-container {
                width: 100%;
                height: 100%;
                bottom: 0;
                right: 0;
                border-radius: 0;
            }

            .ai-chat-toggle {
                bottom: 90px;
                right: 20px;
            }
        }

        /* Print styles */
        @media print {
            .toolbar, .sidebar, .editor-footer, .mobile-toggle, .ai-chat-toggle, .ai-chat-container {
                display: none !important;
            }

            .editor-container {
                border: none;
                background: white;
            }

            .editor {
                color: black;
                padding: 0;
            }
        }
