/* ========== БАЗОВЫЕ ПЕРЕМЕННЫЕ ========== */
:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252525;
    --bg-tertiary: #2d2d2d;
    --bg-hover: #3a3a3a;
    --border-color: #3a3a3a;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: all 0.25s ease;
    --collapsed-left-offset: 85px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

body {
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    touch-action: pan-y;
}

::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ========== ЗАГРУЗОЧНЫЙ ЭКРАН ========== */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.4s ease;
}

.welcome-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.spinner-container i {
    font-size: 3rem;
    color: #fff;
}

/* ========== ЭКРАН ВХОДА ========== */
.choice-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.choice-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 90%;
    max-width: 440px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-img {
    width: 70px;
    height: 70px;
    margin-bottom: 12px;
    border-radius: 50%;
    object-fit: cover;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-diamkey {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 40px;
    background: linear-gradient(135deg, #5a5a6e, #3a3a44);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    margin-top: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-diamkey:hover {
    background: linear-gradient(135deg, #6a6a7e, #4a4a54);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.15);
}

.footer-note {
    margin-top: 20px;
    font-size: 13px;
    color: #5a5a5a;
}

.footer-note a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-note a:hover {
    color: #fff;
}

/* ========== ОСНОВНОЙ ИНТЕРФЕЙС ========== */
.main-ui {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.main-ui.visible {
    opacity: 1;
}

.title-bar {
    height: 48px;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    -webkit-app-region: drag;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.title-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    -webkit-app-region: no-drag;
    position: relative;
}

.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.logo-icon-img {
    height: 28px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Панелька двух кнопок в свёрнутом виде — компактная */
.collapsed-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    left: var(--collapsed-left-offset, 85px);
    white-space: nowrap;
    z-index: 5;
}

.collapsed-actions.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Скрытие текста логотипа при свёрнутом сайдбаре */
.title-bar.collapsed .logo-text {
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
}

.title-bar.collapsed .collapsed-actions {
    opacity: 1;
    visibility: visible;
}

.action-btn-icon {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    border-radius: 50%;
}

.action-btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========== САЙДБАР ========== */
.app-container {
    display: flex;
    height: calc(100dvh - 48px);
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    transition: width 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    flex-shrink: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    border-right: none;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.chat-view,
.folders-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 0 16px;
    margin-bottom: 20px;
}

/* Фрейм с двумя кнопками */
.action-buttons-frame {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 28px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 12px;
}

.frame-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.frame-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

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

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 28px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: #5a5a5a;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.search-box i {
    color: var(--text-secondary);
    font-size: 14px;
    margin-right: 10px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: var(--text-primary);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.history-group {
    margin-bottom: 16px;
}

.history-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 12px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    position: relative;
}

/* Поддержка цветной рамки у чатов в папках */
.history-item[style*="border-left"] {
    border-radius: 0 20px 20px 0;
    background: var(--bg-tertiary);
}

.history-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.history-item.active {
    background: var(--bg-hover);
    border-color: #5a5a5a;
}

.chat-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-actions-hover {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-item:hover .chat-actions-hover {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.chat-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    border-radius: 50%;
}

.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
/* Панель пользователя */
.user-panel {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    background: var(--bg-secondary);
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    cursor: default;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.user-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.user-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-width: 220px;
    overflow: hidden;
    z-index: 100;
    display: none;
    flex-direction: column;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

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

.user-dropdown button {
    background: transparent;
    border: none;
    padding: 10px 16px;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.user-dropdown button:hover {
    background: var(--bg-hover);
}

/* ========== СООБЩЕНИЯ ========== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeSlideUp 0.2s ease;
    margin: 0;
    padding: 0;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    margin: 0;
}

.message.user .avatar {
    background: #2d2d2d;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar i {
    font-size: 20px;
    color: var(--text-primary);
}

.message-content-wrapper {
    max-width: calc(100% - 50px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-content {
    background: var(--bg-tertiary);
    padding: 8px 14px;
    border-radius: 20px;
    line-height: 1.45;
    font-size: 15px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    margin: 0;
}

.message.user .message-content {
    background: #2d2d2d;
    border-color: #3a3a3a;
    color: white;
}

.message-time {
    font-size: 10px;
    color: var(--text-secondary);
    padding: 0 6px;
    text-align: right;
    margin-top: 2px;
}

.message-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
    padding: 20px;
}

.empty-logo {
    width: 80px;
    height: auto;
    filter: brightness(0.9);
}

.empty-text {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-input-area {
    width: 100%;
    max-width: 600px;
    margin-top: 24px;
}

.empty-input-area .input-wrapper {
    background: var(--bg-tertiary);
}

.date-divider {
    text-align: center;
    margin: 8px 0;
    position: relative;
}

.date-divider span {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ========== ОБЛАСТЬ ВВОДА ========== */
.input-area {
    padding: 0 24px 24px 24px;
    background: transparent;
    margin-top: auto;
    width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: 32px;
    padding: 6px 12px 6px 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.input-wrapper:focus-within {
    border-color: #5a5a5a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    max-height: 120px;
    outline: none;
    font-size: 15px;
    line-height: 1.4;
    padding: 8px 0;
    color: var(--text-primary);
    font-family: inherit;
}

textarea::placeholder {
    color: #6a6a6a;
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a1a1a;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 18px;
}

.send-btn:not(:disabled):hover {
    background: #2a2a2a;
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #3a3a3a;
    color: #aaa;
}

/* ========== ПАПКИ ========== */
.folders-page {
    padding: 24px;
    overflow-y: auto;
}

.folders-page-header {
    text-align: center;
    margin-bottom: 24px;
}

.folders-page-header h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.folders-page-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.folder-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.folders-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.folder-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.folder-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.folder-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.folder-info {
    flex: 1;
    min-width: 120px;
}

.folder-name {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.folder-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.folder-stats {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.folder-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.folder-actions button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.folder-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: #5a5a5a;
}

.folders-page-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== МОДАЛКИ ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-container {
    background: var(--bg-secondary);
    border-radius: 28px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.close-modal {
    display: none;
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.code-editor {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-family: monospace;
    font-size: 14px;
    padding: 12px;
    width: 100%;
    color: var(--text-primary);
    resize: vertical;
}

.runner-iframe {
    width: 100%;
    height: 400px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: white;
    margin-top: 16px;
}

/* ========== ОБЩИЕ КНОПКИ ========== */
.btn {
    padding: 8px 18px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-primary {
    background: #3a3a3a;
    color: white;
    border-color: #4a4a4a;
}

.btn-primary:hover {
    background: #4a4a4a;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

/* ========== БЛОКИ КОДА ========== */
.code-block-wrapper {
    margin: 12px 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #1a1a1e;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #25252a;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 8px;
}

.code-block-header span {
    font-weight: 600;
}

.code-block-actions {
    display: flex;
    gap: 8px;
}

.code-block-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.code-block-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.code-block-wrapper pre {
    margin: 0;
    padding: 12px;
    background: #1a1a1e;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    border: none;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== TOAST ========== */
.toast-container {
    position: fixed;
    top: 70px;
    right: 16px;
    left: auto;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border-left: 4px solid;
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 280px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    border: 1px solid var(--border-color);
    animation: toastSlideRight 0.3s ease;
}

.toast.info { border-left-color: #6c6c6c; }
.toast.warning { border-left-color: #b0b0b0; }
.toast.error { border-left-color: #c0392b; }
.toast.success { border-left-color: #4a4a4a; }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; font-size: 12px; }
.toast-message { font-size: 11px; color: var(--text-secondary); }

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

@keyframes toastSlideRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== АДАПТИВ ========== */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 300;
        height: 100%;
        width: 85%;
        max-width: 280px;
        background: var(--bg-secondary);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        border-right: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    }
    .collapsed-actions {
        display: none !important;
    }
    .logo-text {
        font-size: 16px;
    }
    .title-bar-left {
        gap: 8px;
    }
    .message {
        max-width: 95%;
        gap: 8px;
    }
    .message-content {
        font-size: 14px;
        padding: 6px 12px;
    }
    .avatar {
        width: 34px;
        height: 34px;
    }
    .avatar i {
        font-size: 18px;
    }
    .messages-container {
        padding: 16px;
        gap: 14px;
    }
    .input-area {
        padding: 0 16px 20px;
    }
    .input-wrapper {
        padding: 6px 12px;
    }
    textarea {
        font-size: 16px;
        padding: 8px 0;
    }
    .send-btn {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }
    .folders-page {
        padding: 16px;
    }
    .folder-card {
        padding: 12px;
        gap: 10px;
    }
    .folder-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    .folder-info {
        min-width: 100px;
    }
    .folder-name {
        font-size: 15px;
    }
    .empty-text {
        font-size: 18px;
    }
    .empty-logo {
        width: 70px;
    }
    .choice-container {
        padding: 24px;
        width: 85%;
    }
    .logo h1 {
        font-size: 24px;
    }
    .logo p {
        font-size: 13px;
    }
    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    .empty-input-area {
        max-width: 90%;
    }
    .frame-btn {
        padding: 12px 0;
        font-size: 14px;
    }
    .search-box {
        padding: 10px 16px;
    }
    .history-item {
        padding: 14px 12px;
        font-size: 15px;
    }
    .chat-action-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .user-panel {
        padding: 16px;
        gap: 12px;
    }
    .user-avatar {
        width: 52px;
        height: 52px;
    }
    .user-name {
        font-size: 16px;
    }
    .user-menu-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .modal-container {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .message-content {
        font-size: 13px;
        padding: 5px 10px;
    }
    .code-block-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .code-block-actions {
        align-self: flex-end;
    }
    .folder-actions button {
        width: 40px;
        height: 40px;
    }
    .empty-text {
        font-size: 16px;
    }
    .empty-logo {
        width: 60px;
    }
}
