:root {
  --bg-main: #0B0F19;
  --bg-card: #151E32;
  --bg-card-hover: #1E2942;
  --bg-card-active: #243456;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --accent-light: rgba(59, 130, 246, 0.15);
  --text-main: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.5);
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --font-main: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  font-size: 14px;
  line-height: 1.5;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 75px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 8px;
}

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

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

.brand-avatar {
  font-size: 24px;
  background: linear-gradient(135deg, #1E3A8A, #3B82F6);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.brand-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.user-greeting {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
}

.tool-btn:active {
  transform: scale(0.92);
}

.pro-badge {
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Search Bar */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.search-icon {
  position: absolute;
  right: 12px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 38px 10px 36px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s ease;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  background: #182238;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.clear-btn {
  position: absolute;
  left: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}

/* Scrollable Category Pills */
.scroll-pills-wrap {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0 -16px;
  padding: 0 16px;
}

.scroll-pills-wrap::-webkit-scrollbar {
  display: none;
}

.scroll-pills {
  display: flex;
  gap: 8px;
  width: max-content;
}

.pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

/* Intent Chips */
.intent-chips-wrap {
  overflow-x: auto;
  scrollbar-width: none;
  margin: 12px -16px 8px;
  padding: 0 16px;
}

.intent-chips-wrap::-webkit-scrollbar {
  display: none;
}

.intent-chips {
  display: flex;
  gap: 6px;
  width: max-content;
}

.intent-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.intent-chip.active {
  background: var(--accent-light);
  color: #60A5FA;
  border-color: rgba(59, 130, 246, 0.3);
}

/* Main Content */
.app-main {
  padding: 0 16px;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 12px;
}

.section-title-bar h2 {
  font-size: 15px;
  font-weight: 700;
}

.badge-count {
  background: var(--bg-card);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* Items Grid */
.items-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.item-card:active {
  transform: scale(0.98);
  background: var(--bg-card-hover);
}

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

.card-badge {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
}

.card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.4;
  word-break: break-word;
}

.card-summary {
  font-size: 12px;
  color: #CBD5E1;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: 8px;
  border-right: 3px solid var(--accent);
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-badge {
  font-size: 10px;
  color: #93C5FD;
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
}

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

.reminder-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reminder-time-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  display: inline-block;
}

/* Dashboard & Stats */
.stats-dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.quota-card {
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.quota-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-bar {
  background: rgba(255, 255, 255, 0.1);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, #3B82F6, #10B981);
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.stats-grid-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.stat-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.stat-title {
  font-size: 11px;
  color: var(--text-secondary);
}

.pro-upgrade-card {
  background: linear-gradient(135deg, #1E3A8A, #312E81);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 18px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.pro-tag {
  background: rgba(255, 255, 255, 0.2);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pro-upgrade-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.pro-upgrade-card ul {
  list-style: none;
  font-size: 12px;
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.btn-upgrade {
  width: 100%;
  background: #fff;
  color: #1E3A8A;
  font-weight: 800;
  font-size: 13px;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding: 0 10px;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex: 1;
}

.nav-icon {
  font-size: 18px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
}

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

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* Modal Bottom Sheets */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  background: var(--bg-card);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-top: 1px solid var(--border);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  z-index: 210;
  animation: slideUp 0.25s ease-out;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 10px auto 4px;
}

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

.modal-badges {
  display: flex;
  gap: 6px;
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  transition: all 0.2s ease;
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* Loading & Empty States */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
