/* Code2Bricks Parser v1.2.0 - Main Styles */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #fff;
    height: 100vh;
    overflow: hidden;
}

/* Header Styles */
.header {
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.header h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-subtitle {
    font-size: 0.8rem;
    color: #888;
    margin-left: 1rem;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.convert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.convert-btn:hover {
    transform: translateY(-1px);
}

.copy-btn {
    background: #28a745;
    border: none;
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.copy-btn:hover {
    background: #218838;
}

/* Main Layout */
.main-content {
    display: flex;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.resizable-panel {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    overflow: hidden;
}

.code-panel {
    width: 20%;
    min-width: 250px;
    flex-shrink: 0;
}

.preview-panel {
    flex: 1;
    min-width: 300px;
}

.output-panel {
    width: 20%;
    min-width: 280px;
    flex-shrink: 0;
}

.resize-handle {
    width: 6px;
    background: #333;
    cursor: ew-resize;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
    user-select: none;
    z-index: 10;
}

.resize-handle:hover {
    background: #667eea;
    width: 8px;
}

.resize-handle.resizing {
    background: #4CAF50;
    width: 8px;
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1px;
    transition: all 0.2s ease;
}

.resize-handle:hover::before {
    background: rgba(255, 255, 255, 0.8);
    height: 60px;
}

.panel {
    background: #1a1a1a;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel:last-child {
    border-right: none;
}

.panel-header {
    background: #2a2a2a;
    padding: 1rem;
    border-bottom: 1px solid #333;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    min-height: 50px;
    display: flex;
    align-items: center;
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Code Editor Styles */
.code-sections {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #333;
}

.code-section {
    background: #1a1a1a;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 0;
}

.code-section-header {
    background: #2a2a2a;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #ccc;
    font-weight: 500;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-btn {
    background: #3a3a3a;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.format-btn:hover {
    background: #4a4a4a;
    border-color: #667eea;
    transform: translateY(-1px);
}

.format-btn:active {
    transform: translateY(0);
    background: #667eea;
}

.format-btn svg {
    width: 14px;
    height: 14px;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2a2a2a;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    color: #fff;
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #444;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    color: #ddd;
}

.tip-link {
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.tip-link:hover {
    color: #8b9ef3;
}

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

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

.code-section-content {
    flex: 1;
    padding: 0.5rem;
    overflow: hidden;
}

/* Prism Code Editor Styles */
.code-editor-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    max-height: 100%;
}

.code-editor-wrapper pre {
    margin: 0;
    height: 100%;
    max-height: 100%;
    background: transparent !important;
    border: none;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-editor-wrapper code {
    background: transparent !important;
    font-family: inherit;
    outline: none;
    border: none;
    tab-size: 2;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: block;
    min-height: 100%;
}

/* Allow Prism.js to override colors for syntax highlighting */
.code-editor-wrapper code[class*="language-"] {
    color: #ccc; /* Default light color for unhighlighted text */
}

/* Specific styles for contenteditable code elements */
#htmlInput, #cssInput, #jsInput {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Override Prism.js white-space settings */
pre[class*="language-"] {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

code[class*="language-"] {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Enhanced status bar with feature indicators */
.status-bar {
    background: #2a2a2a;
    padding: 0.5rem 1rem;
    border-top: 1px solid #333;
    font-size: 0.8rem;
    color: #888;
    display: flex;
    justify-content: space-between;
    min-height: 35px;
    align-items: center;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.status-dot.error {
    background: #dc3545;
}

.feature-indicators {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
}

.feature-indicator {
    background: #333;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #ccc;
}

.feature-indicator.active {
    background: #28a745;
    color: white;
}

/* Preview Styles */
.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Output Toggle Styles */
.output-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #667eea;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #4CAF50;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 0.9rem;
    color: #a0a0a0;
    font-weight: 500;
}

/* JSON Output Styles */
.json-output {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Bricks Preview Styles */
.bricks-preview {
    flex: 1;
    padding: 1rem;
    overflow: auto;
    background: #1e1e1e;
    color: #fff;
}

.structure-tree {
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.element-node {
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
    border-left: 1px solid #333;
    margin-left: 1rem;
    padding-left: 1rem;
    position: relative;
}

.element-node:before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    width: 12px;
    height: 1px;
    background: #333;
}

.element-type {
    background: #667eea;
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
    min-width: 80px;
    text-align: center;
}

.element-type.section { background: #ff6b6b; }
.element-type.container { background: #4ecdc4; }
.element-type.block { background: #45b7d1; }
.element-type.heading { background: #96ceb4; }
.element-type.text-basic { background: #ffeaa7; color: #333; }
.element-type.text-link { background: #fd79a8; }
.element-type.nav { background: #a29bfe; }
.element-type.code { background: #6c5ce7; }

.element-label {
    color: #a0a0a0;
    margin-left: 0.5rem;
}

.element-classes {
    color: #ffd32a;
    margin-left: 0.5rem;
}

.element-text {
    color: #74b9ff;
    margin-left: 0.5rem;
    font-style: italic;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.json-content {
    background: transparent;
    width: 100%;
    flex: 1;
    border: none;
    color: #fff;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.error {
    background: #ff4444;
    color: white;
    padding: 0.8rem 1rem;
    margin: 0 1rem 1rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Override Prism theme colors for dark mode */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #999; }
.token.punctuation { color: #ccc; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #f92672; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #a6e22e; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #f8f8f2; }
.token.atrule, .token.attr-value, .token.keyword { color: #66d9ef; }
.token.function, .token.class-name { color: #fd971f; }
.token.regex, .token.important, .token.variable { color: #fd971f; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2a2a2a; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #777; }