/* Code Editor Styles */

/* Page header width to match container */
.page-header {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.editor-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Toolbar */
.editor-toolbar {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.toolbar-label svg {
    width: 16px;
    height: 16px;
}

.toolbar-select {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.toolbar-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
}

.toolbar-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

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

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

/* Editor Wrapper */
.editor-wrapper {
    position: relative;
    background: #2d2d2d;
    border: 1px solid var(--border-color);
    border-top: none;
    display: flex;
    min-height: 500px;
    max-height: 700px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.editor-line-numbers {
    padding: 16px 12px;
    background: #1e1e1e;
    color: #858585;
    font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    border-right: 2px solid #3a3a3a;
    min-width: 60px;
    overflow: hidden;
    font-weight: 500;
    flex-shrink: 0;
}

.code-editor {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    color: #d4d4d4;
    caret-color: #fff;
    font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    overflow: auto;
    outline: none;
    tab-size: 4;
    font-variant-ligatures: common-ligatures;
    letter-spacing: 0.02em;
}

.code-editor::placeholder {
    color: #6b6b6b;
    font-style: italic;
}

.code-editor::selection {
    background: rgba(100, 150, 255, 0.3);
}

/* Highlighted Code Display - Hidden for now, using simple approach */
.code-display {
    display: none;
}

/* Editor Stats */
.editor-stats {
    display: flex;
    gap: 20px;
    padding: 12px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.stat strong {
    color: var(--accent-color);
    margin-left: 4px;
}

/* Preview Section */
.preview-section {
    margin-top: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

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

.preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.preview-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
}

.preview-refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-color);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.preview-refresh-btn:hover {
    background: var(--accent-hover);
}

.preview-refresh-btn svg {
    width: 16px;
    height: 16px;
}

.preview-frame {
    width: 100%;
    min-height: 400px;
    border: none;
    background: white;
}

/* Info Panel */
.info-panel {
    margin-top: 30px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--accent-color);
}

.info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1rem;
}

.info-header svg {
    width: 20px;
    height: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 8px;
}

.info-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
}

.info-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
}

.info-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.info-content p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* Theme Styles */
/* ===== Monokai Theme ===== */
.editor-wrapper.theme-monokai {
    background: #272822;
}
.editor-wrapper.theme-monokai .editor-line-numbers {
    background: #1e1e1e;
    color: #6d6d6d;
}
.editor-wrapper.theme-monokai .code-editor {
    color: #f8f8f2;
}
.editor-wrapper.theme-monokai .keyword { color: #f92672; font-weight: bold; }
.editor-wrapper.theme-monokai .string { color: #e6db74; }
.editor-wrapper.theme-monokai .comment { color: #75715e; font-style: italic; }
.editor-wrapper.theme-monokai .function { color: #a6e22e; }
.editor-wrapper.theme-monokai .number { color: #ae81ff; }
.editor-wrapper.theme-monokai .operator { color: #f92672; }
.editor-wrapper.theme-monokai .tag { color: #f92672; }
.editor-wrapper.theme-monokai .attribute { color: #a6e22e; }
.editor-wrapper.theme-monokai .value { color: #e6db74; }
.editor-wrapper.theme-monokai .class-name { color: #66d9ef; font-style: italic; }
.editor-wrapper.theme-monokai .property { color: #66d9ef; }
.editor-wrapper.theme-monokai .punctuation { color: #f8f8f2; }

/* ===== Dracula Theme ===== */
.editor-wrapper.theme-dracula {
    background: #282a36;
}
.editor-wrapper.theme-dracula .editor-line-numbers {
    background: #1e1f29;
    color: #6272a4;
    border-right-color: #44475a;
}
.editor-wrapper.theme-dracula .code-editor {
    color: #f8f8f2;
}
.editor-wrapper.theme-dracula .keyword { color: #ff79c6; font-weight: bold; }
.editor-wrapper.theme-dracula .string { color: #f1fa8c; }
.editor-wrapper.theme-dracula .comment { color: #6272a4; font-style: italic; }
.editor-wrapper.theme-dracula .function { color: #50fa7b; }
.editor-wrapper.theme-dracula .number { color: #bd93f9; }
.editor-wrapper.theme-dracula .operator { color: #ff79c6; }
.editor-wrapper.theme-dracula .tag { color: #ff79c6; }
.editor-wrapper.theme-dracula .attribute { color: #50fa7b; }
.editor-wrapper.theme-dracula .value { color: #f1fa8c; }
.editor-wrapper.theme-dracula .class-name { color: #8be9fd; font-style: italic; }
.editor-wrapper.theme-dracula .property { color: #8be9fd; }
.editor-wrapper.theme-dracula .punctuation { color: #f8f8f2; }

/* ===== GitHub Light Theme ===== */
.editor-wrapper.theme-github-light {
    background: #ffffff;
}
.editor-wrapper.theme-github-light .code-editor {
    color: #24292e;
}
.editor-wrapper.theme-github-light .editor-line-numbers {
    background: #fafbfc;
    color: #6a737d;
    border-right-color: #e1e4e8;
}
.editor-wrapper.theme-github-light .keyword { color: #d73a49; font-weight: bold; }
.editor-wrapper.theme-github-light .string { color: #032f62; }
.editor-wrapper.theme-github-light .comment { color: #6a737d; font-style: italic; }
.editor-wrapper.theme-github-light .function { color: #6f42c1; }
.editor-wrapper.theme-github-light .number { color: #005cc5; }
.editor-wrapper.theme-github-light .operator { color: #d73a49; }
.editor-wrapper.theme-github-light .tag { color: #22863a; }
.editor-wrapper.theme-github-light .attribute { color: #6f42c1; }
.editor-wrapper.theme-github-light .value { color: #032f62; }
.editor-wrapper.theme-github-light .class-name { color: #6f42c1; font-weight: 600; }
.editor-wrapper.theme-github-light .property { color: #005cc5; }
.editor-wrapper.theme-github-light .punctuation { color: #24292e; }

/* ===== Nord Theme ===== */
.editor-wrapper.theme-nord {
    background: #2e3440;
}
.editor-wrapper.theme-nord .editor-line-numbers {
    background: #242933;
    color: #616e88;
    border-right-color: #3b4252;
}
.editor-wrapper.theme-nord .code-editor {
    color: #d8dee9;
}
.editor-wrapper.theme-nord .keyword { color: #81a1c1; font-weight: bold; }
.editor-wrapper.theme-nord .string { color: #a3be8c; }
.editor-wrapper.theme-nord .comment { color: #616e88; font-style: italic; }
.editor-wrapper.theme-nord .function { color: #88c0d0; }
.editor-wrapper.theme-nord .number { color: #b48ead; }
.editor-wrapper.theme-nord .operator { color: #81a1c1; }
.editor-wrapper.theme-nord .tag { color: #81a1c1; }
.editor-wrapper.theme-nord .attribute { color: #8fbcbb; }
.editor-wrapper.theme-nord .value { color: #a3be8c; }
.editor-wrapper.theme-nord .class-name { color: #8fbcbb; font-style: italic; }
.editor-wrapper.theme-nord .property { color: #88c0d0; }
.editor-wrapper.theme-nord .punctuation { color: #d8dee9; }

/* ===== Solarized Dark Theme ===== */
.editor-wrapper.theme-solarized-dark {
    background: #002b36;
}
.editor-wrapper.theme-solarized-dark .editor-line-numbers {
    background: #00212b;
    color: #586e75;
    border-right-color: #073642;
}
.editor-wrapper.theme-solarized-dark .code-editor {
    color: #839496;
}
.editor-wrapper.theme-solarized-dark .keyword { color: #859900; font-weight: bold; }
.editor-wrapper.theme-solarized-dark .string { color: #2aa198; }
.editor-wrapper.theme-solarized-dark .comment { color: #586e75; font-style: italic; }
.editor-wrapper.theme-solarized-dark .function { color: #268bd2; }
.editor-wrapper.theme-solarized-dark .number { color: #d33682; }
.editor-wrapper.theme-solarized-dark .operator { color: #859900; }
.editor-wrapper.theme-solarized-dark .tag { color: #859900; }
.editor-wrapper.theme-solarized-dark .attribute { color: #b58900; }
.editor-wrapper.theme-solarized-dark .value { color: #2aa198; }
.editor-wrapper.theme-solarized-dark .class-name { color: #268bd2; font-style: italic; }
.editor-wrapper.theme-solarized-dark .property { color: #268bd2; }
.editor-wrapper.theme-solarized-dark .punctuation { color: #839496; }

/* ===== Tomorrow Night Theme ===== */
.editor-wrapper.theme-tomorrow-night {
    background: #1d1f21;
}
.editor-wrapper.theme-tomorrow-night .editor-line-numbers {
    background: #15171a;
    color: #969896;
    border-right-color: #282a2e;
}
.editor-wrapper.theme-tomorrow-night .code-editor {
    color: #c5c8c6;
}
.editor-wrapper.theme-tomorrow-night .keyword { color: #b294bb; font-weight: bold; }
.editor-wrapper.theme-tomorrow-night .string { color: #b5bd68; }
.editor-wrapper.theme-tomorrow-night .comment { color: #969896; font-style: italic; }
.editor-wrapper.theme-tomorrow-night .function { color: #81a2be; }
.editor-wrapper.theme-tomorrow-night .number { color: #de935f; }
.editor-wrapper.theme-tomorrow-night .operator { color: #8abeb7; }
.editor-wrapper.theme-tomorrow-night .tag { color: #cc6666; }
.editor-wrapper.theme-tomorrow-night .attribute { color: #de935f; }
.editor-wrapper.theme-tomorrow-night .value { color: #b5bd68; }
.editor-wrapper.theme-tomorrow-night .class-name { color: #f0c674; font-style: italic; }
.editor-wrapper.theme-tomorrow-night .property { color: #81a2be; }
.editor-wrapper.theme-tomorrow-night .punctuation { color: #c5c8c6; }

/* Responsive */
@media (max-width: 768px) {
    .editor-toolbar {
        gap: 12px;
    }

    .toolbar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .editor-stats {
        flex-wrap: wrap;
        gap: 12px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .toolbar-btn span {
        display: none;
    }

    .editor-wrapper {
        min-height: 400px;
    }
}
