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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            height: 100vh;
            overflow: hidden;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #2d3748;
        }

        /* ========== LOGIN SCREEN ========== */
        .login-screen {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .login-screen.hidden {
            display: none;
        }

        .login-box {
            background: white;
            border-radius: 20px;
            padding: 50px;
            width: 450px;
            box-shadow: 0 25px 80px rgba(0,0,0,0.4);
            animation: slideUp 0.6s ease;
        }

        @keyframes slideUp {
            from {
                transform: translateY(50px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .login-header {
            text-align: center;
            margin-bottom: 40px;
        }

        .login-logo {
            font-size: 60px;
            margin-bottom: 15px;
            animation: bounce 1s ease infinite;
        }

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        .login-header h1 {
            font-size: 32px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 10px;
            font-weight: 700;
        }

        .login-header p {
            color: #718096;
            font-size: 15px;
        }

        .login-tabs {
            display: flex;
            margin-bottom: 30px;
            background: #f7fafc;
            border-radius: 12px;
            padding: 5px;
        }

        .login-tab {
            flex: 1;
            padding: 12px;
            text-align: center;
            cursor: pointer;
            color: #718096;
            font-weight: 600;
            transition: all 0.3s;
            border-radius: 8px;
        }

        .login-tab.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .login-form {
            display: none;
        }

        .login-form.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }

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

        .form-group label {
            display: block;
            margin-bottom: 10px;
            font-size: 14px;
            font-weight: 600;
            color: #4a5568;
        }

        .form-group input {
            width: 100%;
            padding: 14px 18px;
            border: 2px solid #e2e8f0;
            border-radius: 12px;
            font-size: 15px;
            transition: all 0.3s;
            background: #f7fafc;
        }

        .form-group input:focus {
            outline: none;
            border-color: #667eea;
            background: white;
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
            transform: translateY(-2px);
        }

        .btn-login {
            width: 100%;
            padding: 16px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-login:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
        }

        .btn-login:active {
            transform: translateY(-1px);
        }

        .btn-login:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        /* ========== 🆕 INITIAL LOADING SCREEN ========== */
        .initial-loading {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            animation: fadeIn 0.3s ease;
        }

        .initial-loading.show {
            display: flex;
        }

        .initial-loading-content {
            text-align: center;
            color: white;
        }

        .initial-loading-spinner {
            width: 80px;
            height: 80px;
            margin: 0 auto 25px;
            position: relative;
        }

        .initial-spinner-ring {
            position: absolute;
            width: 100%;
            height: 100%;
            border: 4px solid transparent;
            border-top-color: white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .initial-spinner-ring:nth-child(2) {
            border-top-color: rgba(255, 255, 255, 0.6);
            animation-duration: 1.5s;
        }

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

        .initial-loading-text {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 10px;
        }

        .initial-loading-subtext {
            font-size: 14px;
            opacity: 0.8;
        }

        /* ========== MAIN APP ========== */
        .app-container {
            display: none;
            height: 100vh;
            flex-direction: column;
            background: #FFFFFF;
        }

        .app-container.active {
            display: flex;
        }

        /* ========== TOP BAR ========== */
        .top-bar {
            background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
            color: white;
            height: 64px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 30px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 15px;
            font-weight: 700;
            font-size: 18px;
        }

        .logo-icon {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-badge {
            background: rgba(255, 255, 255, 0.1);
            padding: 8px 16px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            backdrop-filter: blur(10px);
        }

        .btn {
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: white;
            padding: 10px 18px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
            backdrop-filter: blur(10px);
        }

        .btn:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }

        .btn-success {
            background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
            box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
        }

        .btn-success:hover {
            background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
            box-shadow: 0 6px 16px rgba(72, 187, 120, 0.6);
        }

        .btn-danger {
            background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
            box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
        }

        .btn-danger:hover {
            background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
            box-shadow: 0 6px 16px rgba(245, 101, 101, 0.6);
        }

        /* ========== TOOLBAR ========== */
        .toolbar {
            background: #f7fafc;
            height: 60px;
            display: flex;
            align-items: center;
            padding: 0 30px;
            gap: 15px;
            border-bottom: 2px solid #e2e8f0;
            box-shadow: 0 2px 4px rgba(0,0,0,0.03);
            overflow-x: auto;
        }

        .project-selector {
            background: white;
            border: 2px solid #e2e8f0;
            color: #2d3748;
            padding: 10px 16px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            min-width: 220px;
            transition: all 0.3s;
        }

        .project-selector:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
        }

        .ui-tools {
            display: flex;
            gap: 8px;
            padding: 5px 12px;
            background: white;
            border-radius: 10px;
            border: 2px solid #e2e8f0;
            margin-left: 10px;
        }

        .tool-btn {
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border: 1px solid #cbd5e0;
            color: #2d3748;
            padding: 8px 14px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
        }

        .tool-btn:hover {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-color: #667eea;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

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

        .stats-display {
            display: flex;
            gap: 15px;
            margin-left: auto;
            font-size: 13px;
        }

        .stat-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border-radius: 10px;
            border: 2px solid #e2e8f0;
            font-weight: 600;
            white-space: nowrap;
        }

        .stat-value {
            color: #667eea;
            font-weight: 700;
        }

        /* ========== MAIN CONTAINER ========== */
        .main-container {
            display: flex;
            height: calc(100vh - 124px);
            background: #FFFFFF;
            position: relative;
        }

        /* ========== 🆕 SIDEBAR COLLAPSE BUTTON ========== */
        .sidebar-collapse-btn {
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 24px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 0 8px 8px 0;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            z-index: 100;
            transition: all 0.3s;
            box-shadow: 2px 0 8px rgba(102, 126, 234, 0.3);
        }

        .sidebar-collapse-btn:hover {
            width: 30px;
            background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
            box-shadow: 2px 0 12px rgba(102, 126, 234, 0.5);
        }

        .sidebar-collapsed .sidebar-collapse-btn {
            left: 0;
        }

        /* ========== FILE TREE PANEL ========== */
        .file-panel {
            width: 300px;
            background: white;
            border-right: 1px solid #e2e8f0;
            display: flex;
            flex-direction: column;
            box-shadow: 2px 0 12px rgba(0,0,0,0.05);
            min-width: 300px;
            transition: all 0.3s ease;
            position: relative;
        }

        .file-panel.collapsed {
            width: 0;
            min-width: 0;
            overflow: hidden;
            border-right: none;
        }

        .file-header {
            background: #2d3748;
            color: white;
            padding: 15px 20px;
            font-weight: 700;
            font-size: 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .file-tree {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 15px 0;
            background: #FFFFFF;
            min-height: 200px;
            max-height: 50%;
            transition: all 0.3s ease;
        }

        .file-tree.collapsed {
            flex: 0;
            min-height: 0;
            max-height: 0;
            padding: 0;
            overflow: hidden;
        }

        /* ========== OUTLINE PANEL ========== */
        .outline-section {
            flex: 1;
            display: flex;
            flex-direction: column;
            border-top: 2px solid #e2e8f0;
            min-height: 200px;
            transition: all 0.3s ease;
        }

        .outline-section.collapsed {
            flex: 0;
            min-height: 0;
        }

        .outline-header {
            background: #2d3748;
            color: white;
            padding: 15px 20px;
            font-weight: 700;
            font-size: 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .outline-tree {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 15px 0;
            background: #FFFFFF;
            transition: all 0.3s ease;
        }

        .outline-tree.collapsed {
            flex: 0;
            padding: 0;
            overflow: hidden;
        }

        .panel-toggle-btn {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            padding: 4px 10px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .panel-toggle-btn:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: scale(1.05);
        }

        .outline-item {
            padding: 8px 15px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            transition: all 0.2s;
            user-select: none;
            border-left: 3px solid transparent;
        }

        .outline-item:hover {
            background: linear-gradient(90deg, #f7fafc 0%, transparent 100%);
            border-left-color: #48bb78;
        }

        .outline-item.active {
            background: linear-gradient(90deg, #e6fffa 0%, transparent 100%);
            border-left-color: #38a169;
            color: #38a169;
            font-weight: 600;
        }

        .outline-item.chapter {
            font-weight: 700;
            font-size: 14px;
            color: #2d3748;
            padding-left: 15px;
        }

        .outline-item.section {
            padding-left: 25px;
            font-weight: 600;
        }

        .outline-item.subsection {
            padding-left: 40px;
            font-size: 12px;
        }

        .outline-item.subsubsection {
            padding-left: 55px;
            font-size: 11px;
            color: #718096;
        }

        .outline-toggle {
            width: 14px;
            height: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #718096;
            font-size: 10px;
            transition: transform 0.2s;
            flex-shrink: 0;
        }

        .outline-toggle.expanded {
            transform: rotate(90deg);
        }

        .outline-children {
            display: none;
        }

        .outline-children.expanded {
            display: block;
        }

        .outline-icon {
            font-size: 14px;
            flex-shrink: 0;
        }

        .outline-empty {
            padding: 40px 20px;
            text-align: center;
            color: #a0aec0;
        }

        .tree-item {
            padding: 10px 15px 10px 25px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 14px;
            transition: all 0.2s;
            user-select: none;
            font-weight: 500;
            position: relative;
        }

        .tree-item:hover {
            background: linear-gradient(90deg, #f7fafc 0%, transparent 100%);
            border-left: 3px solid #667eea;
            padding-left: 22px;
        }

        .tree-item.selected {
            background: linear-gradient(90deg, #edf2f7 0%, transparent 100%);
            border-left: 4px solid #667eea;
            color: #667eea;
            font-weight: 700;
        }

        .tree-item.drag-over {
            background: #e6fffa;
            border-left: 4px solid #38b2ac;
        }

        .tree-toggle {
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #718096;
            font-size: 12px;
            transition: transform 0.2s;
            flex-shrink: 0;
        }

        .tree-toggle.expanded {
            transform: rotate(90deg);
        }

        .tree-icon {
            font-size: 18px;
            flex-shrink: 0;
        }

        .tree-children {
            display: none;
        }

        .tree-children.expanded {
            display: block;
        }

        /* ========== EDITOR PANEL ========== */
        .editor-panel {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: white;
            border-right: 1px solid #e2e8f0;
            min-width: 300px;
        }

        .editor-header {
            background: #FFFFFF;
            padding: 15px 25px;
            border-bottom: 2px solid #e2e8f0;
            font-size: 14px;
            color: #2d3748;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-weight: 600;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }

        .font-controls {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #f7fafc;
            padding: 6px 12px;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }

        .font-control-btn {
            background: white;
            border: 1px solid #cbd5e0;
            color: #2d3748;
            width: 28px;
            height: 28px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            font-weight: bold;
            transition: all 0.2s;
        }

        .font-control-btn:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
            transform: scale(1.05);
        }

        .font-size-display {
            min-width: 45px;
            text-align: center;
            font-size: 13px;
            font-weight: 600;
            color: #667eea;
        }

        #editor-container {
            flex: 1;
            overflow: hidden;
        }

        /* ========== PDF PANEL ========== */
        .pdf-panel {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: white;
            min-width: 300px;
            position: relative;
        }

        .pdf-toolbar {
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            padding: 15px 25px;
            border-bottom: 2px solid #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 15px;
        }

        .pdf-viewer {
            flex: 1;
            overflow-y: auto;
            background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
            padding: 30px;
            position: relative;
        }

        .pdf-canvas-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 30px;
        }

        .pdf-page {
            box-shadow: 0 8px 32px rgba(0,0,0,0.6);
            border-radius: 8px;
        }

        .empty-pdf {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #a0aec0;
        }

        /* ========== LOADING ANIMATION ========== */
        .pdf-loading-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(26, 32, 44, 0.98);
            backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 100;
        }

        .pdf-loading-overlay.show {
            display: flex;
            animation: fadeIn 0.3s ease;
        }

        .loading-spinner {
            width: 100px;
            height: 100px;
            margin: 0 auto 30px;
            position: relative;
        }

        .spinner-ring {
            position: absolute;
            width: 100%;
            height: 100%;
            border: 5px solid transparent;
            border-top-color: #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .spinner-ring:nth-child(2) {
            border-top-color: #764ba2;
            animation-duration: 1.5s;
        }

        .spinner-ring:nth-child(3) {
            border-top-color: #48bb78;
            animation-duration: 2s;
        }

        /* ========== MODAL ========== */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.7);
            backdrop-filter: blur(4px);
            z-index: 9999;
            align-items: center;
            justify-content: center;
        }

        .modal.show {
            display: flex;
            animation: fadeIn 0.3s ease;
        }

        .modal-content {
            background: white;
            border-radius: 20px;
            padding: 40px;
            max-width: 600px;
            width: 90%;
            box-shadow: 0 20px 80px rgba(0,0,0,0.5);
            animation: slideUp 0.4s ease;
            max-height: 80vh;
            overflow-y: auto;
        }

        .modal-header {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 25px;
            color: #2d3748;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .modal-close-btn {
            background: #f56565;
            border: none;
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            font-weight: bold;
            transition: all 0.3s;
            flex-shrink: 0;
            line-height: 1;
        }

        .modal-close-btn:hover {
            background: #c53030;
            transform: scale(1.1);
        }

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

        .input-group label {
            display: block;
            margin-bottom: 10px;
            font-size: 14px;
            font-weight: 600;
            color: #4a5568;
        }

        .input-group input,
        .input-group textarea {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e2e8f0;
            border-radius: 10px;
            font-size: 14px;
            transition: all 0.3s;
            font-family: inherit;
        }

        .input-group textarea {
            min-height: 120px;
            resize: vertical;
            font-family: 'Consolas', 'Monaco', monospace;
        }

        .input-group input:focus,
        .input-group textarea:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
        }

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

        /* ========== TABLE GRID ========== */
        .table-grid {
            display: grid;
            grid-template-columns: repeat(8, 40px);
            gap: 5px;
            margin: 20px 0;
            padding: 15px;
            background: #f7fafc;
            border-radius: 10px;
        }

        .table-cell {
            width: 40px;
            height: 40px;
            border: 2px solid #cbd5e0;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            background: white;
        }

        .table-cell:hover,
        .table-cell.selected {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-color: #667eea;
        }

        .table-size-display {
            text-align: center;
            font-size: 16px;
            font-weight: 600;
            color: #667eea;
            margin-top: 10px;
        }

        /* ========== IMAGE SELECTOR ========== */
        .image-selector-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 15px;
            max-height: 400px;
            overflow-y: auto;
            padding: 15px;
            background: #f7fafc;
            border-radius: 10px;
            margin-bottom: 20px;
        }

        .image-selector-item {
            background: white;
            border: 3px solid #e2e8f0;
            border-radius: 10px;
            padding: 10px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .image-selector-item:hover {
            border-color: #667eea;
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .image-selector-item.selected {
            border-color: #48bb78;
            background: linear-gradient(135deg, #e6fffa 0%, #ffffff 100%);
            box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
        }

        .image-selector-item img {
            width: 100%;
            height: 120px;
            object-fit: cover;
            border-radius: 8px;
        }

        .image-selector-name {
            font-size: 12px;
            font-weight: 600;
            color: #2d3748;
            text-align: center;
            word-break: break-word;
            width: 100%;
        }

        /* ========== IMAGE UPLOAD SECTION ========== */
        .image-upload-section {
            padding: 25px;
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border-radius: 12px;
            margin-bottom: 25px;
            border: 3px dashed #cbd5e0;
            text-align: center;
            transition: all 0.3s;
        }

        .image-upload-section:hover {
            border-color: #667eea;
            background: linear-gradient(135deg, #edf2f7 0%, #e6f7ff 100%);
        }

        .image-upload-section label {
            display: block;
            margin-bottom: 15px;
            font-size: 16px;
            font-weight: 700;
            color: #2d3748;
        }

        .file-input-wrapper {
            position: relative;
            display: inline-block;
            cursor: pointer;
            margin-bottom: 15px;
        }

        .file-input-wrapper input[type="file"] {
            position: absolute;
            opacity: 0;
            width: 0;
            height: 0;
        }

        .file-input-btn {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            padding: 12px 24px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .file-input-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
        }

        .upload-btn-wrapper {
            margin-top: 15px;
        }

        .upload-preview {
            margin-top: 20px;
            padding: 15px;
            background: white;
            border-radius: 10px;
            border: 2px solid #e2e8f0;
        }

        .upload-preview img {
            max-width: 100%;
            max-height: 200px;
            border-radius: 8px;
            margin: 10px auto;
            display: block;
        }

        .upload-preview-name {
            text-align: center;
            font-size: 14px;
            font-weight: 600;
            color: #667eea;
            margin-top: 10px;
        }

        /* ========== NOTIFICATION ========== */
        .notification {
            position: fixed;
            top: 80px;
            right: 30px;
            background: white;
            border-radius: 12px;
            padding: 18px 24px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.2);
            z-index: 10000;
            display: none;
            min-width: 340px;
            border-left: 5px solid #48bb78;
            font-weight: 600;
        }

        .notification.error {
            border-left-color: #f56565;
        }

        .notification.show {
            display: block;
            animation: slideInRight 0.4s ease;
        }

        @keyframes slideInRight {
            from {
                transform: translateX(400px);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        /* ========== RESIZER ========== */
        .resizer {
            width: 5px;
            cursor: col-resize;
            background: transparent;
            transition: background 0.2s;
            flex-shrink: 0;
        }

        .resizer:hover {
            background: #667eea;
        }

        /* ========== SCROLLBAR ========== */
        ::-webkit-scrollbar {
            width: 12px;
            height: 12px;
        }

        ::-webkit-scrollbar-track {
            background: #FFFFFF;
            border-left: 1px solid #e2e8f0;
        }

        ::-webkit-scrollbar-thumb {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 10px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
        }

        /* ========== CONTEXT MENU ========== */
        .context-menu {
            position: fixed;
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.2);
            min-width: 200px;
            z-index: 9999;
            display: none;
            overflow: hidden;
        }

        .context-menu.show {
            display: block;
            animation: fadeIn 0.2s ease;
        }

        .context-menu-item {
            padding: 12px 20px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 12px;
            transition: all 0.2s;
        }

        .context-menu-item:hover {
            background: linear-gradient(90deg, #f7fafc 0%, transparent 100%);
            color: #667eea;
        }

        .context-menu-divider {
            height: 1px;
            background: #e2e8f0;
            margin: 5px 0;
        }

        .highlighted-line {
            background: rgba(72, 187, 120, 0.2) !important;
            border-left: 4px solid #48bb78 !important;
            animation: highlightFade 2s ease-out;
        }

        @keyframes highlightFade {
            0% {
                background: rgba(72, 187, 120, 0.4) !important;
            }
            100% {
                background: rgba(72, 187, 120, 0.1) !important;
            }
        }

        .highlighted-glyph {
            background: #48bb78;
            width: 4px !important;
        }


        
        /* ========== IMAGE PREVIEW MODAL ========== */
        .image-preview-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.95);
            backdrop-filter: blur(10px);
            z-index: 10000;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
        }
        
        .image-preview-modal.show {
            display: flex;
        }
        
        .image-preview-container {
            max-width: 90vw;
            max-height: 90vh;
            position: relative;
            animation: zoomIn 0.4s ease;
        }
        
        @keyframes zoomIn {
            from {
                transform: scale(0.7);
                opacity: 0;
            }
            to {
                transform: scale(1);
                opacity: 1;
            }
        }
        
        .image-preview-container img {
            max-width: 100%;
            max-height: 90vh;
            border-radius: 12px;
            box-shadow: 0 25px 100px rgba(0, 0, 0, 0.8);
            object-fit: contain;
        }
        
        .image-preview-header {
            position: absolute;
            top: -60px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 20px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            color: white;
        }
        
        .image-preview-title {
            font-size: 18px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .image-preview-actions {
            display: flex;
            gap: 10px;
        }
        
        .image-preview-btn {
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 10px 18px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .image-preview-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
        }
        
        .image-preview-close {
            position: absolute;
            top: -60px;
            right: 0;
            background: #f56565;
            border: none;
            color: white;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            font-weight: bold;
            transition: all 0.3s;
            box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
        }
        
        .image-preview-close:hover {
            background: #c53030;
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(245, 101, 101, 0.6);
        }
        
        .image-preview-info {
            position: absolute;
            bottom: -50px;
            left: 0;
            right: 0;
            text-align: center;
            color: white;
            font-size: 14px;
            opacity: 0.8;
        }
        
        .image-zoom-controls {
            position: absolute;
            bottom: -50px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 10px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            padding: 10px;
            border-radius: 12px;
        }
        
        .zoom-btn {
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: all 0.2s;
        }
        
        .zoom-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }
        
        .image-preview-container img {
            transition: transform 0.3s ease;
        }


/* ========== 🔧 FIX: Tree Children Indentation ========== */
.tree-children {
    display: none;
    /* ไม่ต้องมี padding-left เพราะใช้ level * 20 แล้ว */
}

.tree-children.expanded {
    display: block;
}

.tree-item {
    padding: 10px 15px 10px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: all 0.2s;
    user-select: none;
    font-weight: 500;
    position: relative;
}

/* 🔧 เพิ่ม visual guide สำหรับ folder structure */
.tree-children::before {
    content: '';
    position: absolute;
    left: 35px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e2e8f0 0%, transparent 100%);
    opacity: 0.5;
}

/* ========== 🔧 FIX: Tree Node Wrapper ========== */
/* ========== TREE STRUCTURE ========== */
.tree-node-wrapper {
    position: relative;
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #718096;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
    user-select: none;
}

.tree-toggle:hover {
    color: #667eea;
    transform: scale(1.2);
}

.tree-toggle.expanded {
    transform: rotate(0deg);
}

/* Smooth rotation animation */
.tree-toggle {
    transition: transform 0.2s ease;
}

.tree-children {
    display: none;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tree-children.expanded {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* Visual guide line for folder structure */
.tree-children::before {
    content: '';
    position: absolute;
    left: 42px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, 
        rgba(102, 126, 234, 0.2) 0%, 
        rgba(102, 126, 234, 0.1) 50%,
        transparent 100%);
}  

/* ========== ERROR HIGHLIGHTING ========== */
.error-line-error {
    background: rgba(255, 0, 0, 0.1);
    border-left: 4px solid #f56565;
}

.error-line-warning {
    background: rgba(255, 165, 0, 0.1);
    border-left: 4px solid #ed8936;
}

.error-line-info {
    background: rgba(66, 153, 225, 0.1);
    border-left: 4px solid #4299e1;
}

.error-glyph-error {
    background: #f56565;
    width: 6px !important;
    margin-left: 3px;
}

.error-glyph-warning {
    background: #ed8936;
    width: 6px !important;
    margin-left: 3px;
}

.error-glyph-info {
    background: #4299e1;
    width: 6px !important;
    margin-left: 3px;
}


/* ========== ERROR PANEL ========== */
/* ========== ERROR PANEL ========== */
.error-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: white;
    border-top: 3px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.error-panel-header {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 15px 25px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

/* 🔧 FIX: ทำให้ปุ่ม Close เด่นขึ้น */
.error-panel-header .btn {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
    min-width: 80px;
}

.error-panel-header .btn:hover {
    background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 101, 101, 0.6);
}

.error-panel-header .btn:active {
    transform: translateY(0);
}

.error-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 25px;
}

.error-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.error-item:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.error-item.error {
    border-left: 5px solid #f56565;
}

.error-item.warning {
    border-left: 5px solid #ed8936;
}

.error-item-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.error-severity-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.error-severity-badge.error {
    background: #fed7d7;
    color: #c53030;
}

.error-severity-badge.warning {
    background: #feebc8;
    color: #c05621;
}

.error-line-badge {
    padding: 4px 10px;
    background: #edf2f7;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2d3748;
}

.error-type-badge {
    padding: 4px 10px;
    background: #e6fffa;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #38a169;
}

.error-message {
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 1.5;
}

.error-suggestion {
    font-size: 13px;
    color: #4a5568;
    background: #f7fafc;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #48bb78;
    line-height: 1.6;
}

.error-line-flash {
    background: rgba(72, 187, 120, 0.3) !important;
    animation: flash 1s ease;
}

@keyframes flash {
    0%, 100% { background: rgba(72, 187, 120, 0.3); }
    50% { background: rgba(72, 187, 120, 0.6); }
}

        


/* ========== EXPORT DROPDOWN MENU ========== */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.export-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.export-dropdown-content {
    display: none;
    position: absolute;
    background: white;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    z-index: 1000;
    top: calc(100% + 8px);
    left: 0;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

.export-dropdown-content.show {
    display: block;
    animation: dropdownSlide 0.3s ease;
}

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

.export-dropdown-header {
    padding: 12px 18px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-bottom: 2px solid #e2e8f0;
    font-weight: 700;
    font-size: 13px;
    color: #2d3748;
}

.export-dropdown-item {
    padding: 12px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    transition: all 0.2s;
    border-bottom: 1px solid #f7fafc;
}

.export-dropdown-item:last-child {
    border-bottom: none;
}

.export-dropdown-item:hover {
    background: linear-gradient(90deg, #f7fafc 0%, transparent 100%);
    color: #667eea;
    padding-left: 24px;
}

.export-dropdown-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.export-dropdown-item .label {
    flex: 1;
}

.export-dropdown-item .format {
    font-size: 11px;
    color: #718096;
    background: #f7fafc;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
}

