/* ============================================================
   TOML to YAML Converter — Styles
   Theme: Dark mode with Royal Purple palette
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #6C5CE7;
    --primary-rgb: 108, 92, 231;
    --secondary: #A29BFE;
    --secondary-rgb: 162, 155, 254;
    --accent: #81ECEC;
    --accent-rgb: 129, 236, 236;
    --bg: #0F0A1A;
    --bg-hover: rgba(108, 92, 231, 0.1);
    --border: rgba(108, 92, 231, 0.15);
    --border-hover: rgba(108, 92, 231, 0.3);
    --text: #E8E6F0;
    --text-secondary: #B8B5CC;
    --text-muted: rgba(232, 230, 240, 0.45);
    --success: #00B894;
    --danger: #FF6B6B;
    --warning: #FDCB6E;
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 250ms ease;
    --glass-bg: rgba(15, 10, 26, 0.65);
    --glass-border: rgba(108, 92, 231, 0.12);
    --glass-blur: blur(20px);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 15%, rgba(var(--primary-rgb), 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 85%, rgba(var(--accent-rgb), 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.4rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

.format-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
}

.format-select option {
    background: var(--bg);
}

.toolbar-divider {
    width: 1px;
    background: var(--border);
    margin: 0 0.25rem;
}

.tool-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

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

.tool-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.tool-btn.active {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.convert-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #7c6cf0);
    color: #fff;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.convert-btn:hover {
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
    transform: translateY(-1px);
}

/* Editor Grid */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.editor-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
}

.editor-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.editor-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.editor-badge.toml {
    background: rgba(253, 203, 110, 0.15);
    color: var(--warning);
}

.editor-badge.yaml {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.editor-badge.json {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary);
}

.editor-actions {
    display: flex;
    gap: 0.3rem;
}

.editor-body {
    flex: 1;
    position: relative;
}

.editor-body textarea {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding: 1rem;
    border: none;
    resize: vertical;
    background: transparent;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    outline: none;
    tab-size: 2;
}

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

/* Error Bar */
.error-bar {
    display: none;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    background: rgba(255, 107, 107, 0.1);
    border-top: 1px solid rgba(255, 107, 107, 0.2);
    color: var(--danger);
}

.error-bar.visible {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    padding: 0.6rem;
    margin-top: 1rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stats-bar span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-num {
    font-family: var(--font-mono);
    color: var(--secondary);
    font-weight: 600;
}

/* File drop */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 10, 26, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
    border: 3px dashed var(--primary);
}

.drop-overlay.visible {
    display: flex;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 300ms ease;
    z-index: 1000;
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 800px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .editor-body textarea {
        min-height: 250px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-divider {
        width: 100%;
        height: 1px;
        margin: 0.25rem 0;
    }
}

@media (max-width: 500px) {
    .app {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .stats-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor-panel {
    animation: fadeIn 250ms ease forwards;
}