* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fafafa;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background-color: #ffffff;
    border-bottom: 1px solid #e1e5e9;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.title-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 48px;
    width: 48px;
    margin-right: 8px;
    object-fit: contain;
}

.title {
    font-size: 1.5em;
    font-weight: 600;
    color: #2d3748;
    margin-top: -2px;
}

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.mode-tabs {
    display: flex;
    gap: 2px;
    background-color: #f7fafc;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
}

.tab-btn.active {
    background-color: #ffffff;
    color: #2d3748;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-btn.inactive {
    color: #718096;
}

.tab-btn.inactive:hover {
    background-color: #edf2f7;
    color: #4a5568;
}

.run-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.run-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.run-button:active {
    transform: translateY(0);
}

.run-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid white;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    min-height: 0;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: border-color 0.2s ease;
    height: calc(100vh - 200px);
}

.editor-container.editor-mode {
    border-color: #cbd5e0;
}

.editor-container.preview-mode {
    border-color: #a0aec0;
}

.editor-header {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.editor-header.editor-mode {
    background-color: #f8fafc;
    color: #4a5568;
}

.editor-header.preview-mode {
    background-color: #f1f5f9;
    color: #475569;
    justify-content: space-between;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.width-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.width-slider {
    width: 150px;
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.width-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.width-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.width-display {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    min-width: 60px;
}

.preset-buttons {
    display: flex;
    gap: 5px;
}

.preset-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: #e5e7eb;
    color: #4b5563;
}

.fullscreen-btn {
    padding: 8px 12px;
    font-size: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.fullscreen-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.code-editor-container {
    flex: 1;
    display: flex;
    background-color: #fafafa;
    min-height: 0;
}

.line-numbers {
    background-color: #f1f5f9;
    color: #9ca3af;
    padding: 20px 12px 20px 20px;
    font-family: 'Consolas', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 14px;
    line-height: 24px;
    text-align: right;
    min-width: 60px;
    user-select: none;
    border-right: 1px solid #e5e7eb;
    white-space: pre;
    overflow: hidden;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
}

.line-highlights {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    height: 24px;
    background-color: rgba(102, 126, 234, 0.1);
    border-left: 3px solid rgba(102, 126, 234, 0.3);
    pointer-events: none;
}

#htmlInput {
    width: 100%;
    height: 100%;
    border: none;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 14px;
    line-height: 24px;
    resize: none;
    outline: none;
    background-color: transparent;
    color: #374151;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    z-index: 2;
}

#htmlInput::placeholder {
    color: #9ca3af;
}


.error-panel {
    background-color: #fef2f2;
    border-top: 1px solid #fca5a5;
    padding: 12px 20px;
    color: #dc2626;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    display: none;
    flex-shrink: 0;
}

.error-panel.show {
    display: block;
    background-color: #fef3cd; /* Changed to warning yellow */
    border-top: 1px solid #fbbf24;
    color: #92400e; /* Changed to warning brown */
}

.preview-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background: linear-gradient(45deg, #f8fafc 25%, transparent 25%), 
                linear-gradient(-45deg, #f8fafc 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f8fafc 75%), 
                linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    overflow: auto;
}

.preview-frame-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: width 0.3s ease;
    max-width: 100%;
    flex-shrink: 0;
}

#output {
    border: none;
    background-color: white;
    width: 100%;
    height: 600px;
    display: block;
}

/* Fullscreen styles */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: none;
    flex-direction: column;
}

.fullscreen-overlay.active {
    display: flex;
}

.fullscreen-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10001;
}

.close-fullscreen-btn {
    width: 50px;
    height: 50px;
    background: #000000;
    border: 2px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.2s ease;
    user-select: none;
}

.close-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.7);
    color: rgba(255, 255, 255, 0.7);
}

.close-fullscreen-btn:active {
    transform: scale(0.95);
}

.fullscreen-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.hidden {
    display: none !important;
}

.status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.fullscreen-overlay.active {
    animation: slideIn 0.3s ease-out;
}


.clear-button {
    background: #f56565;
    border: none;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(245, 101, 101, 0.3);
    min-width: 44px;
}

.clear-button:hover {
    background: #e53e3e;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 101, 101, 0.4);
}

.clear-button:active {
    transform: translateY(0);
}
