/* ========== ОБЩИЕ СТИЛИ ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f4fc; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* ========== ШАПКА ========== */
.header { background: white; border-bottom: 3px solid #0056a7; padding: 12px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.header-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo img { width: 40px; height: 40px; border-radius: 8px; }
.logo-text h2 { color: #003d7c; font-size: 1.1rem; margin: 0; }
.logo-text span { color: #666; font-size: 0.75rem; }
.user-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { background: #e8f0fe; color: #003d7c; padding: 6px 12px; border-radius: 20px; font-weight: 600; font-size: 0.85rem; }

/* ========== НАВИГАЦИЯ ========== */
.nav { background: white; border-bottom: 1px solid #dce3f0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-tabs { display: flex; list-style: none; padding: 0; margin: 0; white-space: nowrap; }
.nav-tab { padding: 12px 14px; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 500; color: #666; font-size: 0.85rem; transition: all 0.3s; }
.nav-tab:hover { background: #e8f0fe; color: #0056a7; }
.nav-tab.active { border-bottom-color: #0056a7; color: #0056a7; background: #e8f0fe; font-weight: 600; }

/* ========== ОСНОВНОЙ КОНТЕНТ ========== */
main { padding: 20px 0; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.card { background: white; border-radius: 16px; padding: 22px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 16px; border: 1px solid #e8edf5; }

/* ========== СТАТИСТИКА ========== */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card { background: white; padding: 20px 12px; border-radius: 16px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #e8edf5; transition: transform 0.3s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-number { font-size: 2.2rem; font-weight: 700; color: #0056a7; margin: 8px 0; }
.stat-card h3 { font-size: 0.85rem; color: #666; }

/* ========== КНОПКИ ========== */
.btn { padding: 10px 18px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: all 0.2s; display: inline-block; }
.btn-primary { background: #0056a7; color: white; }
.btn-primary:hover { background: #003d7c; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,86,167,0.3); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: #ffc107; color: #333; }
.btn-outline { background: white; border: 2px solid #0056a7; color: #0056a7; }
.btn-outline:hover { background: #e8f0fe; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* ========== ФОРМЫ ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #333; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 11px; border: 2px solid #e0e6ed; border-radius: 10px; font-size: 14px; transition: all 0.3s; background: #fafbfc; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #0056a7; background: white; box-shadow: 0 0 0 3px rgba(0,86,167,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ========== КАРТОЧКИ КОНСУЛЬТАЦИЙ ========== */
.consultation-card { background: white; border-radius: 16px; padding: 22px; margin-bottom: 14px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #e8edf5; transition: all 0.3s; }
.consultation-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.1); transform: translateY(-2px); }
.booking-card { background: white; border-radius: 14px; padding: 18px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); border: 1px solid #e8edf5; }
.booking-card.active { border-left: 4px solid #0f6e3f; }
.booking-card.completed { border-left: 4px solid #0056a7; }
.booking-card.cancelled { border-left: 4px solid #c62828; opacity: 0.85; }

/* ========== ФИЛЬТРЫ СТАТУСОВ ========== */
.status-filters { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.status-filter-btn { padding: 9px 16px; border: 2px solid #e0e6ed; background: white; border-radius: 22px; cursor: pointer; font-weight: 600; font-size: 0.85rem; color: #666; transition: all 0.3s; }
.status-filter-btn:hover { border-color: #0056a7; color: #0056a7; background: #f0f6ff; }
.status-filter-btn.active { background: #0056a7; color: white; border-color: #0056a7; }

/* ========== СЕКЦИИ СТАТУСОВ ========== */
.status-section { margin-bottom: 28px; }
.status-section h3 { padding: 9px 18px; border-radius: 12px; display: inline-block; margin-bottom: 16px; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.3px; }
.status-active h3 { background: #e8f5e9; color: #0f6e3f; }
.status-completed h3 { background: #e3f2fd; color: #0056a7; }
.status-cancelled h3 { background: #ffebee; color: #c62828; }

/* ========== БЕЙДЖИ СТАТУСОВ ========== */
.badge-status { padding: 5px 12px; border-radius: 18px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-active { background: #e8f5e9; color: #0f6e3f; }
.badge-completed { background: #e3f2fd; color: #0056a7; }
.badge-cancelled { background: #ffebee; color: #c62828; }

/* ========== СТУДЕНТЫ В СПИСКЕ ========== */
.student-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: #f8fafc; border-radius: 12px; margin-bottom: 8px; border: 1px solid #e8edf5; transition: all 0.2s; }
.student-item:hover { background: #f0f4f8; }

/* ========== ТЕМЫ ========== */
.topic-time-block { background: linear-gradient(135deg, #f8fafc 0%, #f0f4f8 100%); border-radius: 16px; padding: 22px; margin-bottom: 22px; border: 2px solid #e0e6ed; }
.saved-topics-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.saved-topic-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: white; border: 2px solid #e0e6ed; border-radius: 25px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.3s; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.saved-topic-item:hover { background: #0056a7; color: white; border-color: #0056a7; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,86,167,0.2); }
.add-topic-btn { padding: 12px 24px; background: linear-gradient(135deg, #0056a7, #003d7c); color: white; border: none; border-radius: 25px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.3s; box-shadow: 0 4px 12px rgba(0,86,167,0.2); }
.add-topic-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,86,167,0.3); }

/* ========== ЧИПСЫ ТЕМ ========== */
.topic-chip { padding: 8px 14px; background: linear-gradient(135deg, #f0f6ff, #e8f0fe); border: 1px solid #c5d9f2; border-radius: 12px; font-size: 0.88rem; color: #0056a7; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; margin: 4px; transition: all 0.2s; }
.topic-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,86,167,0.15); }
.topic-chip .duration-badge { background: #0056a7; color: white; padding: 3px 9px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.topic-chip .count-badge { padding: 3px 9px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }

/* ========== ПОВТОРЕНИЯ ========== */
.repeat-options { margin-top: 12px; padding: 16px; background: #fff; border-radius: 12px; border: 2px solid #e0e6ed; }
.weekday-label { display: flex; align-items: center; gap: 5px; padding: 8px 12px; background: #f8fafc; border: 2px solid #e0e6ed; border-radius: 8px; cursor: pointer; font-size: 0.85rem; }
.weekday-label:has(input:checked) { background: #0056a7; color: white; border-color: #0056a7; }

/* ========== ЧАТ ========== */
.chat-message { margin-bottom: 10px; display: flex; flex-direction: column; }
.chat-message.user { align-items: flex-end; }
.chat-message.admin { align-items: flex-start; }
.chat-bubble { padding: 10px 15px; border-radius: 14px; max-width: 82%; font-size: 0.9rem; line-height: 1.4; }
.chat-bubble.user { background: #0056a7; color: white; border-bottom-right-radius: 4px; }
.chat-bubble.admin { background: #f0f4fc; color: #333; border-bottom-left-radius: 4px; }
.chat-meta { font-size: 0.73rem; color: #666; margin-top: 4px; }

/* ========== ЗАГРУЗКА ========== */
.loading { text-align: center; padding: 35px; color: #666; }
.loading::after { content: ''; display: inline-block; width: 20px; height: 20px; border: 2px solid #0056a7; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== УВЕДОМЛЕНИЯ ========== */
.notification-item { padding: 14px; background: #fff3cd; border-left: 4px solid #ffc107; margin-bottom: 10px; border-radius: 8px; }
.notification-item.read { opacity: 0.6; background: #f8f9fa; }

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: white; padding: 22px; border-radius: 16px; max-width: 500px; width: 92%; max-height: 85vh; overflow-y: auto; position: relative; }
.close-modal { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; color: #666; }

/* ========== ТАБЛИЦЫ ========== */
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { background: #f0f4fc; padding: 10px 8px; text-align: left; font-weight: 600; color: #003d7c; font-size: 0.75rem; }
td { padding: 8px; border-bottom: 1px solid #e8edf5; font-size: 0.8rem; }

/* ========== ТИКЕТЫ ========== */
.ticket-card { background: white; border-radius: 16px; padding: 20px; margin-bottom: 14px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #e8edf5; transition: all 0.3s; }
.ticket-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.ticket-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #e8edf5; }
.ticket-body { margin-bottom: 12px; }
.ticket-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.ticket-actions input { flex: 1; min-width: 150px; padding: 8px 10px; border: 2px solid #e0e6ed; border-radius: 8px; font-size: 0.85rem; }

/* ========== ЧАТ В ТИКЕТАХ ========== */
.chat-message { margin-bottom: 8px; display: flex; flex-direction: column; }
.chat-message.user { align-items: flex-end; }
.chat-message.admin { align-items: flex-start; }
.chat-bubble { padding: 8px 14px; border-radius: 12px; max-width: 85%; font-size: 0.88rem; line-height: 1.4; word-wrap: break-word; }
.chat-bubble.user { background: #0056a7; color: white; border-bottom-right-radius: 4px; }
.chat-bubble.admin { background: #f0f4fc; color: #333; border-bottom-left-radius: 4px; border: 1px solid #e0e6ed; }
.chat-meta { font-size: 0.72rem; color: #666; margin-top: 3px; padding: 0 4px; }

/* ========== ПОИСК ========== */
.search-teacher-box { background: white; border-radius: 14px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); border: 1px solid #e8edf5; }
.teacher-result-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #f8fafc; border-radius: 10px; margin-bottom: 6px; border: 1px solid #e8edf5; }

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-card { padding: 14px 8px; border-radius: 12px; }
    .stat-number { font-size: 1.6rem; }
    .form-row { grid-template-columns: 1fr; }
    .header-content { flex-direction: column; text-align: center; }
    .user-info { justify-content: center; }
    .btn { padding: 8px 14px; font-size: 13px; }
    .consultation-card { padding: 16px; border-radius: 12px; }
    .card { padding: 16px; border-radius: 12px; }
    .topic-time-block { padding: 16px; }
    .saved-topic-item { font-size: 0.8rem; padding: 8px 12px; }
    .topic-chip { font-size: 0.8rem; padding: 6px 10px; }
    .booking-card { padding: 14px; }
}

/* ========== АВТОРИЗАЦИЯ ========== */
.auth-body { background: linear-gradient(135deg, #003d7c 0%, #0056a7 50%, #0066cc 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-container { max-width: 420px; width: 100%; }
.auth-header { text-align: center; margin-bottom: 25px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.auth-logo img { width: 56px; height: 56px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.auth-header h1 { color: white; font-size: 1.3rem; margin-bottom: 4px; }
.auth-header p { color: rgba(255,255,255,0.9); font-size: 0.9rem; }
.auth-card { background: white; border-radius: 18px; padding: 28px 22px; box-shadow: 0 15px 30px rgba(0,0,0,0.2); }
.role-selector { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 22px; background: #f0f4fc; padding: 5px; border-radius: 12px; }
.role-btn { padding: 10px 6px; border: none; background: transparent; border-radius: 9px; cursor: pointer; font-weight: 500; font-size: 0.8rem; transition: all 0.3s; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #666; }
.role-btn:hover { background: rgba(0,86,167,0.05); color: #0056a7; }
.role-btn.active { background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.1); color: #0056a7; font-weight: 600; }
.role-icon { font-size: 1.3rem; }
.error-message { color: #dc3545; background: #fff0f0; padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 0.85rem; display: none; border-left: 4px solid #dc3545; }
.error-message.show { display: block; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.shake { animation: shake 0.5s; }
.demo-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid #e0e6ed; }
.demo-section h4 { color: #666; margin-bottom: 12px; font-size: 0.85rem; }
.demo-credentials { display: flex; flex-direction: column; gap: 8px; }
.demo-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8f9fa; border-radius: 8px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; font-size: 0.85rem; }
.demo-item:hover { background: #e8f0fe; border-color: #0056a7; }
.demo-item:active { transform: scale(0.98); }
.demo-role { font-weight: 600; color: #0056a7; }
.demo-login { color: #666; font-size: 0.8rem; }

@media (max-width: 400px) {
    .auth-card { padding: 22px 16px; border-radius: 14px; }
    .role-btn { font-size: 0.75rem; padding: 8px 4px; }
    .role-icon { font-size: 1.1rem; }
    .auth-header h1 { font-size: 1.1rem; }
    .auth-logo img { width: 48px; height: 48px; }
}

/* ========== ПАГИНАЦИЯ ========== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.page-btn { padding: 6px 12px; border: 2px solid #e0e6ed; background: white; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.8rem; color: #666; }
.page-btn.active { background: #0056a7; color: white; border-color: #0056a7; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== СЛОТ-КАРТОЧКА ========== */
.slot-card { background: white; border-radius: 16px; padding: 20px; margin-bottom: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #e8edf5; transition: all 0.3s; }
.slot-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.1); transform: translateY(-2px); }
.slot-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px; }
.slot-info { display: flex; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: #f8fafc; border-radius: 10px; color: #666; font-size: 0.88rem; margin-bottom: 10px; }
.slot-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ========== ИНФО-ОКНО ========== */
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #e8edf5; font-size: 0.9rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: #666; font-weight: 500; min-width: 130px; }
.info-value { color: #1a2b3c; font-weight: 600; text-align: right; flex: 1; }
.student-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e8edf5; }
.student-list-item:last-child { border-bottom: none; }
.student-avatar { width: 32px; height: 32px; background: linear-gradient(135deg,#0056a7,#003d7c); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }

/* ========== ПАГИНАЦИЯ ========== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.page-btn { padding: 6px 12px; border: 2px solid #e0e6ed; background: white; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.8rem; color: #666; }
.page-btn.active { background: #0056a7; color: white; border-color: #0056a7; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== ТИКЕТЫ (дополнительно) ========== */
.ticket-arrow { display: inline-block; transition: transform 0.3s; font-size: 1.2rem; color: #999; cursor: pointer; user-select: none; }
.ticket-body { display: none; }
.ticket-header-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.ticket-avatar { width: 40px; height: 40px; background: linear-gradient(135deg,#0056a7,#003d7c); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.ticket-info { flex: 1; min-width: 0; }
.ticket-meta { text-align: right; flex-shrink: 0; }

/* ========== ИНФО-МОДАЛКА ========== */
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #e8edf5; font-size: 0.9rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: #666; font-weight: 500; min-width: 130px; }
.info-value { color: #1a2b3c; font-weight: 600; text-align: right; flex: 1; }
.student-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e8edf5; }
.student-list-item:last-child { border-bottom: none; }
.student-avatar { width: 32px; height: 32px; background: linear-gradient(135deg,#0056a7,#003d7c); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
