/* ============================================
   TRADING JOURNAL - Core Styles
   Dark/Light Theme with Binance-inspired design
   ============================================ */

:root {
  --bg-primary: #0B0E11;
  --bg-secondary: #1E2329;
  --bg-tertiary: #2B3139;
  --bg-card: #181A20;
  --text-primary: #EAECEF;
  --text-secondary: #848E9C;
  --text-tertiary: #5E6673;
  --accent-green: #0ECB81;
  --accent-red: #F6465D;
  --accent-yellow: #F0B90B;
  --accent-blue: #1E88E5;
  --border-color: #2B3139;
  --hover-bg: #2B3139;
  --shadow: rgba(0, 0, 0, 0.3);
  --sidebar-width: 250px;
  --bottom-tab-height: 64px;
  --glass-bg: rgba(24, 26, 32, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
  --gradient-primary: linear-gradient(135deg, #F0B90B 0%, #F8D12F 100%);
  --gradient-accent: linear-gradient(135deg, #F0B90B 0%, #FCD535 100%);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
  --card-radius: 16px;
  --glow-green: 0 0 20px rgba(14, 203, 129, 0.15);
  --glow-red: 0 0 20px rgba(246, 70, 93, 0.15);
}

[data-theme="light"] {
  --bg-primary: #FAFAFA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F0F1F3;
  --bg-card: #FFFFFF;
  --text-primary: #1E2329;
  --text-secondary: #474D57;
  --text-tertiary: #848E9C;
  --border-color: #EAECEF;
  --hover-bg: #F5F5F5;
  --shadow: rgba(0, 0, 0, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --glow-green: 0 0 20px rgba(14, 203, 129, 0.1);
  --glow-red: 0 0 20px rgba(246, 70, 93, 0.1);
}

[data-theme="ocean"] {
  --bg-primary: #0a1628;
  --bg-secondary: #112240;
  --bg-tertiary: #1a3358;
  --bg-card: #0f1d35;
  --text-primary: #ccd6f6;
  --text-secondary: #8892b0;
  --text-tertiary: #5a6a8a;
  --accent-green: #64ffda;
  --accent-red: #ff6b6b;
  --accent-yellow: #00D2FF;
  --accent-blue: #00D2FF;
  --border-color: #1a3358;
  --hover-bg: #1a3358;
  --shadow: rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(15, 29, 53, 0.75);
  --glass-border: rgba(0, 210, 255, 0.08);
  --gradient-primary: linear-gradient(135deg, #00D2FF 0%, #0099CC 100%);
  --gradient-accent: linear-gradient(135deg, #00D2FF 0%, #48E5FF 100%);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --glow-green: 0 0 20px rgba(100, 255, 218, 0.15);
  --glow-red: 0 0 20px rgba(255, 107, 107, 0.15);
}

[data-theme="forest"] {
  --bg-primary: #0d1f0d;
  --bg-secondary: #1a3320;
  --bg-tertiary: #264a2e;
  --bg-card: #142a17;
  --text-primary: #d4e8d4;
  --text-secondary: #8fb08f;
  --text-tertiary: #5e7e5e;
  --accent-green: #10B981;
  --accent-red: #ef4444;
  --accent-yellow: #10B981;
  --accent-blue: #34d399;
  --border-color: #264a2e;
  --hover-bg: #264a2e;
  --shadow: rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(20, 42, 23, 0.75);
  --glass-border: rgba(16, 185, 129, 0.08);
  --gradient-primary: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --gradient-accent: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --glow-green: 0 0 20px rgba(16, 185, 129, 0.15);
  --glow-red: 0 0 20px rgba(239, 68, 68, 0.15);
}

[data-theme="sunset"] {
  --bg-primary: #1a0a2e;
  --bg-secondary: #2d1458;
  --bg-tertiary: #3d1e70;
  --bg-card: #220e42;
  --text-primary: #f0e6ff;
  --text-secondary: #b09ed4;
  --text-tertiary: #7a6a9e;
  --accent-green: #2dd4bf;
  --accent-red: #fb7185;
  --accent-yellow: #f97316;
  --accent-blue: #a78bfa;
  --border-color: #3d1e70;
  --hover-bg: #3d1e70;
  --shadow: rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(34, 14, 66, 0.75);
  --glass-border: rgba(249, 115, 22, 0.08);
  --gradient-primary: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
  --gradient-accent: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --glow-green: 0 0 20px rgba(45, 212, 191, 0.15);
  --glow-red: 0 0 20px rgba(251, 113, 133, 0.15);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Noto Sans Thai', -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  transition: background-color 0.3s, color 0.3s;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; }
p { color: var(--text-secondary); line-height: 1.7; }
a { color: var(--accent-yellow); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s, background 0.3s;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-yellow);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.sidebar-logo svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-links {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent-yellow);
  background: var(--hover-bg);
  border-left-color: var(--accent-yellow);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 16px;
}

/* ---- Main Content ---- */
#main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 28px;
  min-height: 100vh;
  max-width: 1200px;
  transition: margin-left 0.3s;
}

/* ---- Views ---- */
.view {
  display: none;
  animation: viewFadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: var(--card-shadow); }
  50% { box-shadow: var(--card-shadow), 0 0 30px rgba(240, 185, 11, 0.1); }
}

/* ---- Cards (Glassmorphism) ---- */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--card-shadow), 0 8px 32px rgba(0, 0, 0, 0.1);
}

.card-hover:hover {
  border-color: var(--accent-yellow);
  transform: translateY(-2px);
}

.card-glow-green {
  box-shadow: var(--card-shadow), var(--glow-green);
}

.card-glow-red {
  box-shadow: var(--card-shadow), var(--glow-red);
}

/* ---- Buttons ---- */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  white-space: nowrap;
}

.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--gradient-primary);
  color: #1E2329;
  box-shadow: 0 4px 15px rgba(240, 185, 11, 0.25);
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(240, 185, 11, 0.35);
  transform: translateY(-1px);
}
.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #06b66e);
  color: #fff;
  box-shadow: 0 4px 15px rgba(14, 203, 129, 0.25);
}
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #d93651);
  color: #fff;
  box-shadow: 0 4px 15px rgba(246, 70, 93, 0.25);
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-outline {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}
.btn-outline:hover { background: var(--hover-bg); border-color: var(--accent-yellow); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-yellow);
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23848E9C' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---- Grid ---- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Tags / Chips ---- */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.chip.active {
  background: var(--accent-yellow);
  color: #1E2329;
  border-color: var(--accent-yellow);
}

.chip:hover {
  border-color: var(--accent-yellow);
}

/* ---- Motivation Banner ---- */
.motivation-banner {
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.motivation-banner.profit {
  background: rgba(14, 203, 129, 0.08);
  border: 1px solid rgba(14, 203, 129, 0.25);
  color: var(--accent-green);
}

.motivation-banner.loss {
  background: rgba(246, 70, 93, 0.08);
  border: 1px solid rgba(246, 70, 93, 0.25);
  color: var(--accent-red);
}

.motivation-banner.warning {
  background: rgba(240, 185, 11, 0.08);
  border: 1px solid rgba(240, 185, 11, 0.25);
  color: var(--accent-yellow);
}

.motivation-banner.critical {
  background: rgba(246, 70, 93, 0.15);
  border: 2px solid var(--accent-red);
  color: var(--accent-red);
  font-weight: 600;
  animation: pulseAlert 2s ease-in-out infinite;
}

@keyframes pulseAlert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.motivation-banner.neutral {
  background: rgba(30, 136, 229, 0.08);
  border: 1px solid rgba(30, 136, 229, 0.25);
  color: var(--accent-blue);
}

.motivation-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

/* ---- Stat Display ---- */
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-value.lg {
  font-size: 2.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 500;
}

/* ---- Trade Card ---- */
.trade-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
  cursor: pointer;
}

.trade-card:hover {
  border-color: var(--accent-yellow);
}

.trade-pair {
  font-weight: 700;
  font-size: 1rem;
}

.trade-type {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trade-type.buy {
  background: rgba(14, 203, 129, 0.15);
  color: var(--accent-green);
}

.trade-type.sell {
  background: rgba(246, 70, 93, 0.15);
  color: var(--accent-red);
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---- Bottom Tab Bar ---- */
#bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-tab-height);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
}

.tab-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-tertiary);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 8px 4px;
  transition: color 0.2s;
  flex: 1;
}

.tab-link svg {
  width: 22px;
  height: 22px;
}

.tab-link.active {
  color: var(--accent-yellow);
}

.tab-add {
  position: relative;
}

.tab-add-btn {
  background: var(--accent-yellow);
  color: #1E2329;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.8rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -18px;
  box-shadow: 0 4px 15px rgba(240, 185, 11, 0.3);
  line-height: 1;
}

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-block;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-tertiary);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-yellow);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: viewFadeIn 0.2s ease;
  padding: 16px;
}

.modal {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal h2 {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* ---- Screenshot Preview ---- */
.screenshot-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  margin-top: 8px;
  border: 1px solid var(--border-color);
}

.screenshot-upload {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

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

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ---- Utility Classes ---- */
.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }
.text-yellow { color: var(--accent-yellow) !important; }
.text-blue { color: var(--accent-blue) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.p-0 { padding: 0; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }

.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Confirm Dialog ---- */
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-green { background: rgba(14,203,129,0.15); color: var(--accent-green); }
.badge-red { background: rgba(246,70,93,0.15); color: var(--accent-red); }
.badge-yellow { background: rgba(240,185,11,0.15); color: var(--accent-yellow); }

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* ---- Settings Item ---- */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-info h3 {
  margin-bottom: 2px;
}

.setting-info p {
  font-size: 0.8rem;
}

/* ---- Storage Bar ---- */
.storage-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.storage-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ---- Back Button ---- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 16px;
  background: none;
  border: none;
  font-family: inherit;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--text-primary);
}

/* ---- Pre-Trade Mindset Popup ---- */
.mindset-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: mindsetFadeIn 0.5s ease;
}

@keyframes mindsetFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mindset-popup {
  background: var(--bg-card);
  border: 2px solid var(--accent-yellow);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: mindsetSlideUp 0.5s ease;
  box-shadow: 0 20px 60px rgba(240, 185, 11, 0.15);
}

@keyframes mindsetSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mindset-header {
  text-align: center;
  margin-bottom: 24px;
}

.mindset-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  animation: mindsetPulse 2s ease-in-out infinite;
}

@keyframes mindsetPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.mindset-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-yellow);
  margin-bottom: 4px;
}

.mindset-subtitle {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.mindset-questions {
  list-style: none;
  margin-bottom: 24px;
}

.mindset-question {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  opacity: 0;
  animation: mindsetItemIn 0.4s ease forwards;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
  border: 1px solid transparent;
}

.mindset-question:hover {
  background: var(--hover-bg);
}

.mindset-question.checked {
  border-color: var(--accent-green);
  background: rgba(14, 203, 129, 0.06);
}

.mindset-question .q-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-tertiary);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.2s;
}

.mindset-question.checked .q-check {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #fff;
}

@keyframes mindsetItemIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.mindset-quote {
  text-align: center;
  padding: 16px;
  margin-bottom: 24px;
  border-left: 3px solid var(--accent-yellow);
  background: rgba(240, 185, 11, 0.05);
  border-radius: 0 10px 10px 0;
  font-size: 0.9rem;
  color: var(--accent-yellow);
  font-style: italic;
  line-height: 1.7;
}

.mindset-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.mindset-ready-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent-yellow);
  color: #1E2329;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.mindset-ready-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.mindset-ready-btn:active {
  transform: scale(0.98);
}

.mindset-skip {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  padding: 4px;
  transition: color 0.2s;
}

.mindset-skip:hover {
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .mindset-popup {
    padding: 24px 18px;
    border-radius: 16px;
  }
  .mindset-icon { font-size: 2.5rem; }
  .mindset-title { font-size: 1.1rem; }
  .mindset-question { font-size: 0.82rem; padding: 10px 12px; }
  .mindset-quote { font-size: 0.82rem; }
}

/* ---- Button Full Width ---- */
.btn-full {
  width: 100%;
}

.calendar-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---- Stat Change ---- */
.stat-change {
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 2px;
}

/* ---- Floating Action Button ---- */
.fab {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-tab-height) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #1E2329;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 101;
  box-shadow: 0 6px 24px rgba(240, 185, 11, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(240, 185, 11, 0.5);
}

.fab:active { transform: scale(0.95); }

/* ---- Theme Picker ---- */
.theme-picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-option {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.theme-option:hover { transform: scale(1.1); }
.theme-option.active { border-color: var(--accent-yellow); box-shadow: 0 0 0 2px var(--accent-yellow); }
.theme-option.active::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-yellow);
  color: #1E2329;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Heatmap ---- */
.heatmap-grid {
  display: grid;
  gap: 3px;
}

.heatmap-cell {
  border-radius: 3px;
  aspect-ratio: 1;
  transition: transform 0.2s;
  cursor: pointer;
  min-width: 14px;
}

.heatmap-cell:hover {
  transform: scale(1.5);
  z-index: 10;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 12px;
}

.heatmap-legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.heatmap-year {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 2px;
}

.heatmap-day-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 8px;
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

.heatmap-hour-grid {
  display: grid;
  grid-template-columns: auto repeat(24, 1fr);
  gap: 2px;
  font-size: 0.65rem;
}

.heatmap-hour-label {
  color: var(--text-tertiary);
  text-align: center;
  padding: 2px;
}

.heatmap-row-label {
  color: var(--text-tertiary);
  padding-right: 8px;
  display: flex;
  align-items: center;
  font-size: 0.7rem;
}

/* ---- Widget System ---- */
.widget-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-border);
  z-index: 200;
  padding: 24px;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

.widget-panel.open { right: 0; }

.widget-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.widget-section {
  transition: all 0.3s ease;
  overflow: hidden;
}

.widget-section.collapsed .widget-content {
  display: none;
}

.widget-collapse-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  transition: transform 0.3s;
}

.widget-section.collapsed .widget-collapse-btn {
  transform: rotate(-90deg);
}

/* ---- Account Switcher ---- */
.account-switcher {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.account-selector {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23848E9C' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(240, 185, 11, 0.1);
  color: var(--accent-yellow);
}

/* ---- Date Range Filter ---- */
.date-range-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.date-range-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.date-range-btn.active {
  background: var(--gradient-primary);
  color: #1E2329;
  border-color: transparent;
}

.date-range-btn:hover {
  border-color: var(--accent-yellow);
}
