/* ============================================================
   STUDIO69 ТЕМА – ПОЛНАЯ ЗАМЕНА
   Светлый градиентный фон, фиолетовые акценты
   ============================================================ */

/* ----- ИМПОРТ ШРИФТА ----- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

/* ----- ПЕРЕМЕННЫЕ ----- */
:root {
    --primary: #9653CF;
    --primary-dark: #7C3FAE;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-light: #e5e7eb;
}

/* ----- ОБЩИЕ СТИЛИ ----- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-light);
}
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: var(--bg-light); }
html::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

body {
    /* НЕЖНЫЙ БЕЛО-ФИОЛЕТОВЫЙ ГРАДИЕНТ */
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 50%, #ffffff 100%);
    color: var(--text-dark);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

::selection {
    color: #fff;
    background-color: var(--primary);
}

/* ----- НАВИГАЦИЯ (STUDIO69) ----- */
.navbar.bg-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    padding: 0.6rem 1rem;
}
.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark) !important;
    letter-spacing: -0.3px;
}
.navbar-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.btn-outline-nav {
    border: 1.5px solid var(--primary);
    border-radius: 60px;
    padding: 0.4rem 1.4rem;
    color: var(--primary);
    font-weight: 600;
    transition: all 0.2s;
    background: transparent;
}
.btn-outline-nav:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(150, 83, 207, 0.3);
}

.btn-primary-nav {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 60px;
    padding: 0.4rem 1.6rem;
    color: #fff;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(150, 83, 207, 0.4);
    color: #fff;
}

/* ----- КОНТЕЙНЕРЫ И КАРТОЧКИ ----- */
.main-container {
    padding: 1rem;
    min-height: calc(100vh - 70px);
}

.card.glass,
.glass-modal .modal-content,
.login-card,
.premium-card,
.tariff-card-inner {
    background: var(--bg-white);
    backdrop-filter: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ----- КНОПКИ ----- */
.btn-primary-glow {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: #fff;
    box-shadow: 0 4px 12px rgba(150, 83, 207, 0.3);
}
.btn-primary-glow:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(150, 83, 207, 0.4);
    color: #fff;
}

.btn-outline-glow {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline-glow:hover {
    background: var(--primary);
    color: #fff;
}

/* ----- ЛОГИН / РЕГИСТРАЦИЯ ----- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 1rem;
}
.login-card {
    max-width: 450px;
    width: 100%;
    padding: 2.5rem 2rem;
}
.login-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}
.input-group-icon {
    position: relative;
    margin-bottom: 1.25rem;
}
.input-group-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1rem;
    z-index: 1;
}
.input-group-icon .form-control {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 60px;
    color: var(--text-dark);
    font-size: 0.95rem;
}
.input-group-icon .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(150, 83, 207, 0.15);
    outline: none;
}
.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 60px;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    transition: all 0.2s;
    cursor: pointer;
}
.btn-login:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(150, 83, 207, 0.4);
}

/* ----- ЧАТЫ (ОСНОВНАЯ СТРУКТУРА) ----- */
.chats-layout {
    display: flex;
    gap: 1rem;
    height: 100%;
    width: 100%;
}
.chats-sidebar {
    width: 280px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-header h5 {
    margin: 0;
    color: var(--primary);
}
.btn-close-sidebar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dark);
}
.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
}
.btn-new-chat, .btn-delete-chat {
    flex: 1;
    background: rgba(150, 83, 207, 0.08);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    color: var(--text-dark);
    padding: 0.5rem;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.btn-new-chat:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-delete-chat:hover:not(:disabled) {
    background: #DE2E63;
    border-color: #DE2E63;
    color: #fff;
}
.search-box {
    position: relative;
    margin: 0 1rem 1rem 1rem;
}
.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    width: 100%;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    padding: 0.6rem 1rem 0.6rem 2.2rem;
    color: var(--text-dark);
}
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 0.5rem;
}
.list-group-item {
    background: transparent;
    border: none;
    color: var(--text-dark);
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.2s;
}
.list-group-item i {
    margin-right: 8px;
    color: var(--primary);
}
.list-group-item:hover {
    background: rgba(150, 83, 207, 0.06);
    transform: translateX(4px);
}
.list-group-item.active {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.list-group-item.active i {
    color: #fff;
}

.chat-main {
    flex: 1;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}
.chat-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-dark);
}
.btn-show-sidebar, .btn-settings {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-dark);
    transition: color 0.2s;
}
.btn-show-sidebar:hover, .btn-settings:hover {
    color: var(--primary);
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.empty-chat-message {
    text-align: center;
    margin-top: 3rem;
    opacity: 0.6;
}
.empty-chat-message i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}
.message-wrapper {
    display: flex;
    margin: 0.5rem 0;
    animation: fadeInUp 0.3s ease;
}
.message-wrapper.user {
    justify-content: flex-end;
}
.message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-dark);
}
.message.user {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
}
.message.assistant {
    background: #f3f4f6;
}
.assistant-buttons {
    display: flex;
    gap: 8px;
    margin-left: 12px;
    align-items: center;
}
.copy-btn, .translate-btn {
    background: rgba(150, 83, 207, 0.08);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--primary);
}
.copy-btn:hover, .translate-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.05);
}
.translation-hint {
    font-size: 0.7rem;
    color: var(--primary);
    margin-top: 6px;
    padding-left: 8px;
}
.typing-indicator {
    display: flex;
    gap: 6px;
    background: var(--bg-light);
    padding: 0.75rem 1rem;
    border-radius: 20px;
    width: fit-content;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%,60%,100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}
.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-light);
}
.input-group {
    display: flex;
    gap: 0.5rem;
}
.input-group .form-control {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    color: var(--text-dark);
    padding: 0.75rem 1rem;
}
.btn-send {
    background: var(--primary);
    border: none;
    border-radius: 40px;
    padding: 0 1.5rem;
    color: #fff;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-send:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 0 12px rgba(150, 83, 207, 0.4);
}
.chat-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.chat-actions .btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    color: var(--text-dark);
}
.chat-actions .btn:hover {
    background: rgba(150, 83, 207, 0.08);
}

/* ----- ПРОФИЛЬ (МОДАЛКА) ----- */
.btn-profile-trigger {
    background: rgba(150, 83, 207, 0.08);
    border: 1px solid var(--border-light);
    border-radius: 60px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    transition: all 0.2s;
    cursor: pointer;
}
.btn-profile-trigger:hover {
    background: rgba(150, 83, 207, 0.15);
    border-color: var(--primary);
}
.btn-profile-trigger i:first-child {
    color: var(--primary);
}
.profile-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.profile-modal .modal-content {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
}
.profile-heart-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -30px;
    margin-left: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.profile-heart-icon i {
    font-size: 2rem;
    color: #fff;
}
.username {
    color: var(--text-dark);
}
.premium-section {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 1rem;
}
.premium-status-badge {
    background: rgba(150, 83, 207, 0.08);
    border-radius: 40px;
    padding: 6px 16px;
    color: var(--text-dark);
}
.premium-days-left {
    color: var(--primary);
}
.btn-premium-extend-modal {
    background: var(--primary);
    color: #fff;
}
.btn-premium-extend-modal:hover {
    background: var(--primary-dark);
    color: #fff;
}
.btn-glass {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    color: var(--text-dark);
}
.btn-glass:hover {
    background: var(--primary);
    color: #fff;
}
.telegram-section {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
}
.telegram-link {
    color: var(--primary);
}

/* ----- ТАРИФЫ (PREMIUM) ----- */
.premium-card {
    background: var(--bg-white);
}
.premium-title {
    color: var(--text-dark);
}
.premium-subtitle {
    color: var(--text-muted);
}
.tariff-card-inner {
    background: var(--bg-white);
}
.tariff-card.selected .tariff-card-inner {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}
.current-price {
    color: var(--primary);
}
.btn-premium-pay {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.btn-premium-pay:hover {
    box-shadow: 0 6px 20px rgba(150, 83, 207, 0.4);
}

/* ----- АДМИНКА ----- */
.table-dark {
    --bs-table-bg: var(--bg-white);
    --bs-table-color: var(--text-dark);
    --bs-table-border-color: var(--border-light);
}
.table-dark th {
    background: rgba(150, 83, 207, 0.06);
    color: var(--primary);
}

/* ----- ПЕРЕКЛЮЧАТЕЛИ (SETTINGS) ----- */
.preset-btn {
    background: var(--bg-light);
    border-color: var(--border-light);
    color: var(--text-dark);
}
.preset-btn.active {
    border-color: var(--primary);
    background: rgba(150, 83, 207, 0.08);
    color: var(--primary);
}
.custom-select-dark {
    background: var(--bg-light);
    border-color: var(--border-light);
    color: var(--text-dark);
}
.custom-select-dark:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(150, 83, 207, 0.15);
}
.custom-textarea-dark {
    background: var(--bg-light);
    border-color: var(--border-light);
    color: var(--text-dark);
}
.custom-range {
    background: var(--border-light);
}
.custom-range::-webkit-slider-thumb {
    background: var(--primary);
    border: 2px solid #fff;
}
.custom-switch {
    background: var(--border-light);
}
.custom-switch:checked {
    background: var(--primary);
}

/* ----- РАЗНОЕ ----- */
.free-limit-badge {
    background: rgba(150, 83, 207, 0.08);
    border: 1px solid var(--primary);
    border-radius: 40px;
    padding: 4px 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}
.gradient-heart {
    color: var(--primary);
}

/* ----- АДАПТИВ ----- */
@media (max-width: 768px) {
    .chats-sidebar {
        position: fixed;
        top: 70px;
        left: 0;
        height: calc(100% - 70px);
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        background: var(--bg-white);
    }
    .chats-sidebar.open {
        transform: translateX(0);
    }
    .btn-show-sidebar {
        display: inline-block !important;
    }
    .btn-close-sidebar {
        display: block !important;
    }
    .message {
        max-width: 85%;
    }
}
@media (max-width: 576px) {
    .main-container { padding: 0.25rem; }
    .chat-header { padding: 0.5rem; }
    .chat-header h4 { font-size: 0.9rem; }
    .btn-profile-trigger .profile-name {
        display: none;
    }
    .login-card { padding: 1.5rem; }
    .modal-dialog { margin: 0.5rem; }
}

/* ----- АНИМАЦИИ ----- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}