﻿#fontSelect option {
            padding: 8px;
            font-size: 16px;
        }
        
        /* Show font preview in dropdown */
        #fontSelect optgroup {
            font-weight: 700;
            font-size: 12px;
            color: #64748b;
            font-style: normal;
            padding: 8px 0 4px;
        }

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

        .editor-layout {
            display: flex;
            height: calc(100vh - 60px);
            overflow: hidden;
        }

        /* LEFT TOOLBAR */
        .left-toolbar {
            width: 80px;
            background: var(--surface-1);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 15px 0;
            gap: 8px;
            overflow-y: auto;
        }

        .tool-btn {
            width: 60px;
            height: 60px;
            background: transparent;
            border: none;
            border-radius: 14px;
            color: var(--text-secondary);
            font-size: 22px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
        }

        .tool-btn span {
            font-size: 10px;
            font-weight: 600;
        }

        .tool-btn:hover {
            background: rgba(255, 255, 255, 0.05);
            color: var(--text-primary);
        }

        .tool-btn.active {
            background: var(--accent);
            color: white;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        }

        /* TOP OPTIONS BAR */
        .top-options {
            position: absolute;
            top: 70px;
            left: 80px;
            right: 320px;
            background: var(--surface-1);
            border-bottom: 1px solid var(--border);
            padding: 12px 24px;
            display: flex;
            align-items: center;
            gap: 15px;
            flex-wrap: wrap;
            z-index: 100;
            min-height: 60px;
        }

        .top-options label {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-secondary);
        }

        .top-options select,
        .top-options input[type="number"] {
            padding: 8px 12px;
            background: var(--bg);
            border: 1px solid var(--border);
            color: var(--text-primary);
            border-radius: 8px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }

        .top-options select:focus,
        .top-options input:focus {
            border-color: var(--accent);
        }

        .color-picker {
            width: 32px;
            height: 32px;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            padding: 0;
            background: transparent;
        }

        .opt-btn {
            padding: 8px 16px;
            background: rgba(59, 130, 246, 0.1);
            border: 1px solid rgba(59, 130, 246, 0.3);
            border-radius: 8px;
            color: #60a5fa;
            font-weight: 600;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .opt-btn:hover {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
        }

        .opt-btn.danger {
            background: rgba(239, 68, 68, 0.1);
            border-color: rgba(239, 68, 68, 0.3);
            color: #f87171;
        }

        .opt-btn.danger:hover {
            background: #ef4444;
            color: white;
            border-color: #ef4444;
        }

        /* CANVAS AREA */
        .canvas-area {
            flex: 1;
            background: #e8ecf1;
            overflow: auto;
            padding: 24px;
            padding-top: 85px;
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        [data-theme="dark"] .canvas-area {
            background: #1a1f2e;
        }

        .page-wrapper {
            position: relative;
            display: block;
            margin: 30px auto 60px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
            background: white;
            border-radius: 2px;
        }

        .page-wrapper canvas {
            display: block;
        }

        .overlay-canvas {
            position: absolute;
            top: 0;
            left: 0;
            cursor: crosshair;
            z-index: 40;
        }

        /* RIGHT PANEL */
        .right-panel {
            width: 320px;
            background: var(--surface-1);
            border-left: 1px solid var(--border);
            overflow-y: auto;
            padding: 24px;
        }

        .right-panel h3 {
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-secondary);
            margin: 0 0 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border);
        }

        .page-nav {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 12px;
            margin-bottom: 30px;
        }

        .page-nav button {
            padding: 8px 16px;
            background: rgba(255, 255, 255, 0.05);
            color: var(--text-primary);
            border: 1px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.2s;
        }

        .page-nav button:hover {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
        }

        .page-nav span {
            color: var(--text-primary);
            font-weight: 600;
            font-size: 15px;
        }

        .layers-list {
            margin: 15px 0 30px;
        }

        .layer-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            margin: 8px 0;
            font-size: 13px;
            color: var(--text-primary);
            transition: all 0.2s;
        }

        .layer-item:hover {
            border-color: var(--accent);
        }

        .layer-delete {
            width: 26px;
            height: 26px;
            background: rgba(239, 68, 68, 0.1);
            color: #f87171;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
            transition: all 0.2s;
        }

        .layer-delete:hover {
            background: #ef4444;
            color: white;
        }

        .save-section {
            padding-top: 24px;
            border-top: 1px solid var(--border);
        }

        .save-btn {
            width: 100%;
            padding: 16px;
            font-size: 16px;
            border-radius: 12px;
            background: linear-gradient(135deg, var(--accent), var(--accent));
            color: white;
            border: none;
            cursor: pointer;
            font-weight: 700;
            box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
            transition: all 0.3s;
        }

        .save-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
        }

        /* TEXT ELEMENTS ON CANVAS */
        .text-element {
            position: absolute;
            cursor: move;
            padding: 5px 10px;
            min-width: 50px;
            outline: none;
            z-index: 50;
            border: 2px dashed transparent;
        }

        .text-element:hover {
            border-color: var(--accent);
        }

        .text-element:focus {
            border-color: var(--accent);
        }

        .text-delete {
            position: absolute;
            top: -14px;
            right: -14px;
            width: 28px;
            height: 28px;
            background: #ef4444;
            color: white;
            border: 2px solid white;
            border-radius: 50%;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 60;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .text-element:hover .text-delete {
            display: flex;
        }

        /* EXTRACTED IMAGES (from original PDF) */
        .extracted-image {
            position: absolute;
            z-index: 44;
            border: 2px solid transparent;
            cursor: pointer;
            transition: all 0.2s;
            border-radius: 4px;
        }

        .extracted-image:hover {
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }

        .extracted-image .img-replace-btn {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%);
            padding: 6px 14px;
            background: rgba(59, 130, 246, 0.9);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            display: none;
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            z-index: 45;
        }

        .extracted-image:hover .img-replace-btn {
            display: block;
        }

        /* EXTRACTED TEXT (from original PDF) */
        .extracted-text {
            position: absolute;
            cursor: pointer;
            padding: 1px 2px;
            outline: none;
            z-index: 45;
            border: 1px solid transparent;
            background: transparent;
            color: transparent;
            line-height: 1.15;
            white-space: pre;
            transition: background 0.15s, border-color 0.15s;
            border-radius: 2px;
            user-select: none;
        }

        .extracted-text:hover {
            background: rgba(99, 102, 241, 0.08);
            border-color: rgba(99, 102, 241, 0.3);
            cursor: pointer;
        }

        .extracted-text.modified {
            border-bottom: 2px solid #22c55e;
            background: rgba(34, 197, 94, 0.06);
        }

        .extracted-text.editing {
            background: rgba(99, 102, 241, 0.12);
            border: 2px solid var(--accent, #6366f1);
        }

        /* FLOATING EDIT POPUP - fixed to viewport */
        .edit-popup {
            position: fixed;
            z-index: 10000;
            background: var(--surface-1, #fff);
            border: 2px solid var(--accent, #6366f1);
            border-radius: 12px;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
            padding: 14px;
            display: none;
            width: 400px;
            max-width: 90vw;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .edit-popup.active {
            display: block;
            animation: popupIn 0.15s ease-out;
        }

        @keyframes popupIn {
            from {
                opacity: 0;
                transform: translate(-50%, -50%) scale(0.95);
            }

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

        .edit-popup-label {
            font-size: 12px;
            color: var(--text-muted, #71717a);
            margin-bottom: 8px;
            font-weight: 600;
        }

        .edit-popup input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
            border-radius: 8px;
            font-size: 15px;
            background: var(--bg, #fafafa);
            color: var(--text-primary, #09090b);
            outline: none;
            font-family: inherit;
        }

        .edit-popup input:focus {
            border-color: var(--accent, #6366f1);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
        }

        .edit-popup-actions {
            display: flex;
            gap: 8px;
            margin-top: 10px;
            justify-content: flex-end;
        }

        .edit-popup-actions button {
            padding: 7px 16px;
            border-radius: 8px;
            border: none;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
        }

        .edit-popup-save {
            background: var(--accent, #6366f1);
            color: white;
        }

        .edit-popup-save:hover {
            opacity: 0.9;
        }

        .edit-popup-cancel {
            background: var(--surface-3, #e4e4e7);
            color: var(--text-primary, #09090b);
        }

        .edit-popup-cancel:hover {
            opacity: 0.8;
        }

        .edit-popup-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.3);
            z-index: 9999;
            display: none;
        }

        .edit-popup-backdrop.active {
            display: block;
        }

        /* IMAGE ELEMENTS */
        .image-element {
            position: absolute;
            cursor: move;
            z-index: 50;
            border: 2px dashed transparent;
        }

        .image-element:hover {
            border-color: var(--accent);
        }

        .image-element img {
            max-width: 100%;
            display: block;
        }

        .img-resize {
            width: 14px;
            height: 14px;
            background: #2563eb;
            position: absolute;
            bottom: -7px;
            right: -7px;
            cursor: se-resize;
            border-radius: 50%;
        }

        .img-delete {
            position: absolute;
            top: -12px;
            right: -12px;
            width: 28px;
            height: 28px;
            background: #ef4444;
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            font-weight: bold;
            font-size: 14px;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .image-element:hover .img-delete {
            display: flex;
        }

        /* STICKY NOTES */
        .sticky-note {
            position: absolute;
            width: 200px;
            min-height: 100px;
            background: #fef3c7;
            border-radius: 8px;
            padding: 10px;
            cursor: move;
            z-index: 60;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
            font-size: 14px;
            border: 2px solid #fde68a;
        }

        .sticky-note textarea {
            width: 100%;
            min-height: 60px;
            border: none;
            background: transparent;
            font-size: 14px;
            resize: none;
            outline: none;
            font-family: inherit;
        }

        .sticky-delete {
            position: absolute;
            top: 5px;
            right: 5px;
            width: 22px;
            height: 22px;
            background: #ef4444;
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            font-size: 12px;
        }

        /* SHAPES */
        .shape-element {
            position: absolute;
            cursor: move;
            z-index: 45;
            border: 2px dashed transparent;
        }

        .shape-element:hover {
            border-color: var(--accent);
        }

        /* MOBILE */
        @media (max-width: 768px) {
            .editor-layout {
                flex-direction: column;
                height: auto;
            }

            .left-toolbar {
                width: 100%;
                flex-direction: row;
                overflow-x: auto;
                padding: 5px;
            }

            .tool-btn {
                width: 48px;
                height: 48px;
                font-size: 18px;
            }

            .tool-btn span {
                display: none;
            }

            .right-panel {
                width: 100%;
                border-left: none;
                border-top: 2px solid #e2e8f0;
            }

            .top-options {
                left: 0;
                right: 0;
                top: auto;
                position: relative;
            }

            .canvas-area {
                padding-top: 20px;
            }
        }

.upload-area {
            border: 3px dashed var(--border);
            border-radius: 24px;
            padding: 60px 30px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s;
            background: var(--surface-1);
            color: var(--text-primary);
        }

        .upload-area:hover {
            border-color: var(--accent);
            background: var(--surface-2);
        }

        .container {
            max-width: 1120px;
            margin: 0 auto;
            padding: 0 20px;
        }

        body {
            color: var(--text-primary) !important;
        }

        header {
            background: #1e293b !important;
        }

        header h1,
        header h1 a {
            color: white !important;
        }

