:root {
    --bg-main: #ffffff;
    --bg-alt: #f8fafc;
    --text-bold: #0f172a;
    --text-regular: #334155;
    --text-dim: #64748b;
    --primary: #2563eb;
    --primary-soft: #dbeafe;
    --border: #e2e8f0;
    --radius: 6px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --transition: all 0.15s ease-in-out;
}

body.dark-mode {
    --bg-main: #020617;
    --bg-alt: #0f172a;
    --text-bold: #f8fafc;
    --text-regular: #cbd5e1;
    --text-dim: #94a3b8;
    --primary: #3b82f6;
    --primary-soft: #1e3a8a;
    --border: #1e293b;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-regular);
    line-height: 1.6;
    transition: var(--transition);
    -webkit-font-smoothing: antialiased;
}

.app-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 48px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-bold);
    text-transform: uppercase;
}

.brand .tag {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

.btn-theme {
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-theme:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Selectors */
.translator-interface {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.selector-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-dropdown {
    flex: 1;
    position: relative;
}

.dropdown-trigger {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-bold);
}

.dropdown-trigger:hover {
    border-color: var(--primary);
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 50;
    display: none;
    flex-direction: column;
    max-height: 320px;
}

.dropdown-content.show {
    display: flex;
}

.search-bar {
    padding: 10px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-bold);
    outline: none;
    font-size: 0.85rem;
}

.options-list {
    overflow-y: auto;
    flex: 1;
}

.option-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.85rem;
}

.option-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.btn-swap {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: var(--transition);
}

.btn-swap:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Editor */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

@media (max-width: 800px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .selector-row {
        flex-direction: column;
    }
    .btn-swap {
        transform: rotate(90deg);
    }
}

.pane {
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    position: relative;
}

.pane-title {
    padding: 12px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
}

textarea, .display-area {
    width: 100%;
    height: 360px;
    padding: 24px;
    border: none;
    background: transparent;
    color: var(--text-bold);
    font-size: 1.1rem;
    line-height: 1.7;
    resize: none;
    outline: none;
}

.display-area {
    background: var(--bg-alt);
    overflow-y: auto;
    white-space: pre-wrap;
}

.pane-info {
    padding: 10px 20px;
    font-size: 0.75rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.btn-submit-container {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.btn-translate {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 14px 60px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-translate:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-translate:disabled {
    background: var(--border);
    cursor: not-allowed;
    transform: none;
}

/* Loading */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(var(--bg-main), 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.ring {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotate 0.6s linear infinite;
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

footer {
    margin-top: auto;
    padding-top: 60px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
}
