/* Practice Page Specific Styles */
:root {
  --practice-background: 240 10% 3.9%;
  --practice-secondary: 240 4% 12%;
  --practice-border: 240 5% 16%;
  --practice-muted-foreground: 240 5% 64.9%;
}

/* Local resets/base styles if needed, but should mostly use Tailwind */
.dark body {
  background-color: hsl(var(--practice-background));
  color: hsl(var(--foreground));
}


/* Custom Components */
.card {
  background-color: hsl(var(--practice-secondary));
  border: 1px solid hsl(var(--practice-border));
  border-radius: 12px;
}

.text-subtle {
  color: hsl(var(--practice-muted-foreground));
}

.pill {
  border: 1px solid hsl(var(--practice-border));
  background-color: rgba(255, 255, 255, 0.06);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.progress {
  height: 8px;
  background-color: hsl(var(--practice-secondary));
  border: 1px solid hsl(var(--practice-border));
  border-radius: 9999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
}

.practice-progress-hero {
  margin: 0 auto;
  width: 100%;
  padding: 1rem 1.25rem;
}

@media (min-width: 1024px) {
  .practice-progress-hero {
    margin-left: 3.25rem;
    margin-right: 3.25rem;
    width: auto;
    padding: 1.2rem 0.6rem;
  }
}

.practice-progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.practice-progress-left {
  min-width: 180px;
}

.practice-progress-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.15;
  font-weight: 700;
  color: #ffffff;
}

.practice-progress-subtitle {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  color: #8b5cf6;
}

.practice-progress-stats {
  display: flex;
  align-items: flex-start;
  gap: 1.35rem;
}

.practice-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.practice-stat-label {
  font-size: 0.76rem;
  color: hsl(var(--practice-muted-foreground));
}

.practice-stat-value {
  font-size: 1.3rem;
  line-height: 1.05;
  font-weight: 700;
}

.practice-progress-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.practice-progress-track {
  height: 9px;
  width: 100%;
  max-width: 760px;
  border: 0;
  background-color: rgba(124, 58, 237, 0.22);
}

.practice-progress-track > span {
  background: linear-gradient(90deg, #7c3aed 0%, #8b5cf6 62%, #a78bfa 100%);
}

.practice-progress-text {
  font-size: 0.9rem;
  color: #d1d5db;
  white-space: nowrap;
}

.practice-main-sections {
  border-top: 1px solid rgba(148, 163, 184, 0.34);
  padding-top: 0.9rem;
  display: flex !important;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .practice-main-sections {
    display: grid !important;
  }
}

@media (min-width: 1024px) {
  .practice-progress-hero {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }
}

@media (max-width: 1024px) {
  .practice-progress-title {
    font-size: 1.1rem;
  }

  .practice-stat-value {
    font-size: 1.1rem;
  }

  .practice-progress-track {
    width: min(540px, 72vw);
  }
}

@media (max-width: 768px) {
  .practice-progress-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .practice-progress-stats {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1rem 1.4rem;
  }

  .practice-progress-row {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .practice-progress-track {
    width: 100%;
  }

  .practice-progress-text {
    font-size: 0.9rem;
  }
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-link:focus {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* Active filter states */
.diff.active {
  font-weight: 600;
  box-shadow: 0 0 0 2px currentColor;
  opacity: 1 !important;
}

.category-link.active {
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  flex-shrink: 0;
  min-height: 2.25rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  color: hsl(var(--practice-muted-foreground));
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tab-btn:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(160, 170, 190, 0.16);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.08) 100%);
  border-color: rgba(203, 213, 225, 0.28);
  color: white;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
}

.practice-type-tabs {
  width: 100%;
  gap: 0.3rem;
  padding: 0.3rem;
  border: 1px solid rgba(153, 163, 184, 0.2);
  border-radius: 0.95rem;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.07) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}

.practice-type-tabs::-webkit-scrollbar {
  display: none;
}

@media (min-width: 1024px) {
  .practice-type-tabs {
    width: 52%;
    max-width: 560px;
  }
}

.practice-sort-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 0.75rem;
  padding: 0.75rem 0.75rem;
  color: #f3f4f6;
  font-size: 0.88rem;
  line-height: 1.2;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.practice-sort-trigger {
  background-color: #0d1016;
  border-color: rgba(126, 138, 168, 0.24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  font-size: 0.9rem;
}

.practice-sort-trigger:hover {
  border-color: rgba(126, 138, 168, 0.36);
}

.practice-sort-trigger:focus-visible {
  box-shadow: 0 0 0 1px rgba(126, 138, 168, 0.28), 0 12px 28px rgba(0, 0, 0, 0.26);
}

.practice-sort-menu {
  background-color: #14171f;
  border-color: rgba(126, 138, 168, 0.18);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.44);
  overflow: hidden;
  isolation: isolate;
}

.practice-dropdown-trigger {
  background-color: #0d1016;
  border-color: rgba(126, 138, 168, 0.24);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  font-size: 0.9rem;
}

.practice-dropdown-trigger:hover {
  border-color: rgba(126, 138, 168, 0.34);
}

.practice-dropdown-trigger:focus-visible {
  box-shadow: 0 0 0 1px rgba(126, 138, 168, 0.24), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.practice-dropdown-menu {
  background-color: #14171f;
  border-color: rgba(126, 138, 168, 0.18);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  overflow: hidden;
  isolation: isolate;
}

.practice-dropdown-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 0.625rem;
  padding: 0.625rem 0.7rem;
  color: #f3f4f6;
  font-size: 0.86rem;
  line-height: 1.15;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.practice-dropdown-option:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.practice-dropdown-option.is-selected {
  background: linear-gradient(180deg, #ffd772 0%, #ffcf61 100%);
  color: #16181f;
}

.practice-dropdown-option.is-selected i {
  color: #7b8598;
  opacity: 1 !important;
}

.practice-dropdown.is-open .practice-dropdown-trigger {
  border-color: rgba(126, 138, 168, 0.38);
}

.practice-dropdown.is-open .practice-dropdown-chevron {
  transform: rotate(180deg);
}

[data-dropdown="difficulty"] .practice-dropdown-trigger,
[data-dropdown="status"] .practice-dropdown-trigger {
  min-height: 42px;
  padding: 0.625rem 0.9rem;
  border-radius: 0.875rem;
  font-size: 0.88rem;
}

[data-dropdown="difficulty"] .practice-dropdown-menu,
[data-dropdown="status"] .practice-dropdown-menu {
  top: calc(100% + 6px);
  border-radius: 1rem;
  padding: 0.45rem;
}

[data-dropdown="difficulty"] .practice-dropdown-option,
[data-dropdown="status"] .practice-dropdown-option {
  min-height: 40px;
}

.practice-sort-option:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.practice-sort-option.is-selected {
  background: linear-gradient(180deg, #ffd772 0%, #ffcf61 100%);
  color: #16181f;
}

.practice-sort-option.is-selected i {
  color: #7b8598;
  opacity: 1 !important;
}

.practice-sort.is-open .practice-sort-trigger {
  border-color: rgba(126, 138, 168, 0.38);
}

.practice-sort.is-open #sort-chevron {
  transform: rotate(180deg);
}

/* Favicon styling */
link[rel="icon"], link[rel="shortcut icon"] {
  border-radius: 50% !important;
}

#favicon {
  border-radius: 50%;
  background: white;
  padding: 2px;
}

/* Mobile Responsiveness - Refined build */
@media screen and (max-width: 640px) {
  body { font-size: 14px; width: 100% !important; overflow-x: clip !important; }
  
  .site-container, .navbar-panel { 
    padding-left: 1rem !important; 
    padding-right: 1rem !important; 
  }
  
  h1 { font-size: 1.25rem !important; line-height: 1.2; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }
  
  .practice-progress-header { gap: 1rem; }
  .practice-progress-stats { gap: 0.75rem 1rem; }
}

/* Touch fixes */
@media (hover: none) and (pointer: coarse) {
  button, .btn, main a[href] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Sidebar Redesign Styles */
.sidebar-container .sidebar-search input {
  color: white;
}

.category-header {
  user-select: none;
}

.category-header .pill {
  font-weight: 700;
  border: none;
}

.subtopics-list .category-link {
  font-size: 0.875rem;
  color: #94a3b8; /* Slate 400 */
}

.subtopics-list .category-link:hover {
  color: #a78bfa; /* Purple 400 */
  background-color: rgba(255, 255, 255, 0.03);
}

.subtopics-list .category-link.active {
  color: #a78bfa;
  background-color: rgba(124, 58, 237, 0.1);
  font-weight: 600;
}

.subtopics-list .pill {
  background-color: #1e1e2e;
  color: #94a3b8;
  border: 1px solid #334155;
  font-size: 10px;
  min-width: 24px;
  text-align: center;
}

/* Sidebar Tab active state */
.sidebar-container .tab-btn.active {
  background-color: rgba(124, 58, 237, 0.1);
}

.sidebar-container .tab-btn.active span {
  color: #a78bfa;
  font-weight: 600;
}

#category-accordion {
  --accordion-max-height: min(70dvh, calc(100dvh - 14rem));
  max-height: var(--accordion-max-height);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 0.25rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.5) rgba(255, 255, 255, 0.04);
}

@supports not (height: 100dvh) {
  #category-accordion {
    --accordion-max-height: min(70vh, calc(100vh - 14rem));
  }
}

@media (max-width: 1024px) {
  #category-accordion {
    --accordion-max-height: min(64dvh, calc(100dvh - 13rem));
  }
}

@media (max-width: 640px) {
  #category-accordion {
    --accordion-max-height: min(58dvh, calc(100dvh - 12rem));
  }
}

#category-accordion::-webkit-scrollbar {
  width: 6px;
}

#category-accordion::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

#category-accordion::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.5);
  border-radius: 999px;
}

#category-accordion::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.75);
}

/* Expansion Animation Utility */
.subtopics-list {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, opacity 0.3s ease-in;
}

.subtopics-list:not(.hidden) {
  max-height: 999px;
  opacity: 1;
  overflow: hidden;
}

/* Transition for filters-header if needed */
#filters-header:hover i[data-lucide] {
  color: white;
}

/* Force hide default select arrows */
select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

select::-ms-expand {
  display: none !important;
}

/* Style the internal options list where supported */
select, select:focus, select:active {
  background-color: transparent !important;
}

select option {
  background-color: #0c0c12 !important; /* Slightly lighter than pure black for contrast */
  color: white !important;
  padding: 10px;
}

/* Filter Toggle Active State (Orange) */
#filters-toggle.active {
  border-color: #f97316 !important;
  background-color: rgba(249, 115, 22, 0.1) !important;
}

#filters-toggle.active span,
#filters-toggle.active i {
  color: #f97316 !important;
}
