/* SF Pro Display Font */
@font-face {
    font-family: 'SF Pro Display';
    src: url('fonts/SF-Pro-Display-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('fonts/SF-Pro-Display-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('fonts/SF-Pro-Display-Semibold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('fonts/SF-Pro-Display-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

/* Переменные */
:root {
    --primary: #FFD19A;
    --primary-light: #FFE4B5;
    --primary-lighter: #FFF4E0;
    --accent: #FFAB5E;
    --bg-primary: #FFFBF5;
    --bg-secondary: #FFF9F0;
    --glass-bg: rgba(255, 209, 154, 0.15);
    --glass-border: rgba(255, 171, 94, 0.2);
    --text-primary: #000000;
    --text-secondary: #2D2D2D;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    /* --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.08); */
    --radius: 16px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* background: linear-gradient(135deg, #ffe548 0%, #181b12 25%, #181b12 50%, #181b12 75%, #2fad35 100%); */
    background: #fff9f0;
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ASCII фон */
#ascii-canvas {
    position: fixed;
    inset: 0;
    color: rgba(245, 237, 220, 0.08);
    font-size: 11px;
    line-height: 13px;
    letter-spacing: 2px;
    white-space: pre;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

/* Основной контейнер */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    padding: 20px;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* Стеклянная панель */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Боковая панель */
.sidebar {
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    gap: 24px;
}

/* Лого */
.logo-container {
    padding: 8px 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#echo-logo {
    width: 100%;
    max-width: 230px;
    height: 64px;
    display: block;
}

.bar {
    transition: height 260ms ease, y 260ms ease;
    transform-origin: center 100%;
}

/* Анимация полосок эквалайзера */
@keyframes pulse-bar {

    0%,
    100% {
        transform: scaleY(1);
        opacity: 0.8;
    }

    50% {
        transform: scaleY(1.3);
        opacity: 1;
    }
}

/* Навигация по отделам */
.departments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 0 12px;
}

.dept-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: 1px solid rgba(255, 171, 94, 0.3);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}


.dept-btn.active {
    background: #FFD19A;
    border-color: #FFD19A;
    color: #000000;
    font-weight: 500;
}

/* .dept-btn.active::before {
    display: none;
}
 */
.dept-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #f5eddc, #FFE4C4);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 237, 220, 0.3);
}

.dept-name {
    flex: 1;
}

/* Футер сайдбара */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    padding-top: 16px;
}

.view-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(245, 237, 220, 0.2);
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: rgba(255, 209, 154, 0.6);
    color: var(--text-primary);
    font-weight: 500;
    border-color: rgba(255, 171, 94, 0.4);
}

/* Кнопка выхода */
.logout-btn {
    width: 100%;
    padding: 10px 15px;
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.3);
    border-radius: 8px;
    color: #ff5252;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

.logout-btn:hover {
    background: rgba(255, 82, 82, 0.2);
    border-color: rgba(255, 82, 82, 0.5);
    transform: translateX(2px);
}

/* Основной контент */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    padding: 32px;
    gap: 24px;
    height: 100%;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Заголовок */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.header-info {
    flex: 1;
}

.header-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Чипы */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.chip {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 18px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0.75;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease,
        color 0.2s ease;
}

.chip:hover {
    opacity: 1;
    background: rgba(255, 171, 94, 0.4);
    border-color: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.chip.active {
    opacity: 1;
    background: linear-gradient(120deg, rgba(255, 209, 154, 0.95), rgba(255, 171, 94, 0.95));
    border-color: rgba(255, 171, 94, 0.9);
    color: #1f1205;
    box-shadow:
        0 8px 24px rgba(255, 171, 94, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

/* Редактор */
.editor-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

/* Тулбар редактора */
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(232, 213, 196, 0.3);
    box-shadow: 0 2px 8px rgba(232, 213, 196, 0.1);
}

.toolbar-group {
    display: flex;
    gap: 6px;
}

.highlight-palette {
    display: flex;
    gap: 6px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(255, 171, 94, 0.3);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: rgba(255, 209, 154, 0.4);
    border-color: rgba(255, 171, 94, 0.5);
    color: var(--text-primary);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.highlight-btn {
    border-color: transparent;
    color: #111;
}

.highlight-green {
    background: rgba(46, 204, 113, 0.25);
}

.highlight-yellow {
    background: rgba(255, 206, 84, 0.35);
}

.highlight-red {
    background: rgba(255, 99, 99, 0.25);
}

.highlight-btn:hover {
    filter: brightness(0.95);
}

.highlight-clear {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 171, 94, 0.3);
    margin: 0 4px;
}

/* Счетчик слов */
.word-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.counter-label {
    font-weight: 500;
}

.counter-value {
    font-weight: 700;
    color: var(--text-primary);
}

.counter-separator {
    color: rgba(45, 45, 45, 0.3);
}

/* Панель поиска и замены */
.search-replace-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 209, 154, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 171, 94, 0.3);
}

.search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 244, 224, 0.7);
    border: 1px solid rgba(255, 171, 94, 0.4);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    background: rgba(255, 228, 181, 0.8);
    border-color: rgba(255, 171, 94, 0.6);
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(255, 171, 94, 0.4);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-btn:hover {
    background: rgba(255, 209, 154, 0.4);
    border-color: rgba(255, 171, 94, 0.5);
    color: var(--text-primary);
}

.search-btn:active {
    transform: scale(0.95);
}

.search-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    padding: 0 8px;
}

/* Область редактора с подсветкой */
.editor-area {
    flex: 1;
    min-height: 0;
    position: relative;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    border: 1px solid rgba(232, 213, 196, 0.25);
    padding: 4px;
    box-shadow:
        inset 0 2px 10px rgba(0, 0, 0, 0.02),
        0 4px 16px rgba(232, 213, 196, 0.08);
    overflow: hidden;
}

.editor-highlight {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    padding: 20px;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 14px;
    line-height: 1.7;
    color: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    border-radius: 12px;
}

.editor-field {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    padding: 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    resize: none;
    outline: none;
    overflow: auto;
    caret-color: #6B5D54;
}

.editor-field::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.editor-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Кнопки */
.upload-btn,
.send-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 0px 0px 12px 0px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(245, 237, 220, 0.4);
}

.upload-btn {
    background: transparent;
    color: var(--text-primary);
}

.upload-btn:hover {
    background: rgba(255, 209, 154, 0.3);
    border-color: rgba(255, 171, 94, 0.5);
}

.send-btn.primary {
    background: #FFD19A;
    color: #000000;
    border-color: #FFD19A;
    font-weight: 500;
}

.send-btn.primary:hover {
    background: #FFAB5E;
    border-color: #FFAB5E;
}

.send-btn.primary:active {
    transform: scale(0.98);
}

/* Тест */
.test-container {
    display: grid;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.test-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.test-prompt-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 2;
    min-height: 0;
}

.test-result-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.test-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.audio-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.audio-controls .field-input {
    flex: 1;
    height: auto;
    min-height: 100px;
    resize: none;
    border-radius: 0px 0px 0px 12px;
}

.audio-controls .send-btn {
    width: 48px;
    height: 100px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.field-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.field-input {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 0px 0px 0px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.field-textarea {
    flex: 1;
    min-height: 0;
    resize: none;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(245, 237, 220, 0.3);
    border-radius: 12px 12px 0px 0px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
    line-height: 1.6;
}

.field-input {
    height: 46px;
}

.field-textarea:focus,
.field-input:focus {
    background: rgba(255, 228, 181, 0.226);
    border-color: rgba(255, 172, 94, 0.11);
}

.output-content {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 12px;
    overflow-y: auto;
    min-height: 0;
}

.output-line {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 171, 94, 0.2);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
}

.output-line:last-child {
    border-bottom: none;
}

.output-empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* Подсветка синтаксиса */

.editor-highlight .highlight {
    padding: 0;
    border-radius: 0;
}

.editor-highlight .highlight-green {
    background: #c6efce;
}

.editor-highlight .highlight-yellow {
    background: #ffeb9c;
}

.editor-highlight .highlight-red {
    background: #ffc7ce;
}

/* Адаптив */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .test-grid {
        grid-template-columns: 1fr;
    }
}