/* SyncVDS Client — Styles */

/* Light Theme (default) */
:root, [data-theme="light"] {
  --bg-primary: #f9fafb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --primary: #0d9488;
  --primary-light: #ccfbf1;
  --primary-dark: #0f766e;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --red: #dc2626;
  --red-light: #fee2e2;
  --red-dark: #b91c1c;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --purple: #9333ea;
  --purple-light: #f3e8ff;
  --card-bg: rgba(122,122,122,0.08);
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #1f2937;
  --bg-secondary: #374151;
  --bg-tertiary: #4b5563;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --border: #4b5563;
  --border-light: #374151;
  --primary: #14b8a6;
  --primary-light: #0d9488;
  --primary-dark: #0f766e;
  --green: #22c55e;
  --green-light: #16a34a;
  --green-dark: #15803d;
  --red: #ef4444;
  --red-light: #dc2626;
  --red-dark: #b91c1c;
  --orange: #f97316;
  --orange-light: #ea580c;
  --blue: #3b82f6;
  --blue-light: #2563eb;
  --purple: #a855f7;
  --purple-light: #9333ea;
  --card-bg: rgba(255,255,255,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.5);
}

/* AMOLED Theme (Pure Black) */
[data-theme="amoled"] {
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #c0c0c0;
  --text-tertiary: #909090;
  --border: #2a2a2a;
  --border-light: #1a1a1a;
  --primary: #14b8a6;
  --primary-light: #0d9488;
  --primary-dark: #0f766e;
  --green: #22c55e;
  --green-light: #16a34a;
  --green-dark: #15803d;
  --red: #ef4444;
  --red-light: #dc2626;
  --red-dark: #b91c1c;
  --orange: #f97316;
  --orange-light: #ea580c;
  --blue: #3b82f6;
  --blue-light: #2563eb;
  --purple: #a855f7;
  --purple-light: #9333ea;
  --card-bg: rgba(255,255,255,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,.8);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.9);
}

/* Blue Theme */
[data-theme="blue"] {
  --bg-primary: #eff6ff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #dbeafe;
  --text-primary: #1e3a8a;
  --text-secondary: #1e40af;
  --text-tertiary: #6b7280;
  --border: #bfdbfe;
  --border-light: #dbeafe;
  --primary: #2563eb;
  --primary-light: #93c5fd;
  --primary-dark: #1e40af;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --red: #dc2626;
  --red-light: #fee2e2;
  --red-dark: #b91c1c;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --purple: #9333ea;
  --purple-light: #f3e8ff;
  --card-bg: rgba(37,99,235,0.05);
  --shadow: 0 1px 3px rgba(37,99,235,.1);
  --shadow-lg: 0 10px 25px rgba(37,99,235,.15);
}

/* Purple Theme */
[data-theme="purple"] {
  --bg-primary: #faf5ff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3e8ff;
  --text-primary: #581c87;
  --text-secondary: #6b21a8;
  --text-tertiary: #6b7280;
  --border: #e9d5ff;
  --border-light: #f3e8ff;
  --primary: #9333ea;
  --primary-light: #d8b4fe;
  --primary-dark: #7e22ce;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --red: #dc2626;
  --red-light: #fee2e2;
  --red-dark: #b91c1c;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --purple: #9333ea;
  --purple-light: #f3e8ff;
  --card-bg: rgba(147,51,234,0.05);
  --shadow: 0 1px 3px rgba(147,51,234,.1);
  --shadow-lg: 0 10px 25px rgba(147,51,234,.15);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s, color 0.3s;
}

/* App shell */
.app-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.app-bar-title { text-align: center; }
.app-bar-title h1 { font-size: 16px; font-weight: 700; }
.app-bar-sub { font-size: 10px; color: var(--text-tertiary); display: flex; align-items: center; justify-content: center; gap: 4px; }
.app-bar-left, .app-bar-right { position: absolute; display: flex; align-items: center; gap: 4px; }
.app-bar-left { left: 12px; }
.app-bar-right { right: 12px; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 4px;
  font-size: 10px;
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  transition: color .15s;
}
.nav-item.active { color: var(--primary); }
.nav-item .nav-icon { font-size: 20px; margin-bottom: 1px; }

.page-content {
  padding-bottom: 64px;
  min-height: calc(100vh - 52px - 56px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); }
.btn-ghost { background: none; color: var(--text-secondary); padding: 6px; border-radius: 8px; }
.btn-ghost:hover { background: var(--bg-tertiary); }
.btn-icon { padding: 6px; border-radius: 8px; background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-secondary); }
.btn-icon:hover { background: var(--bg-tertiary); }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.btn-red { background: var(--red); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Inputs */
.input-group { margin-bottom: 14px; }
.input-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.input-group input, .input-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.1); }

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
}
.card + .card { margin-top: 8px; }

/* Chips */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all .15s;
}
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Summary cards row */
.summary-row { display: flex; gap: 8px; padding: 0 12px; }
.summary-card {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-card .sc-icon { font-size: 18px; }
.summary-card .sc-label { font-size: 11px; color: var(--text-tertiary); }
.summary-card .sc-value { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Stat chips row */
.stat-row { display: flex; gap: 6px; padding: 2px 12px; }
.stat-chip {
  flex: 1;
  padding: 5px 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}


/* List items */
.list-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  margin: 0 12px 6px;
  padding: 14px;
  cursor: pointer;
  transition: background .1s;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

/* FR2 report */
.fr2-row { display: flex; gap: 10px; flex-wrap: wrap; }
.fr2-meta { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.fr2-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
}
.fr2-list { display: flex; flex-direction: column; gap: 8px; }
.fr2-section { user-select: none; }
.fr2-head { display: flex; align-items: center; gap: 10px; }
.fr2-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid var(--border);
}
.fr2-title { flex: 1; font-weight: 700; font-size: 14px; }
.fr2-total { font-weight: 800; font-size: 14px; white-space: nowrap; }
.fr2-chevron { color: var(--text-tertiary); font-size: 22px; margin-left: 2px; }
.fr2-items { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px 14px; }
.fr2-item { font-size: 12px; color: var(--text-secondary); }
.fr2-item .fr2-v { color: var(--text-primary); font-weight: 700; }
.fr2-more { margin-top: 10px; font-size: 12px; color: var(--text-tertiary); }

.fr2-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  background: var(--bg-secondary);
}
.fr2-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fr2-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 11px;
  font-weight: 700;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.fr2-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  white-space: nowrap;
}
.fr2-table tr:last-child td { border-bottom: none; }

/* Modal / Bottom sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeIn .15s;
}
.bottom-sheet {
  background: var(--bg-secondary);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp .2s;
}
.modal-content {
  background: var(--card-bg, #fff);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 20px;
  margin: auto;
  animation: slideUp .2s;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.detail-cell {
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.detail-row { display: flex; justify-content: space-between; padding: 5px 0; }
.detail-row .dl { color: var(--text-tertiary); }
.detail-row .dv { font-weight: 600; }

/* Menu dropdown */
.menu-dropdown {
  position: absolute;
  right: 12px;
  top: 48px;
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
  min-width: 180px;
  z-index: 150;
  overflow: hidden;
  animation: fadeIn .1s;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
}
.menu-item:hover { background: var(--bg-tertiary); }

/* Login */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px;
}
.login-box { max-width: 400px; width: 100%; text-align: center; }
.login-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
}
.login-box h2 { font-size: 26px; margin-bottom: 4px; }
.login-box .subtitle { color: var(--text-tertiary); font-size: 15px; margin-bottom: 24px; }
.error-box { padding: 10px; background: var(--red-light); border-radius: 10px; color: var(--red-dark); font-size: 13px; margin-bottom: 14px; text-align: left; }

/* Shop selection */
.shop-card {
  display: flex;
  align-items: center;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.shop-card:hover { background: var(--bg-tertiary); }
.shop-card.expired { opacity: .6; cursor: not-allowed; }
.shop-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.shop-card-info { flex: 1; margin-left: 12px; }
.shop-card-name { font-weight: 600; font-size: 15px; }
.shop-card-sub { font-size: 12px; }

/* Trend card */
.trend-row { display: flex; gap: 8px; padding: 0 12px; margin-bottom: 10px; }
.trend-card {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius);
}
.trend-card .tc-title { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.trend-card .tc-value { font-size: 16px; font-weight: 700; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend-card .tc-change { font-size: 12px; font-weight: 600; }

/* Kassa grid */
.kassa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 12px; }
.kassa-card {
  padding: 12px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 70px;
}
.kassa-card .kc-title { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.kassa-card .kc-value { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Stolik card */
.stolik-card {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card-bg);
  margin: 0 12px 6px;
  gap: 12px;
}
.stolik-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Chart container */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 12px;
  margin: 0 12px 10px;
}
.chart-legend { display: flex; gap: 12px; margin-bottom: 8px; }
.legend-dot { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-tertiary); }
.legend-dot::before { content: ''; width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--dot-color); }
.chart-summary { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.chart-summary .cs-row { display: flex; justify-content: space-between; font-size: 12px; padding: 1px 0; }
.chart-summary .cs-row .cs-label { color: var(--text-tertiary); }
.chart-summary .cs-row .cs-value { font-weight: 600; }

/* Progress bar */
.progress-bar { height: 5px; border-radius: 3px; background: rgba(0,0,0,.06); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
}
.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.search-input::placeholder { color: var(--text-tertiary); opacity: 0.7; }
.search-input:focus { border-color: var(--primary); }

/* Tabs */
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Subscription expired */
.expired-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  text-align: center;
  padding: 32px;
}
.expired-screen .icon { font-size: 64px; margin-bottom: 16px; }
.expired-screen h2 { color: var(--red); margin-bottom: 8px; }
.expired-screen p { color: var(--text-tertiary); margin-bottom: 24px; }

/* Loading / Empty / Error */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-tertiary); gap: 10px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 48px 24px; color: var(--text-tertiary); }
.empty .icon { font-size: 48px; margin-bottom: 10px; }
.error-state { text-align: center; padding: 48px 24px; }
.error-state .icon { font-size: 48px; color: var(--red); margin-bottom: 10px; }

/* Toast */
.toast-container { position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%); z-index: 300; }
.toast { padding: 10px 20px; border-radius: 10px; color: white; font-size: 14px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,.15); animation: slideUp .2s; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Helpers */
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-tertiary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.px-12 { padding-left: 12px; padding-right: 12px; }

@media (max-width: 400px) {
  .summary-card .sc-value { font-size: 13px; }
  .trend-card .tc-value { font-size: 14px; }
}
