:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --border-color: #334155;
    --sidebar-width: 260px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
}

/* --- ФЛЕШ-КАРТОЧКАЛАР (ПРЕЗЕНТАЦИЯ РЕЖИМІ) --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9); /* Қараңғы фон */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    height: 60vh;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close-btn {
    position: absolute;
    top: 20px; right: 20px;
    background: none; border: none;
    font-size: 24px; color: #64748b;
    cursor: pointer; transition: 0.3s;
}
.close-btn:hover { color: #ef4444; }

.flashcard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.flashcard-section-title {
    color: #3b82f6;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.flashcard-text {
    font-size: 36px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.flashcard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-top: 1px solid #e2e8f0;
}

.card-counter {
    font-size: 18px;
    font-weight: bold;
    color: #64748b;
}

/* --- ЭМОЦИЯЛЫҚ ҚОЛДАУ ИНДИКАТОРЫ --- */
.support-indicator {
    position: absolute;
    bottom: 85px; /* Чуть выше кнопок управления */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.15); /* Мягкий синий фон */
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.support-indicator.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -10px); /* Легкое поднятие при появлении */
}

/* --- ВИЗУАЛДЫ ОЙ КАРТАСЫ (MIND MAP) --- */
.mindmap-content {
    width: 95%;
    max-width: 1200px;
    height: 85vh;
    background: #f8fafc;
    overflow: auto; /* Карта үлкен болса, скролл шығады */
}

.mindmap-container {
    padding: 60px 40px;
    display: block; /* Flex орнына блок етіп өзгертеміз */
    overflow-x: auto; /* Егер карта экранға сыймаса, скролл пайда болады */
    width: 100%;
    text-align: center;
}

.tree {
    display: table; /* Тұрақты өлшем беру үшін */
    margin: 0 auto; /* Ортаға қою */
    min-width: 1200px; /* Карта тым тарылып кетпеуі үшін минималды ен береміз */
}

/* Ағаш құрылымының стилі */
/* --- Жақсартылған стильдер --- */

.tree ul {
    padding-top: 20px;
    display: flex;
    justify-content: center;
    gap: 30px; /* Бөлімдер арасындағы арақашықтық */
    padding-left: 0;
}

.tree li {
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 10px 0 10px;
    flex: 1; /* Блоктардың бірдей көлемде орналасуы үшін */
}

.tree-node {
    border: 2px solid #cbd5e1;
    padding: 15px; /* Ішкі отступ */
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    border-radius: 12px;
    background: white;
    transition: all 0.3s;
    width: 250px; /* Блок енін бекітіп қоямыз */
    min-height: 80px; /* Төменгі жағына қарай созылуы үшін */
    word-wrap: break-word;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    line-height: 1.4;
    vertical-align: top;
}

/* Байланыстырушы сызықтар (жоғары және төмен) */
.tree li::before, .tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #cbd5e1;
    width: 50%;
    height: 20px;
}

.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #cbd5e1;
}

/* Жалғыз элементтерге сызық керек емес */
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}
.tree li:only-child { padding-top: 0; }

/* Шеткі сызықтарды дөңгелету */
.tree li:first-child::before, .tree li:last-child::after {
    border: 0 none;
}
.tree li:last-child::before {
    border-right: 2px solid #cbd5e1;
    border-radius: 0 5px 0 0;
}
.tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

/* Төмен қарай түсетін орталық сызық */
.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #cbd5e1;
    width: 0;
    height: 20px;
}



.tree-node:hover {
    background: #f1f5f9;
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* Бөлімдерге арналған түстер */
.node-root {
    background: #3b82f6;
    color: white;
    border-color: #2563eb;
    font-size: 18px;
    padding: 15px 30px;
}
.node-intro { border-color: #60a5fa; color: #2563eb; }
.node-body { border-color: #34d399; color: #059669; }
.node-conclusion { border-color: #c084fc; color: #9333ea; }

/* === LAYOUT & SIDEBAR === */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    position: fixed; height: 100vh; z-index: 10;
}

.sidebar-header { padding: 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); }
.logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent-primary), var(--accent-success)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: white; }
.sidebar-header h2 { font-size: 20px; font-weight: 600; }

.sidebar-nav { padding: 20px 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted); text-decoration: none; border-radius: var(--radius-md); transition: all 0.2s; font-weight: 500; }
.nav-item:hover, .nav-item.active { background-color: var(--bg-card-hover); color: var(--text-main); }
.nav-item.active { border-left: 4px solid var(--accent-primary); }

.sidebar-footer { padding: 20px; border-top: 1px solid var(--border-color); }
.user-profile { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; background-color: var(--bg-card-hover); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-muted); }

/* === MAIN CONTENT & SECTIONS === */
.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 32px 40px; }
.page-section { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.top-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 32px; }
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.page-subtitle { color: var(--text-muted); font-size: 15px; }
.content-wrapper { max-width: 1000px; }

/* === CARDS & INPUTS === */
.glass-card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); margin-bottom: 24px; }
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-header h3 { font-size: 18px; font-weight: 600; }
.text-accent { color: var(--accent-primary); }

.modern-textarea { width: 100%; background-color: var(--bg-dark); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px; color: var(--text-main); font-size: 15px; resize: vertical; transition: 0.3s; margin-bottom: 20px; }
.modern-textarea:focus { outline: none; border-color: var(--accent-primary); }

/* === BUTTONS === */
.action-row { display: flex; gap: 12px; justify-content: flex-end; }
.btn { padding: 12px 24px; border-radius: var(--radius-md); border: none; font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background-color: var(--accent-primary); color: white; }
.btn-primary:hover:not(:disabled) { background-color: var(--accent-primary-hover); }
.btn-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background-color: var(--bg-card-hover); }
.btn-voice { background-color: transparent; border: 1px solid var(--accent-danger); color: var(--accent-danger); }
.btn-voice:hover:not(:disabled) { background-color: rgba(239, 68, 68, 0.1); }
.btn-voice.recording { background-color: rgba(239, 68, 68, 0.15); animation: pulse-rec 1.5s infinite; }
.btn-voice.processing { opacity: 0.8; cursor: wait; }
@keyframes pulse-rec {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}
.voice-status { font-size: 13px; color: var(--accent-danger); margin: -8px 0 16px; text-align: center; }

/* === RESULTS GRID === */
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; }
.result-card { margin-bottom: 0; position: relative; overflow: hidden; padding-top: 36px; }
.card-badge { position: absolute; top: 0; left: 0; padding: 6px 12px; font-size: 12px; font-weight: 600; border-bottom-right-radius: var(--radius-md); }
.badge-intro { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-body { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-conclusion { background-color: rgba(168, 85, 247, 0.2); color: #c084fc; }
.result-text { line-height: 1.6; font-size: 15px; }

/* === TOOLS PANEL === */
.tools-panel { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; flex-wrap: wrap; gap: 15px; }
.tools-header { font-weight: 600; color: var(--text-muted); }
.tools-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.tool-btn { padding: 8px 16px; border-radius: 8px; background-color: var(--bg-dark); border: 1px solid var(--border-color); color: var(--text-main); cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 6px; transition: 0.2s; }
.tool-btn:hover { background-color: var(--bg-card-hover); border-color: var(--text-muted); }
.btn-read { border-color: var(--accent-success); color: var(--accent-success); }
.btn-stop { border-color: var(--accent-danger); color: var(--accent-danger); }
.btn-speech { border-color: #f59e0b; color: #f59e0b; }

.extra-result { border: 1px solid var(--accent-primary); background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%); }
.mt-3 { margin-top: 16px; }
.border-bottom { border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }