/* ========================================================================
   Корпоративные цвета
   ======================================================================== */
:root {
    --primary-orange: #d35400; /* Теплый, насыщенный оранжево-коричневый */
    --primary-orange-hover: #b74a00;
    --primary-orange-light: rgba(211, 84, 0, 0.08);

    --gray-dark: #3a3a3a;
    --gray-medium: #5a6268;
    --gray-light: #7a8187;
    --gray-lighter: #b8bfc6;
    --gray-lightest: #f4f6f8;
    --gray-bg: #e8ecef;

    --white: #ffffff;
    --border-color: rgba(0, 0, 0, 0.06);
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.08);
}


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

body {
    font-feature-settings: normal;
    -webkit-tap-highlight-color: transparent;
    font-family: ui-sans-serif, -apple-system, system-ui, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol';
    font-variation-settings: normal;
    line-height: 1.5;
    tab-size: 4;
    background: #f0f0f0;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

#chat-container {
    width: 100vw;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: row;
}

#main-content {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
}


/* Панель пользователя */
.user-panel {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-panel:hover {
    background: #f0f0f0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f9a875 0%, #f08c6a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}

.user-status {
    font-size: 12px;
    color: #4caf50;
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
}

.logout-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: #f5f5f5;
    color: #e74c3c;
}

.logout-btn svg {
    width: 20px;
    height: 20px;
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Контейнер для кнопок действий */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

/* Название приложения */
.app-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-orange);
    margin-left: 10px;
    text-align: left;
}

/* Стили для кнопок действий */
.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    background: #f9f9f9;
    border: none;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    margin: 0;
    box-sizing: border-box;
}

.action-btn:hover {
    background: #e8e8e8;
}

.action-btn.disabled {
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.action-btn.disabled:hover {
    background: #f9f9f9;
}

.action-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Адаптивность для панели пользователя */
.sidebar.collapsed .user-panel {
    padding: 15px 10px;
}

.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn span {
    display: none;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}


/* Боковая панель с современным градиентом */
.sidebar {
    width: 280px;
    background: #f9f9f9;;
    color: #333;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
    transform: translateX(-220px);
}

.sidebar.collapsed .toggle-btn {
    right: 10px;
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Кнопка сворачивания */
.toggle-btn {
    position: absolute;
    top: 20px;
    right: 15px;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    border: 1px solid #e0e0e0;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #d0d0d0;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-list::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chat-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.main-content {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: -220px;
}

/* Загрузчик */
.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Улучшенные стили для элементов чата */
.chat-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.chat-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.delete-chat-btn:hover {
    background: #cc0000;
}

/* Сообщение об отсутствии чатов */
.no-chats-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

/* Стили для групп дат */
.date-group {
    margin-bottom: 20px;
}

.date-header {
    padding: 8px 15px;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f5f5f5;
    border-left: 3px solid transparent;
}

/* Эффект при наведении на чат */
.chat-item:hover {
    background-color: #0000000a;
    transition: background-color 0.2s ease;
    border-radius: 10px;
}

/* Постоянное выделение активного чата */
.chat-item.active {
    background-color: #0000000a;
    font-weight: 500;
    border-radius: 10px;
}

/* Улучшенный эффект для активного элемента */
.chat-item.active .chat-title {
    font-weight: 600;
}

/* Стили для заголовка чата в списке */
.chat-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Модальное окно подтверждения */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    margin: 20px;
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s ease;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

.modal-overlay.show .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.modal-content {
    margin-bottom: 30px;
}

.modal-message {
    font-size: 16px;
    line-height: 1.5;
    color: #666;
    margin-bottom: 12px;
}

.modal-chat-name {
    font-weight: 600;
    color: #333;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 15px;
    border-left: 3px solid #ff6b6b;
}

.modal-warning {
    font-size: 14px;
    color: #e74c3c;
    font-weight: 500;
    margin-top: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.modal-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.modal-btn-cancel:hover {
    background: #e0e0e0;
    color: #333;
}

.modal-btn-delete {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.modal-btn-delete:hover {
    background: linear-gradient(135deg, #ff5252, #e53935);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
    transform: translateY(-1px);
}

.modal-btn-delete:disabled {
    background: #ccc;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* Анимация для иконки загрузки */
.modal-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

.chat-title {
    transition: all 0.3s ease;
}

/* Стартовая страница */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*background: #ffffff;*/
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.welcome-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.welcome-container {
    max-width: 800px;
    width: 90%;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
}

.welcome-header {
    margin-bottom: 40px;
}

.welcome-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-orange);
    margin-bottom: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.welcome-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 0;
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.feature-card {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    transition: transform 0.3s ease;
    border: none;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.welcome-examples {
    margin-bottom: 40px;
}

.welcome-examples h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.example-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.example-btn {
    padding: 12px 16px;
    background: #f4f4f4;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.example-btn:hover {
    background: #f3f3f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(143, 143, 143, 0.1);
}

.start-chat-btn {
    background: #9c9fa7;
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #d0d0d0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .welcome-container {
        padding: 30px 20px;
        margin: 20px;
    }

    .welcome-title {
        font-size: 36px;
    }

    .welcome-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .example-questions {
        grid-template-columns: 1fr;
    }
}

/* Скрытие DeepChat когда показана стартовая страница */
.welcome-screen:not(.hidden) ~ #chat-wrapper {
    display: none;
    pointer-events: none;
}


/* ========================================================================
   ВЫПАДАЮЩЕЕ МЕНЮ ПОЛЬЗОВАТЕЛЯ
   ======================================================================== */

/* Основной контейнер меню */
.user-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    margin-bottom: 10px;
    min-width: 220px;
}

.user-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Заголовок меню с информацией о пользователе */
.user-menu-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f9f9f9;
    border-radius: 12px 12px 0 0;
}

.user-menu-header .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

.user-menu-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-menu-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.user-menu-email {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}

/* Разделители */
.user-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* Пункты меню */
.user-menu-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
}

.user-menu-item.active {
    color: #333;
}

.user-menu-item.active:hover {
    background: #f5f5f5;
    color: var(--primary-orange);
}

.user-menu-item.disabled {
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.user-menu-item.disabled:hover {
    background: transparent;
}

/* Бейджи для неактивных пунктов */
.menu-badge {
    margin-left: auto;
    font-size: 11px;
    background: #f0f0f0;
    color: #666;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Адаптивность */
@media (max-width: 768px) {
    .user-menu {
        min-width: 200px;
    }

    .user-menu-item {
        padding: 14px 16px;
        font-size: 15px;
    }
}
