/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
    align-items: center;
}

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

.control-group label {
    font-weight: 600;
    color: #333;
}

select {
    padding: 8px 15px;
    border: 2px solid #667eea;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

select:hover {
    border-color: #764ba2;
}

select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

/* Editor Container */
.editor-container {
    background: white;
    padding: 20px;
}

.editor-wrapper {
    display: flex;
    flex-direction: column;
}

.editor-wrapper h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.code-editor {
    min-height: 500px;
    padding: 20px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: border-color 0.3s;
    position: relative;
}

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

.code-editor:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

/* Syntax Highlighting Styles */

/* Region Color Mappings - Default Theme */
.def-comment { color: #008000; font-style: italic; opacity: 0.8; }
.def-string { color: #d32f2f; font-weight: 500; }
.def-number { color: #0288d1; font-weight: 600; }
.def-keyword { color: #9c27b0; font-weight: bold; }
.def-operator { color: #424242; font-weight: 600; }
.def-identifier { color: #212121; }
.def-function { color: #f57c00; font-weight: 600; }
.def-type { color: #00897b; font-weight: 600; }
.def-constant { color: #1565c0; font-weight: bold; }
.def-variable { color: #5e35b1; }
.def-symbol { color: #424242; }
.def-tag { color: #c62828; font-weight: 600; }
.def-attribute { color: #d84315; }
.def-error { color: #c62828; background-color: #ffebee; font-weight: bold; }
.def-directive { color: #6a1b9a; font-weight: bold; }
.def-special { color: #ad1457; font-weight: 600; }

/* Dark Theme */
body.theme-dark .code-editor {
    background: #1e1e1e;
    color: #d4d4d4;
}

body.theme-dark .def-comment { color: #6a9955; }
body.theme-dark .def-string { color: #ce9178; }
body.theme-dark .def-number { color: #b5cea8; }
body.theme-dark .def-keyword { color: #c586c0; font-weight: bold; }
body.theme-dark .def-operator { color: #d4d4d4; }
body.theme-dark .def-identifier { color: #d4d4d4; }
body.theme-dark .def-function { color: #dcdcaa; font-weight: 600; }
body.theme-dark .def-type { color: #4ec9b0; font-weight: 600; }
body.theme-dark .def-constant { color: #4fc1ff; font-weight: bold; }
body.theme-dark .def-variable { color: #9cdcfe; }
body.theme-dark .def-tag { color: #569cd6; font-weight: 600; }
body.theme-dark .def-attribute { color: #9cdcfe; }

/* Light Theme */
body.theme-light .code-editor {
    background: #ffffff;
    color: #000000;
}

/* Info Panel */
.info-panel {
    padding: 30px;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
}

.info-panel h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.info-panel p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #555;
}

.info-panel ul {
    margin-left: 25px;
    margin-top: 10px;
}

.info-panel li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #555;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .code-editor {
        font-size: 14px;
        min-height: 400px;
    }
}
