/**
 * PatenTest 2026 — Features CSS (Задача #22)
 * Стили модулей: Профиль (#screenProfile), Словарь (#screenDictionary),
 * Флеш-карты (#screenFlashcards), заготовки Referral / AI-Tutor.
 * Базовые переменные и классы (hero-card/category-card/admin-table/btn) — в style.css.
 */

/* ============ Кнопка возврата на главную ============ */
.back-to-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.back-to-home-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.14);
}

/* ============ ПРОФИЛЬ (#screenProfile) ============ */
.ptf-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.ptf-avatar {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.ptf-profile-id {
  flex: 1;
  min-width: 0;
}

.ptf-profile-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ptf-profile-username {
  font-size: 12px;
  color: var(--link-color);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ptf-profile-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ptf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-color);
}

.ptf-badge.ptf-badge-talant {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.ptf-phone-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.ptf-phone-row input {
  flex: 1;
  min-width: 0;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

.ptf-phone-row input:focus {
  outline: none;
  border-color: var(--button-color);
}

.ptf-phone-save-btn {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--button-color);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.ptf-phone-save-btn:active {
  transform: scale(0.96);
}

/* Вкладки профиля */
.ptf-profile-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.ptf-profile-tab {
  flex: 1;
  min-width: max-content;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  color: var(--hint-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ptf-profile-tab.active {
  background: var(--button-color);
  border-color: var(--button-color);
  color: #fff;
}

/* Таблица истории тестов */
.ptf-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
}

.ptf-history-meta {
  flex: 1;
  min-width: 0;
}

.ptf-history-cat {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-color);
  margin-bottom: 2px;
}

.ptf-history-date {
  font-size: 11px;
  color: var(--hint-color);
}

.ptf-history-score {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-color);
  white-space: nowrap;
}

.ptf-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ptf-pill.pass {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.ptf-pill.fail {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Статистика профиля */
.ptf-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ptf-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
}

.ptf-stat-val {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 4px;
}

.ptf-stat-lbl {
  display: block;
  font-size: 11px;
  color: var(--hint-color);
  line-height: 1.3;
}

/* Пустые состояния */
.ptf-empty-state {
  text-align: center;
  padding: 28px 16px;
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--hint-color);
  font-size: 13px;
  line-height: 1.5;
}

.ptf-empty-state .ptf-empty-icon {
  display: block;
  font-size: 34px;
  margin-bottom: 10px;
}

.ptf-demo-note {
  font-size: 11px;
  color: var(--hint-color);
  margin: 8px 0;
}

/* ============ СЛОВАРЬ (#screenDictionary) ============ */
.ptf-dict-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ptf-search-input {
  flex: 1;
  min-width: 0;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 13px;
}

.ptf-search-input:focus {
  outline: none;
  border-color: var(--button-color);
}

.ptf-flashmode-btn {
  border: 1px solid rgba(236, 72, 153, 0.45);
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease;
}

.ptf-flashmode-btn:active {
  transform: scale(0.96);
}

.ptf-chips-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.ptf-chip {
  min-width: max-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  color: var(--hint-color);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ptf-chip.active {
  background: var(--button-color);
  border-color: var(--button-color);
  color: #fff;
}

.ptf-phrase-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.ptf-phrase-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ptf-phrase-ru {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-color);
  line-height: 1.3;
}

.ptf-phrase-transcription {
  font-size: 12px;
  color: var(--link-color);
  font-style: italic;
  margin-top: 3px;
}

.ptf-phrase-translation {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
  margin-top: 6px;
}

.ptf-phrase-context {
  font-size: 11px;
  color: var(--hint-color);
  margin-top: 4px;
  line-height: 1.4;
}

.ptf-speak-btn {
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: rgba(56, 189, 248, 0.12);
  font-size: 17px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.ptf-speak-btn:active {
  transform: scale(0.9);
  background: rgba(56, 189, 248, 0.25);
}

/* ============ ФЛЕШ-КАРТЫ (#screenFlashcards) ============ */
.ptf-flash-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ptf-flash-progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.ptf-flash-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.3s ease;
}

.ptf-flash-progress-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-color);
  white-space: nowrap;
}

/* 3D flip-карта */
.ptf-flip-scene {
  perspective: 1200px;
  margin-bottom: 14px;
}

.ptf-flip-card {
  position: relative;
  width: 100%;
  min-height: 220px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
  cursor: pointer;
}

.ptf-flip-card.flipped {
  transform: rotateY(180deg);
}

.ptf-flip-face {
  position: absolute;
  inset: 0;
  min-height: 220px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 22px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.ptf-flip-face.back {
  transform: rotateY(180deg);
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.12), var(--card-bg));
}

.ptf-flip-word {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-color);
  line-height: 1.25;
}

.ptf-flip-translation {
  font-size: 20px;
  font-weight: 800;
  color: #34d399;
  line-height: 1.3;
}

.ptf-flip-transcription {
  font-size: 14px;
  font-style: italic;
  color: var(--link-color);
}

.ptf-flip-hint {
  font-size: 11px;
  color: var(--hint-color);
  margin-top: 8px;
}

.ptf-flash-actions {
  display: flex;
  gap: 10px;
}

.ptf-flash-actions .btn {
  flex: 1;
  padding: 13px 10px;
  font-size: 14px;
  font-weight: 800;
  border-radius: var(--radius-md);
}

.ptf-btn-know {
  background: rgba(16, 185, 129, 0.2) !important;
  border: 1px solid rgba(16, 185, 129, 0.5) !important;
  color: #34d399 !important;
}

.ptf-btn-dontknow {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  color: #f87171 !important;
}

/* Итог сессии */
.ptf-session-result {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 12px;
}

.ptf-session-result .ptf-result-emoji {
  font-size: 44px;
  display: block;
  margin-bottom: 10px;
}

.ptf-session-result h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 12px;
}

.ptf-result-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ptf-result-stat {
  min-width: 90px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
}

.ptf-result-stat .val {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-color);
}

.ptf-result-stat.good .val {
  color: #34d399;
}

.ptf-result-stat.bad .val {
  color: #f87171;
}

.ptf-result-stat .lbl {
  display: block;
  font-size: 11px;
  color: var(--hint-color);
  margin-top: 3px;
}

/* ============ ЗАГОТОВКИ (Referral / AI-Tutor) ============ */
.ptf-placeholder {
  text-align: center;
  padding: 40px 16px;
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--hint-color);
  font-size: 13px;
  line-height: 1.5;
}

.ptf-placeholder .ptf-placeholder-icon {
  display: block;
  font-size: 42px;
  margin-bottom: 12px;
}

/* ============ ХАБ ИГР (#screenGamesHub, Задача #23) ============ */
.ptf-games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.ptf-game-option {
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.ptf-game-option:active {
  transform: scale(0.98);
}

/* ============ РЕФЕРАЛЫ (#screenReferral, Задача #23) ============ */
.ptf-ref-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.ptf-ref-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.ptf-ref-code-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--hint-color);
}

.ptf-ref-code-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-color);
  letter-spacing: 1px;
}

.ptf-ref-link-row {
  margin-bottom: 10px;
}

.ptf-ref-link-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
}

.ptf-ref-link-input:focus {
  outline: none;
  border-color: var(--button-color);
}

.ptf-ref-actions {
  display: flex;
  gap: 10px;
}

.ptf-ref-actions .btn {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
}

.ptf-ref-rules {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-top: 12px;
}

.ptf-ref-rules-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--link-color);
  margin-bottom: 8px;
}

.ptf-ref-rules-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-color);
}

.ptf-ref-rules-list li {
  margin-bottom: 6px;
}

/* ============ AI-РЕПЕТИТОР (#screenAiTutor, Задача #23) ============ */
.ptf-ai-wrap {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}

.ptf-ai-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ptf-ai-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  padding: 5px 12px;
}

.ptf-ai-clear-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  white-space: nowrap;
}

.ptf-ai-messages {
  flex: 1;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ptf-ai-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-color);
  word-wrap: break-word;
}

.ptf-ai-bubble.user {
  align-self: flex-end;
  background: var(--button-color);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ptf-ai-bubble.model {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.ptf-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--hint-color);
}

.ptf-ai-dots {
  display: inline-flex;
  gap: 4px;
}

.ptf-ai-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hint-color);
  animation: ptf-ai-blink 1s infinite;
}

.ptf-ai-dots i:nth-child(2) { animation-delay: 0.2s; }
.ptf-ai-dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes ptf-ai-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.ptf-ai-inputrow {
  display: flex;
  gap: 8px;
}

.ptf-ai-input {
  flex: 1;
  min-width: 0;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}

.ptf-ai-input:focus {
  outline: none;
  border-color: var(--button-color);
}

.ptf-ai-send-btn {
  font-size: 13px;
  font-weight: 800;
  padding: 12px 16px;
  white-space: nowrap;
}
