/* ── Reset & Mobile-First Responsive Light Design System ─────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Premium Slate & Blue Light Palette */
  --bg: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border: #cbd5e1;
  --border-muted: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bg: rgba(37, 99, 235, 0.08);
  --accent-border: rgba(37, 99, 235, 0.25);

  --easy: #15803d;
  --easy-bg: #dcfce7;
  --easy-border: #86efac;

  --medium: #b45309;
  --medium-bg: #fef3c7;
  --medium-border: #fde047;

  --hard: #b91c1c;
  --hard-bg: #fee2e2;
  --hard-border: #fca5a5;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px -5px rgba(37, 99, 235, 0.09);
  --shadow-hover: 0 14px 36px rgba(37, 99, 235, 0.14);
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility Focus Ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { text-decoration: underline; color: var(--accent-hover); }
button { font-family: var(--font-sans); cursor: pointer; border: none; background: none; }

/* ── Container Layout (Fluid 320px - 1920px) ─────────────────────── */
.app-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 60px 16px;
}

@media (min-width: 768px) {
  .app-container { padding: 0 24px 60px 24px; }
}

@media (min-width: 1280px) {
  .app-container { padding: 0 32px 60px 32px; }
}

/* ── Glassmorphism Header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

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

.brand-logo {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.brand-logo span {
  color: var(--accent);
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  display: none;
}

@media (min-width: 480px) {
  .brand-tag { display: inline-block; }
}

.nav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.nav-btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: all 0.18s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-muted);
}

.nav-btn.active {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

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

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 99px;
  white-space: nowrap;
}

.mobile-toggle-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
}

.mobile-toggle-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ── Mobile Navigation Drawer ───────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 250;
  display: none;
  backdrop-filter: blur(4px);
}

.drawer-backdrop.open {
  display: block;
}

.mobile-drawer {
  position: fixed;
  top: 0; right: -300px; bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 300;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
}

.mobile-drawer.open {
  right: 0;
}

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

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.drawer-nav .nav-btn {
  width: 100%;
  justify-content: flex-start;
}

/* ── Hero Banner ─────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 36px);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px; width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(37,99,235,0.09) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content h1 {
  font-size: clamp(1.35rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.hero-content p {
  font-size: clamp(0.9rem, 2vw, 1.02rem);
  color: var(--text-secondary);
  max-width: 850px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

@media (min-width: 640px) {
  .hero-actions { width: auto; }
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  padding: 11px 22px;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--radius);
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
  flex: 1 1 auto;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 11px 22px;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--radius);
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  flex: 1 1 auto;
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--text-secondary);
  transform: translateY(-1px);
}

/* ── Filter Panel ──────────────────────────────────────────────────── */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 3vw, 24px);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}

.search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 280px;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 65px;
}

.chip-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-surface);
}

.chip-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.chip-btn.easy.active { background: var(--easy-bg); color: var(--easy); border-color: var(--easy); }
.chip-btn.medium.active { background: var(--medium-bg); color: var(--medium); border-color: var(--medium); }
.chip-btn.hard.active { background: var(--hard-bg); color: var(--hard); border-color: var(--hard); }

.select-filter {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  min-height: 40px;
  transition: border-color 0.15s ease;
  width: 100%;
  max-width: 240px;
}

.select-filter:focus {
  border-color: var(--accent);
}

/* ── Problem Table & Responsive Mobile View ──────────────────────── */
.table-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.problem-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow);
  max-width: 100%;
}

.problem-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 680px;
}

.problem-table th {
  background: var(--bg-elevated);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.problem-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-muted);
  font-size: 13.5px;
}

.problem-row {
  transition: background 0.12s ease;
}

.problem-row:hover {
  background: var(--bg-hover);
}

.problem-row.done {
  opacity: 0.75;
  background: rgba(21, 128, 61, 0.04);
}

.col-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  width: 60px;
}

.col-title {
  font-weight: 600;
}

.q-title-link {
  color: var(--text-primary);
  cursor: pointer;
  transition: color 0.15s ease;
}

.q-title-link:hover {
  color: var(--accent);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-align: center;
  white-space: nowrap;
}

.badge-easy { background: var(--easy-bg); color: var(--easy); border: 1px solid var(--easy-border); }
.badge-medium { background: var(--medium-bg); color: var(--medium); border: 1px solid var(--medium-border); }
.badge-hard { background: var(--hard-bg); color: var(--hard); border: 1px solid var(--hard-border); }

.topic-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
}

.pattern-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(37, 99, 235, 0.2);
  margin-left: 4px;
}

.leetcode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  transition: all 0.18s ease;
  min-height: 38px;
  white-space: nowrap;
}

.leetcode-btn:hover {
  background: #d97706;
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

.action-cb {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.star-btn {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover { transform: scale(1.15); }
.star-btn.starred { color: #f59e0b; }

/* ── Mobile Question Card View ───────────────────────────────────── */
.mobile-card-list {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.mobile-q-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.mobile-q-card.done {
  opacity: 0.8;
  border-left: 4px solid var(--easy);
}

.mobile-q-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-q-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.mobile-q-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius);
  min-height: 44px;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--text-secondary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ── Views Sections & Multi-Column Laptop Layout ────────────────── */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* Dynamic Responsive Multi-Column Grid Scaling */
.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 18px;
}

@media (min-width: 640px) {
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

@media (min-width: 1024px) {
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}

@media (min-width: 1440px) {
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 26px);
  box-shadow: var(--shadow);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card h3 {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.card h4 {
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.65;
}

/* ── Modal Window & Scrollable Code Blocks ───────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  backdrop-filter: blur(5px);
}

.modal-overlay.open {
  display: flex;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 1000px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-elevated);
}

.modal-title-area h2 {
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-body {
  padding: clamp(16px, 3vw, 26px);
  overflow-y: auto;
  flex: 1;
}

.code-block {
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
  max-width: 100%;
  margin-top: 10px;
  white-space: pre;
  line-height: 1.55;
}

.hint-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 10px;
  font-size: 13px;
}

/* Responsive Rules for Mobile (<= 768px) */
@media (max-width: 900px) {
  .nav-tabs { display: none; }
  .mobile-toggle-btn { display: inline-flex; }
}

@media (max-width: 768px) {
  .problem-table-wrapper { display: none; }
  .mobile-card-list { display: flex; }
  .modal-header { flex-direction: column; align-items: flex-start; }
}
