/* ===========================
   Neiki's Multi Code Beautifier
   Main Stylesheet
   =========================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #475569;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 24px 32px;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.header-content {
    max-width: 1400px;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== Control Panel ===== */
.control-panel {
    background: var(--bg-secondary);
    padding: 16px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.info-panel {
    display: flex;
    gap: 20px;
    font-size: 12px;
}

.char-count,
.lang-detect {
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.split-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    flex: 1;
    overflow: hidden;
    background: var(--border-color);
}

/* ===== Editor Panels ===== */
.editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    overflow: hidden;
    height: 100%;
    width: 100%;
    min-height: 0; /* Important for flex children */
}

.panel-header {
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Don't shrink header */
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.hint {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Left panel */
.left-panel {
    border-right: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* Right panel */
.right-panel {
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

/* ===== Editor - Input ===== */
.input-editor-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
    background: var(--bg-primary);
    overflow: hidden;
}

.input-highlight {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 16px;
    background: transparent;
    color: var(--text-primary);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.input-highlight code,
.input-highlight code.hljs {
    display: block;
    min-height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0;
    background: transparent !important;
    line-height: inherit;
    font: inherit;
    tab-size: 4;
    white-space: pre-wrap;
    word-wrap: break-word;
}


.editor-textarea {
    position: absolute;
    inset: 0;
    border: none;
    background: transparent;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: var(--text-primary);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    resize: none;
    outline: none;
    overflow: auto;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    min-height: 0;
    z-index: 2;
    white-space: pre-wrap;
    word-wrap: break-word;
    tab-size: 4;
}

.editor-textarea::placeholder {
    color: var(--text-tertiary);
}

.editor-textarea::selection {
    background: rgba(148, 163, 184, 0.25);
    color: transparent;
}

/* Scrollbar styling */
.editor-textarea::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.editor-textarea::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.editor-textarea::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.editor-textarea::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ===== Editor - Output ===== */
.output-display {
    flex: 1;
    margin: 0;
    padding: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-y: auto;
    overflow-x: auto;
    border: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    height: 100%;
    box-sizing: border-box;
    min-height: 0;
}

.output-display code {
    color: var(--text-primary);
}

/* Syntax highlighting overrides for dark theme */
.hljs {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

.hljs-attr {
    color: #50fa7b !important;
}

.hljs-string {
    color: #f1fa8c !important;
}

.hljs-number {
    color: #bd93f9 !important;
}

.hljs-literal {
    color: #8be9fd !important;
}

.hljs-tag {
    color: #ff79c6 !important;
}

.hljs-name {
    color: #8be9fd !important;
}

.hljs-builtin {
    color: #8be9fd !important;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-title.function_ {
    color: #ff79c6 !important;
}

.hljs-comment {
    color: #6272a4 !important;
}

.hljs-variable,
.hljs-title,
.hljs-function {
    color: #50fa7b !important;
}

.hljs-property,
.hljs-selector-class,
.hljs-selector-id {
    color: #8be9fd !important;
}

.output-display::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.output-display::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.output-display::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.output-display::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    padding: 12px 32px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ===== Notification ===== */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--success-color);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* CodeMirror removed - using simple textarea instead */

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .split-container {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .left-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .header {
        padding: 16px 20px;
    }

    .title {
        font-size: 22px;
    }

    .control-panel {
        padding: 12px 20px;
        gap: 10px;
    }

    .controls {
        width: 100%;
        justify-content: space-between;
    }

    .info-panel {
        width: 100%;
        justify-content: space-between;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .editor-textarea,
    .input-highlight,
    .output-display {
        padding: 12px;
        font-size: 12px;
    }

    .footer {
        font-size: 11px;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .controls {
        gap: 8px;
    }

    .btn {
        flex: 1;
        justify-content: center;
        padding: 10px 8px;
    }

    .info-panel {
        flex-direction: column;
        gap: 8px;
    }
}
