:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --border: #e2e8f0;
    --radius: 0.5rem;
    --font-hindi: 'Noto Sans Devanagari', sans-serif;
}

[data-bs-theme='dark'] {
    --bs-body-bg: #1e293b;
    --bs-body-color: #f8fafc;
    --border: #334155;
}

html, body {
  height: 100%;
  margin: 0;
}

/* Base Styles */
body {
    display: flex;
    flex-direction: column;
    font-family: var(--font-hindi);
    font-size: 0.9rem;
    line-height: 1.4;
}

.container-lg {
  flex: 1 0 auto;
}

.container-lg > footer {
  margin-top: auto;
}

/* Navigation Items */
.category-item, .subcategory-item, .question-item {
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    background: var(--bs-body-bg);
}

.category-item:hover, 
.subcategory-item:hover, 
.question-item:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

footer {
  /* sticky‑footer magic: */
  margin-top: auto;
  flex-shrink: 0;
}

/* Search Components */
#searchInput {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
}

#popularSearches {
    min-height: 2rem;
    margin: 0.5rem 0;
}

.popular-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-radius: 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popular-tag:hover {
    background: #3b82f6;
    color: white;
}

/* Popular Tags Positioning */
.popular-searches {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.tags-container {
    gap: 0.5rem;
    display: flex;
    flex-wrap: wrap;
}

.question-item {
    padding: 0.75rem;
    margin: 0.25rem 0;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.question-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.result-item {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 0.25rem;
    padding: 0.4rem;
    font-size: 0.9rem;
}

/* Video Container */
#videoContainer {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}

#searchResults {
    position: relative;
    z-index: 1000;
    background: var(--bs-body-bg);
    border-radius: var(--radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-result-item:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

/* Question Highlighting */
.highlight-match {
    background-color: rgba(255, 235, 59, 0.3);
    padding: 0.1rem 0.25rem;
    border-radius: 0.25rem;
}

.search-results-dropdown {
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: top center;
}

.search-result-item {
    transition: background-color 0.15s ease;
}

.question-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .container-lg {
        padding: 0.5rem;
    }
    
    .category-item, .subcategory-item, .question-item {
        font-size: 0.85rem;
        padding: 0.3rem;
    }
    
    #searchInput {
        font-size: 0.85rem;
    }
}

/* Autocomplete dropdown under search bar */
#searchDropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  max-height: 280px;
  overflow-y: auto;
  display: none;
  border: 1px solid rgba(0,0,0,0.15);
  border-top: none;
  border-radius: 0 0 .25rem .25rem;
  background: #fff;
}
#searchDropdown .list-group-item {
  cursor: pointer;
  padding: .75rem 1rem;
}
#searchDropdown .list-group-item:hover,
#searchDropdown .list-group-item.active {
  background-color: #f8f9fa;
}

/* Dark-mode overrides for the search autocomplete dropdown */
[data-bs-theme="dark"] #searchDropdown {
  background-color: #223352;       /* dark grey background */
  border-color: #454d55;           /* slightly lighter border */
}
[data-bs-theme="dark"] #searchDropdown .list-group-item {
  background-color: transparent;   /* inherit dropdown background */
  color: #fff;                     /* white text */
}
[data-bs-theme="dark"] #searchDropdown .list-group-item:hover,
[data-bs-theme="dark"] #searchDropdown .list-group-item.active {
  background-color: #495057;       /* hover highlight */
  color: #fff;                     /* keep text white */
}