/* VS Code Dark Theme Colors:
   - Background: #1e1e1e
   - Editor/Panel Background: #1e1e1e
   - Sidebar/Header/Bottom Panel Background: #252526
   - Tab Bar Background: #2d2d2d
   - Inactive Tab Text: #929292
   - Active Tab Background: #1e1e1e
   - Active Tab Text: #fff
   - Active Tab Border/Highlight: #007acc
   - Border Lines: #333
   - Text Color: #d4d4d4
   - Inactive Text/Icons: #858585
   - Button Background: #0e639c
   - Button Hover: #1177bb
   - Resizer Hover: #007acc
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Consolas', monospace; /* Monospace for code, general UI can be sans-serif */
    font-size: 14px; /* Base font size for editor and most UI */
}

body {
    background-color: #1e1e1e;
    color: #d4d4d4;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Hide scrollbars for the main layout */
}

/* --- Header (VS Code Title Bar) --- */
.header {
    background-color: #252526;
    padding: 0 10px;
    height: 35px; /* VS Code title bar height */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    user-select: none;
    flex-shrink: 0; /* Prevent shrinking */
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h2 {
    font-size: 16px;
    color: #d4d4d4;
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.header-right button {
    background: none;
    border: none;
    color: #d4d4d4;
    padding: 5px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.15s;
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-right button:hover {
    background-color: #3c3c3c;
}

.header-right button i {
    margin-right: 5px;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.toggle-sidebar-button {
    font-size: 18px;
    cursor: pointer;
    color: #858585;
    transition: color 0.15s;
}
.toggle-sidebar-button:hover {
    color: #d4d4d4;
}

/* --- Editor Tabs (in Header) --- */
.header-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
    height: 100%; /* Fill header height */
    position: relative; /* For the tabs to be positioned */
}

.editor-tabs {
    display: flex;
    flex-grow: 1;
    background-color: #2d2d2d;
    height: 100%;
    align-items: center;
    padding-left: 10px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

.editor-tabs::-webkit-scrollbar {
    display: none;
}

.editor-tabs .tab {
    display: inline-flex;
    align-items: center;
    padding: 0 15px;
    background-color: #2d2d2d;
    color: #929292;
    border-right: 1px solid #1e1e1e;
    cursor: pointer;
    user-select: none;
    height: 100%;
    position: relative;
    font-size: 13px;
    transition: background-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.editor-tabs .tab.active {
    background-color: #1e1e1e; /* Active tab background */
    color: #fff; /* Active tab text color */
}

.editor-tabs .tab.active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px; /* Active tab indicator thickness */
    background-color: #007acc; /* VS Code active tab line color */
}

.editor-tabs .tab:hover {
    background-color: #3c3c3c; /* Hover background */
}

.editor-tabs .tab.active:hover {
    background-color: #1e1e1e; /* No background change on active tab hover */
}

.tab-name {
    margin-right: 8px;
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.tab-close {
    color: #929292;
    margin-left: 8px;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
    border-radius: 2px;
    transition: background-color 0.15s, color 0.15s;
}

.tab-close:hover {
    background-color: #555;
    color: #fff;
}

.new-tab-btn {
    padding: 0 10px;
    background: none;
    border: none;
    color: #d4d4d4;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    height: 100%;
    margin-left: 5px;
    display: flex;
    align-items: center;
    transition: background-color 0.15s;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.new-tab-btn:hover {
    background-color: #3c3c3c;
}

.new-tab-btn i {
    font-size: 16px;
    color: #858585;
    transition: color 0.15s;
}

.new-tab-btn:hover i {
    color: #d4d4d4;
}

.tab-rename-input {
    background: #1e1e1e;
    color: #fff;
    border: 1px solid #007acc;
    padding: 2px 4px;
    margin-right: 8px;
    font-size: inherit;
    font-family: inherit;
    outline: none;
    line-height: 1.5; /* Match editor line height */
}

.tab-rename-input:focus {
    border-color: #007acc;
}


/* --- Main Wrapper (Sidebar + Editor/Right Panel) --- */
.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- Sidebar (Explorer) --- */
.sidebar {
    width: 250px; /* Default sidebar width */
    background-color: #252526;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease-in-out, min-width 0.2s ease-in-out;
    min-width: 0;
    overflow: hidden; /* Hide scrollbars if collapsed */
    flex-shrink: 0; /* Prevent shrinking below min-width */
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #333;
    background-color: #252526;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.sidebar-header h3 {
    font-size: 12px;
    color: #858585;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.sidebar-actions button {
    background: none;
    border: none;
    color: #858585;
    font-size: 14px;
    padding: 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar-actions button:hover {
    background-color: #3c3c3c;
    color: #d4d4d4;
}

.file-tree {
    flex: 1;
    padding: 5px 0; /* Reduced padding */
    overflow-y: auto;
    font-size: 13px;
}

.file-tree-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    color: #d4d4d4; /* Default file text color */
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.file-tree-item:hover {
    background-color: #2a2d2e;
}

.file-tree-item.active {
    background-color: #0e639c; /* VS Code active item highlight */
    color: #fff;
}

.file-tree-item i {
    margin-right: 5px;
    color: #858585;
    font-size: 14px;
}

.file-tree-item.active i {
    color: #fff;
}

.folder-root {
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
}

.folder-root > .folder-name {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    width: 100%;
    color: #d4d4d4; /* Folder name color */
}

.folder-root > .folder-name:hover {
    background-color: #2a2d2e;
}

.folder-toggle {
    transition: transform 0.2s ease-in-out;
}

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

.file-list {
    width: 100%;
    display: none;
}

.folder-root.expanded .file-list {
    display: block;
}

.file-list .file-tree-item {
    padding-left: 25px; /* Indent files inside folders */
}

/* --- Editor and Right Panel Container --- */
.editor-and-right-panel-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
}

/* --- Editor Container --- */
.editor-container {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    width: 50%;
    transition: width 0.3s ease-in-out;
    position: relative;
    flex-shrink: 0;
}

/* Resizer styles */
.resizer {
    width: 5px;
    background-color: #333;
    cursor: col-resize;
    transition: background-color 0.2s, width 0.2s;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    margin: 0 -2px; /* Extend the clickable area */
}

.resizer:hover {
    background-color: #007acc;
    width: 8px;
}

.resizer.resizing {
    background-color: #007acc;
    width: 8px;
}

/* Add a subtle highlight effect */
.resizer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
}

.editor-header {
    display: flex;
    background-color: #2d2d2d;
    padding: 5px 10px;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #333;
    flex-shrink: 0; /* Prevent shrinking */
}

.language-select {
    background-color: #3c3c3c;
    color: #d4d4d4;
    border: 1px solid #555;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.language-select:focus {
    border-color: #007acc;
}

.run-button, .format-button, .help-button {
    background: #0e639c; /* VS Code primary button color */
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.15s;
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.run-button:hover, .format-button:hover, .help-button:hover {
    background: #1177bb;
}

.run-button:disabled {
    background: #666;
    cursor: not-allowed;
}

.help-button {
    margin-left: auto;
}
.run-button i, .format-button i, .help-button i {
    margin-right: 5px;
    font-size: 13px;
}

.editor {
    position: relative;
    display: flex;
    flex: 1; /* Take full height of editor-container minus header */
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', monospace;
    line-height: 1.5;
    overflow: hidden;
}

.line-numbers {
    width: 40px;
    padding: 10px 5px;
    background: #252525;
    color: #858585;
    text-align: right;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    user-select: none;
    overflow-y: hidden; /* Only scroll with editor */
    border-right: 1px solid #333;
    flex-shrink: 0; /* Prevent shrinking */
}

.line-numbers div {
    height: 1.5em; /* Match line height */
    line-height: 1.5em;
    padding-right: 5px;
}

#code-editor {
    flex: 1;
    padding: 10px;
    border: none;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    tab-size: 4;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow: auto; /* Allow code editor to scroll */
}

/* Syntax highlighting colors (these classes need to be applied by JS for highlighting) */
.token.comment { color: #6A9955; }
.token.string { color: #CE9178; }
.token.keyword { color: #569CD6; }
.token.function { color: #DCDCAA; }
.token.number { color: #B5CEA8; }
.token.operator { color: #D4D4D4; }
.token.punctuation { color: #D4D4D4; }
.token.class { color: #4EC9B0; }
.token.tag { color: #569CD6; }
.token.attribute { color: #9CDCFE; }
.token.property { color: #9CDCFE; }

/* Update preview panel styles */
.right-panel {
    width: 50%;
    background-color: #1e1e1e;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    transition: all 0.3s ease-in-out;
    flex-shrink: 0;
    overflow: hidden;
}

.right-panel.collapsed {
    width: 0 !important; /* Force width to 0 */
    min-width: 0 !important; /* Prevent min-width from interfering */
    border-left: none;
    margin-left: 0; /* Remove margin to fully collapse */
    opacity: 0; /* Hide visually */
    visibility: hidden; /* Hide from screen readers */
    pointer-events: none; /* Prevent interaction */
    /* Ensure transition applies smoothly for width, opacity, etc. */
    transition: width 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.preview-header {
    padding: 10px;
    background-color: #252526;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.preview-tabs {
    display: flex;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.preview-tab {
    padding: 5px 10px;
    background: none;
    border: none;
    color: #858585;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.15s, color 0.15s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 2;
}

.preview-tab.active {
    background: #0e639c;
    color: white;
}

.preview-tab:hover {
    background: #3c3c3c;
    color: #d4d4d4;
}

.preview-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column; /* To stack sections on top of each other */
}

.preview-section {
    display: none;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 0;
    background-color: #1e1e1e; /* Ensure background is consistent */
    color: #d4d4d4;
    display: flex; /* Always flex to control child layout */
    flex-direction: column;
}

.preview-section.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

#preview-section {
    /* Specific styles for preview iframe, if needed */
}

.preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: white;
    height: 100%; /* Take full height of its parent */
}

#ai-section {
    /* Specific styles for AI chat, already flex */
}

#output-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #1e1e1e;
    padding: 0;
    position: relative;
}

.output-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#output-console {
    flex: 1;
    padding: 10px;
    background: #1e1e1e;
    color: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: pre-wrap;
    overflow-y: auto;
    min-height: 100px;
    border: none;
    outline: none;
    resize: none;
    line-height: 1.5;
    tab-size: 4;
}

.terminal-line {
    display: flex;
    align-items: flex-start;
    margin: 2px 0;
    min-height: 1.5em;
}

.terminal-prompt {
    color: #4CAF50;
    margin-right: 8px;
    user-select: none;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: inherit;
    padding: 0;
    margin: 0;
    outline: none;
    caret-color: #fff;
}

.terminal-text {
    color: #fff;
}

.terminal-error {
    color: #ff6b6b;
}

.terminal-success {
    color: #4CAF50;
}

.terminal-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #fff;
    margin-left: 2px;
    animation: blink 1s infinite;
}

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

.terminal-history {
    color: #858585;
}

.ai-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.ai-response {
    flex: 1; /* This will make it take available height and allow scrolling */
    overflow-y: auto;
    padding: 15px;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', monospace;
    white-space: pre-wrap; /* Handles line breaks and spaces */
    word-wrap: break-word; /* Prevents long words from overflowing */
    min-height: 0; /* Allows it to shrink in flex container */
    border-bottom: 1px solid #333; /* Separator from input */
}

.ai-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #252526;
    border-top: 1px solid #3c3c3c;
    flex-shrink: 0;
}

.ai-input input {
    flex: 1;
    padding: 8px 12px;
    background: #3c3c3c;
    border: 1px solid #4c4c4c;
    border-radius: 4px;
    color: #d4d4d4;
    font-family: 'Consolas', monospace;
    font-size: 14px;
}

.ai-input button {
    padding: 8px 16px;
    background: #0e639c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.ai-input button:hover {
    background: #1177bb;
}

.error {
    color: #f14c4c;
    padding: 15px;
    background: rgba(241, 76, 76, 0.1);
    border-radius: 4px;
    margin: 10px;
    border: 1px solid rgba(241, 76, 76, 0.3);
}

.error p {
    margin: 5px 0;
    line-height: 1.4;
}

.loading {
    color: #569cd6;
    font-style: italic;
    padding: 15px;
    text-align: center;
}

/* AI Response Formatting */
.ai-response pre {
    background: #252526;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid #333;
}

.ai-response code {
    /* Styles for code inside <pre> */
    background: transparent; /* No background inside pre */
    color: #d4d4d4;
    font-family: 'Consolas', monospace;
}
.ai-response pre > code {
    padding: 0; /* No extra padding inside pre */
}

/* Styles for inline `code` elements outside of <pre> */
.ai-response p > code, .ai-response li > code, .ai-response a > code {
    background: #3c3c3c;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em; /* Slightly smaller for inline code */
    color: #9cdcfe; /* Specific color for inline code */
}

.ai-response p {
    margin: 10px 0;
    line-height: 1.5;
}

.ai-response ul, .ai-response ol {
    margin: 10px 0;
    padding-left: 20px;
}

.ai-response li {
    margin: 5px 0;
    line-height: 1.5;
}

.ai-response h1, .ai-response h2, .ai-response h3 {
    margin: 15px 0 10px 0;
    color: #569cd6;
}

.ai-response h1 { font-size: 1.5em; }
.ai-response h2 { font-size: 1.3em; }
.ai-response h3 { font-size: 1.1em; }

/* Learning Content Styles */
.learning-nav {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.learning-nav h4 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.learning-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.learning-nav li {
    margin: 0;
}

.learning-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

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

.learning-section {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    margin-top: 30px;
}

.learning-subsection {
    color: var(--text-primary);
    margin-top: 25px;
}

.learning-topic {
    color: var(--text-secondary);
    margin-top: 20px;
}

.exercise, .practice {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.tip, .note {
    background: var(--bg-secondary);
    border-left: 4px solid var(--text-secondary);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.tip strong, .note strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 5px;
}

/* Code block improvements */
pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    overflow-x: auto;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Make the AI response section more readable */
#ai-response {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
}

#ai-response p {
    margin: 1em 0;
}

#ai-response ul, #ai-response ol {
    margin: 1em 0;
    padding-left: 2em;
}

#ai-response li {
    margin: 0.5em 0;
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

/* Settings Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #252526;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #d4d4d4;
    font-size: 1.5em;
}

.close-modal {
    background: none;
    border: none;
    color: #858585;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #d4d4d4;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: flex-end;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section h3 {
    color: #d4d4d4;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    color: #d4d4d4;
    margin-bottom: 5px;
}

.api-key-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-input input {
    flex: 1;
    padding: 8px 12px;
    background: #3c3c3c;
    border: 1px solid #4c4c4c;
    border-radius: 4px;
    color: #d4d4d4;
    font-family: 'Consolas', monospace;
    font-size: 14px;
}

.api-key-input button {
    background: none;
    border: none;
    color: #858585;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

.api-key-input button:hover {
    background-color: #3c3c3c;
    color: #d4d4d4;
}

.save-settings {
    background: #0e639c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s;
}

.save-settings:hover {
    background: #1177bb;
}

/* Response Toggle Styles */
.response-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.response-toggle {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #252526;
    border-bottom: 1px solid #333;
}

.toggle-btn {
    background: #3c3c3c;
    color: #d4d4d4;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.15s, color 0.15s;
}

.toggle-btn:hover {
    background: #4c4c4c;
}

.toggle-btn.active {
    background: #0e639c;
    color: white;
}

.raw-response {
    background: #1e1e1e;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
}

.raw-response pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #d4d4d4;
}

.formatted-response {
    padding: 15px;
}

/* Formatted Content Styles */
.formatted-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
    color: #d4d4d4;
}

.content-nav {
    background: #252526;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #333;
}

.content-nav h4 {
    margin: 0 0 10px 0;
    color: #569cd6;
}

.content-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.content-nav li {
    margin: 0;
}

.content-nav a {
    color: #d4d4d4;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    background: #1e1e1e;
    border: 1px solid #333;
    transition: all 0.2s ease;
}

.content-nav a:hover {
    background: #0e639c;
    color: white;
    border-color: #0e639c;
}

.code-block {
    background: #1e1e1e;
    border-radius: 8px;
    margin: 15px 0;
    overflow: hidden;
}

.code-header {
    background: #252526;
    padding: 8px 15px;
    color: #858585;
    font-size: 0.9em;
    border-bottom: 1px solid #333;
}

.code-block pre {
    margin: 0;
    padding: 15px;
    overflow-x: auto;
}

.special-section {
    background: #252526;
    border-left: 4px solid;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.special-section i {
    margin-right: 8px;
    color: #569cd6;
}

.exercise { border-left-color: #4CAF50; }
.practice { border-left-color: #2196F3; }
.tip { border-left-color: #FFC107; }
.note { border-left-color: #9C27B0; }

.content-link {
    color: #569cd6;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.content-link:hover {
    text-decoration: underline;
}

blockquote {
    background: #252526;
    border-left: 4px solid #569cd6;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

blockquote i {
    color: #569cd6;
    margin-right: 8px;
}

h1, h2, h3 {
    color: #569cd6;
    margin: 1.5em 0 0.8em 0;
    scroll-margin-top: 20px;
}

h1 { font-size: 1.8em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.2em; }

p {
    margin: 1em 0;
    line-height: 1.6;
}

ul, ol {
    margin: 1em 0;
    padding-left: 2em;
}

li {
    margin: 0.5em 0;
}

code {
    background: #252526;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
}

/* Next Topic Button */
.next-topic-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0e639c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 20px auto;
    transition: background-color 0.2s;
}

.next-topic-btn:hover {
    background: #1177bb;
}

.next-topic-btn i {
    font-size: 16px;
}

/* Success Message Styles */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.success-message i {
    font-size: 20px;
}

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

/* Settings Button in Error Messages */
.settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0e639c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    transition: background-color 0.2s;
}

.settings-btn:hover {
    background: #1177bb;
}

.settings-btn i {
    font-size: 16px;
}

.error {
    background: rgba(241, 76, 76, 0.1);
    border: 1px solid rgba(241, 76, 76, 0.3);
    color: #f14c4c;
    padding: 20px;
    border-radius: 8px;
    margin: 15px;
    line-height: 1.5;
}

.error p {
    margin: 10px 0;
}

.error i {
    margin-right: 8px;
}