/* ═══════════════════════════════════════════════════════
   CLoone v3.0 — App Styles (cloone.pro style)
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

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

:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --accent: #6c5ce7;
  --accent-soft: #8577ed;
  --accent-bg: rgba(108, 92, 231, 0.04);
  --accent-border: rgba(108, 92, 231, 0.12);
  --gold: #f0a500;
  --green: #12b76a;
  --orange: #e06b0f;
  --red: #e53e3e;
  --text: #2d2b3d;
  --text-mid: #5a5670;
  --text-dim: #8a86a0;
  --border: rgba(0,0,0,0.06);
  --sidebar-w: 240px;
  --header-h: 60px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-close {
  display: none;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-mid);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover {
  background: var(--accent-bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

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

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-plan {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── MOBILE HEADER ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(250,248,245,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.burger {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.burger span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

.mobile-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.mobile-notif {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-mid);
  cursor: pointer;
}

.mobile-notif svg {
  width: 20px;
  height: 20px;
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 32px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-dim);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 8px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  font-family: inherit;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(108,92,231,0.2);
}

.btn-outline {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.35s;
}

.card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.04);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(108,92,231,0.1);
  color: var(--accent);
}

.card-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ── HOME GRID ── */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Progress Card */
.card-progress {
  text-align: center;
}

.progress-circle {
  width: 120px;
  height: 120px;
  margin: 16px auto;
  position: relative;
}

.progress-circle svg {
  width: 100%;
  height: 100%;
}

.progress-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.progress-text {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* Activity Card */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-icon svg {
  width: 16px;
  height: 16px;
}

.activity-icon.blue { background: rgba(0,150,255,0.1); color: #0096ff; }
.activity-icon.orange { background: rgba(224,107,15,0.1); color: #e06b0f; }
.activity-icon.green { background: rgba(18,183,106,0.1); color: #12b76a; }
.activity-icon.purple { background: rgba(108,92,231,0.1); color: #6c5ce7; }

.activity-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-mid);
}

.activity-value {
  font-weight: 700;
  font-size: 14px;
}

/* Crystal Grid */
.crystal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.crystal-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11px;
}

.crystal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.crystal-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.crystal-bar div {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s;
}

/* Vector List */
.vector-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vector-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vector-name {
  font-size: 12px;
  color: var(--text-mid);
  width: 120px;
  flex-shrink: 0;
}

.vector-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.vector-bar div {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.5s;
}

.vector-val {
  font-size: 12px;
  font-weight: 600;
  width: 36px;
  text-align: right;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.quick-action:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.qa-icon {
  font-size: 20px;
}

/* Events List */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-item {
  display: flex;
  gap: 12px;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.event-body {
  flex: 1;
}

.event-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.event-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.event-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── BOT PAGE ── */
.bot-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  height: calc(100vh - 180px);
}

.bot-chat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bot-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 16px;
}

.bw-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.bw-icon svg {
  width: 32px;
  height: 32px;
}

.bot-welcome h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.bot-welcome p {
  color: var(--text-mid);
  font-size: 14px;
  max-width: 300px;
}

.bw-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.bw-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.bw-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Messages */
.msg {
  display: flex;
  max-width: 80%;
}

.msg-user {
  align-self: flex-end;
}

.msg-bot {
  align-self: flex-start;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.msg-user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bot .msg-bubble {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
}

.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing 1.4s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.bot-input-area {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.bot-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.bot-input:focus {
  border-color: var(--accent);
}

.bot-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.bot-send:hover {
  background: #5b21b6;
}

.bot-send svg {
  width: 18px;
  height: 18px;
}

.bot-upload {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.bot-upload:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.bot-upload svg {
  width: 18px;
  height: 18px;
}

/* Bot Sidebar */
.bot-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  overflow-y: auto;
}

.bs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.bs-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.bs-count {
  font-size: 12px;
  color: var(--text-dim);
}

.bs-section {
  margin-bottom: 20px;
}

.bs-section h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.bs-crystals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bs-vectors {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bs-facts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bs-empty {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 12px;
}

/* ── QUIZ PAGE ── */
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}

.quiz-card-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quiz-progress {
  width: 100%;
  max-width: 400px;
  margin-bottom: 24px;
}

.qp-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.qp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 99px;
  transition: width 0.3s;
}

.qp-text {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.quiz-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  text-align: center;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.quiz-card:active {
  cursor: grabbing;
}

.quiz-card.swiping-right {
  border-color: var(--green);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.quiz-card.swiping-left {
  border-color: var(--red);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.quiz-card-inner {
  width: 100%;
  position: relative;
  transition: transform 0.1s ease-out;
}

.quiz-stamp {
  position: absolute;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 800;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 10;
}

.quiz-stamp-like {
  top: 20px;
  right: 20px;
  color: #fff;
  background: rgba(34, 197, 94, 0.9);
  transform: scale(0.8);
}

.quiz-stamp-nope {
  bottom: 20px;
  left: 20px;
  color: #fff;
  background: rgba(239, 68, 68, 0.9);
  transform: scale(0.8);
}

.quiz-stamp.show {
  opacity: 1;
  transform: scale(1);
}

.qc-illustration {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-style: italic;
}

.qc-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 16px;
}

.qc-tags {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 12px;
}

.qc-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.quiz-actions {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

.quiz-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-btn.like:hover {
  background: #e8f5e9;
  border-color: var(--green);
  color: var(--green);
}

.quiz-btn.dislike:hover {
  background: #fbe9e7;
  border-color: var(--red);
  color: var(--red);
}

.quiz-debug {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.quiz-debug h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.qd-vectors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── MIRROR PAGE ── */
.mirror-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── DIARY PAGE ── */
.diary-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

/* ── DIALOGS PAGE ── */
.dialogs-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  height: calc(100vh - 180px);
}

/* ── ANALYTICS PAGE ── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

/* ── INTEGRATIONS PAGE ── */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.int-card {
  text-align: center;
}

.int-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.int-icon.tg { background: #229ED9; }
.int-icon.wa { background: #25D366; }
.int-icon.ig { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.int-icon.em { background: #555670; }

.int-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.int-card p {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ── SETTINGS PAGE ── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* ── MOBILE BOTTOM NAV ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 90;
  justify-content: space-around;
  align-items: center;
}

.mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.2s;
}

.mbn-item svg {
  width: 20px;
  height: 20px;
}

.mbn-item.active {
  color: var(--accent);
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .integrations-grid { grid-template-columns: repeat(2, 1fr); }
  .mirror-grid { grid-template-columns: 1fr; }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-debug { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .mobile-nav {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: calc(var(--header-h) + 16px);
    padding-bottom: 76px;
  }

  .page-header {
    flex-direction: column;
    gap: 12px;
  }

  .home-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .integrations-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }

  .bot-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .bot-sidebar {
    display: none;
  }

  .diary-layout {
    grid-template-columns: 1fr;
  }

  .dialogs-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}
