:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-hover: #252535;
  --accent: #f97316;
  --accent-light: #fb923c;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #334155;
  --success: #22c55e;
  --warning: #eab308;
  --gradient-1: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --gradient-2: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  --gradient-3: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Noto Sans Bengali", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  margin-bottom: 30px;
}

.logo-icon {
  width: 45px;
  height: 45px;
  background: var(--gradient-1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
}

.logo-text span {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.nav-section {
  margin-bottom: 25px;
}

.nav-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  padding: 0 15px;
  margin-bottom: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.3s ease;
  margin-bottom: 5px;
}

.nav-link:hover,
.nav-link.active {
  background: var(--gradient-1);
  color: white;
}

.nav-link i {
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  margin-left: 280px;
  padding: 30px;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 15px;
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  width: 350px;
}

.search-box input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
  outline: none;
}

.search-box i {
  color: var(--text-muted);
  margin-right: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--accent);
  color: white;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 25px;
  border: 1px solid var(--border);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-card.gradient-1 {
  background: var(--gradient-1);
  border: none;
}

.stat-card.gradient-2 {
  background: var(--gradient-2);
  border: none;
}

.stat-card.gradient-3 {
  background: var(--gradient-3);
  border: none;
}

.stat-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 15px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 13px;
  opacity: 0.8;
}

/* News Cards */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 20px;
  color: var(--text-primary) !important;
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.category-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.category-card .cat-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.category-card:hover .cat-name {
  color: var(--text-primary);
}

.category-card .cat-count {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.news-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 25px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: pointer;
}

.news-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.news-category {
  display: inline-block;
  padding: 5px 12px;
  background: var(--bg-hover);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent-light);
  margin-bottom: 12px;
}

.news-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.news-title a:hover {
  color: var(--accent-light);
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 12px;
  color: var(--text-muted);
}

.news-meta i {
  margin-right: 5px;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--bg-secondary);
  border-radius: 15px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
}

/* Loading */
.loading {
  display: none;
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 25px;
  display: none;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--accent);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.page-btn {
  padding: 10px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.page-btn:hover,
.page-btn.active {
  background: var(--gradient-1);
  border-color: transparent;
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 15px;
    padding-bottom: 90px;
    min-height: calc(100vh - 90px);
  }

  .header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .header h1 {
    font-size: 22px;
  }

  .header-actions {
    flex-direction: column;
    gap: 10px;
  }

  .search-box {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 11px;
  }

  .news-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .news-card {
    padding: 18px;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .btn {
    padding: 14px 20px;
    font-size: 14px;
    justify-content: center;
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .pagination {
    flex-wrap: wrap;
  }

  /* Hide toast on mobile - use bottom nav space */
  .toast {
    bottom: 100px;
    right: 15px;
    left: 15px;
  }
}

/* Bottom Navigation - PWA Style */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(18, 18, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 60px;
    gap: 4px;
  }

  .nav-item i {
    font-size: 20px;
    transition: transform 0.2s ease;
  }

  .nav-item span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.3px;
  }

  .nav-item:hover,
  .nav-item.active {
    color: var(--accent);
  }

  .nav-item.active {
    background: rgba(249, 115, 22, 0.15);
  }

  .nav-item.active i {
    transform: scale(1.1);
  }

  /* Pulse animation for active nav item */
  .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
  }

  .nav-item {
    position: relative;
  }
}

/* Mobile Category Navigation */
.mobile-cat-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-cat-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 0;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    /* smooth scrolling */
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--bg-primary);
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Custom Thin Scrollbar */
  .mobile-cat-nav::-webkit-scrollbar {
    height: 3px;
  }

  .mobile-cat-nav::-webkit-scrollbar-track {
    background: transparent;
  }

  .mobile-cat-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
  }

  .mobile-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
    transition: all 0.2s;
  }

  .mobile-cat-pill:hover,
  .mobile-cat-pill.active {
    background: var(--gradient-1);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  }
}

/* Extra small devices */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .nav-item {
    min-width: 50px;
    padding: 8px 8px;
  }

  .nav-item span {
    font-size: 9px;
  }
}

/* Dashboard Specific Styles */
.planner-card-world_geopolitics {
  background: linear-gradient(145deg, #1e1b4b 0%, #0f172a 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.planner-card-india {
  background: linear-gradient(145deg, #3f1908 0%, #1a0f0a 100%);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.planner-card-west_bengal {
  background: linear-gradient(145deg, #064e3b 0%, #022c22 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.planner-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.category-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 18px;
}

.category-badge-world_geopolitics {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.category-badge-india {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.category-badge-west_bengal {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Business & Startups - Purple */
.planner-card-business_startups {
  background: linear-gradient(145deg, #4c1d95 0%, #312e81 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.category-badge-business_startups {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Stock Market - Green */
.planner-card-stock_market {
  background: linear-gradient(145deg, #14532d 0%, #064e3b 100%);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.category-badge-stock_market {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Finance - Gold */
.planner-card-finance {
  background: linear-gradient(145deg, #713f12 0%, #451a03 100%);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.category-badge-finance {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

/* Mobile Dashboard Fixes */
@media (max-width: 768px) {

  .planner-section>div:first-child,
  .sunday-section>div:first-child {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
  }

  .planner-section .btn,
  .sunday-section .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .planner-section>div:nth-child(2) {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  .planner-card {
    min-width: 0 !important;
  }

  #sundaySuggestionsCard {
    padding: 20px !important;
  }

  #megaScriptModal>div {
    width: 95% !important;
    padding: 20px !important;
    margin: 10px !important;
  }
}