:root {
    --primary: #00B894;
    --primary-hover: #00A383;
    --secondary: #55EFC4;
    --accent: #FDCB6E;
    --bg-main: #0A1F1C;
    --bg-surface: #102A26;
    --bg-surface-elevated: #163632;
    --border: rgba(85, 239, 196, 0.2);
    --border-strong: rgba(85, 239, 196, 0.4);
    --text-primary: #FFFFFF;
    --text-secondary: #A0BDB8;
    --danger: #FF7675;
    --radius: 12px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
}

.header-content {
    width: 100%;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.split-view {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Panes */
.pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-main);
}

.input-pane {
    flex: 2;
    border-right: 1px solid var(--border);
}

.options-pane {
    flex: 1;
    max-width: 300px;
    min-width: 250px;
    border-right: 1px solid var(--border);
    background-color: var(--bg-surface-elevated);
}

.output-pane {
    flex: 2;
}

.pane-header {
    padding: 0.75rem 1rem;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 53px;
}

.pane-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Editors */
.editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

textarea#jsonInput {
    width: 100%;
    height: 100%;
    background-color: transparent;
    color: var(--secondary);
    border: none;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    resize: none;
    outline: none;
}

#tsOutput {
    display: block;
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--accent);
    overflow: auto;
    white-space: pre;
    tab-size: 4;
}

/* Options */
.options-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

input[type="text"], select {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus, select:focus {
    border-color: var(--primary);
}

select {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2355EFC4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-main);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--bg-main);
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-secondary:hover { background-color: rgba(0, 184, 148, 0.1); }

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger:hover { background-color: rgba(255, 118, 117, 0.1); }

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--border);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--secondary);
    font-size: 0.75rem;
    cursor: pointer;
}
.btn-text:hover { text-decoration: underline; }

.btn i {
    width: 16px;
    height: 16px;
}

/* Overlays & Toasts */
.error-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 118, 117, 0.1);
    border-top: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    backdrop-filter: blur(4px);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.error-overlay i { width: 16px; height: 16px; }
.error-overlay.hidden { transform: translateY(100%); opacity: 0; }

.toast {
    font-size: 0.75rem;
    color: var(--secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    background-color: rgba(85, 239, 196, 0.1);
    border: 1px solid var(--border);
    transition: opacity 0.3s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* Responsive */
@media (max-width: 900px) {
    .split-view {
        flex-direction: column;
        overflow-y: auto;
    }
    .pane {
        width: 100%;
        height: auto;
        min-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .options-pane {
        max-width: none;
        min-height: auto;
    }
    textarea#jsonInput, #tsOutput {
        min-height: 300px;
    }
}
