/* Make category name bold when selected */
.category-badge.active .category-name {
  font-weight: 700;
}

.category-badge .category-count {
  background: #60a5fa;
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  padding: 2px 10px;
  margin-left: 0.7em;
  font-size: 0.95em;
  display: inline-block;
  min-width: 2em;
  text-align: center;
  box-shadow: 0 1px 4px #b3eefe55;
  transition: background 0.2s, color 0.2s;
  position: relative;
  z-index: 9999;
  outline: 2px solid #fff;
  outline-offset: -2px;
  pointer-events: auto;
}

.category-badge:hover .category-count,
.category-badge:focus .category-count,
.category-badge.active .category-count {
  background: #60a5fa !important;
  color: #fff !important;
  font-weight: 900;
  z-index: 9999;
  position: relative;
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* Collapsible Sidebar */
.sidebar {
  position: relative;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  min-width: 0 !important;
}

/* Collapsible Sidebar (fixed toggle button) */
.sidebar-collapsed {
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  padding: 0 !important;
  border: none !important;
  overflow: visible !important;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .sidebar-content {
  display: none !important;
}

/* Sidebar toggle always visible at edge of sidebar */
.sidebar-toggle {
  position: absolute;
  top: 16px;
  right: -8px;
  width: 32px;
  height: 32px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 2px 8px #2563eb22;
  cursor: pointer;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, right 0.25s;
}

.sidebar-toggle:focus, .sidebar-toggle:hover {
  background: #1746a0;
}

.sidebar-collapsed .sidebar-toggle {
  right: -8px;
  left: auto;
  background: #2563eb;
  border-radius: 0 8px 8px 0;
}

.sidebar-toggle span {
  font-size: 1.3em;
  pointer-events: none;
}

@media (max-width: 640px) {
  .sidebar-collapsed {
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
  }

  .sidebar-toggle {
    top: 8px;
    right: -6px;
    width: 28px;
    height: 28px;
  }

  .sidebar-collapsed .sidebar-toggle {
    right: -6px;
  }
}

@media (max-width: 640px) {
  .sidebar-toggle {
    top: 8px;
    left: 0;
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 640px) {
  .sidebar-toggle {
    top: 8px;
    right: -14px;
    width: 28px;
    height: 28px;
  }
}

.category-group-count {
  color: #2563eb !important;
  font-size: 1em;
  font-weight: 700;
  margin-left: 0.7em;
  background: none;
  border-radius: 0;
  padding: 0;
  display: inline-block;
  box-shadow: none;
}

/* Accordion for category groups */
.category-group-list.collapsed {
  display: none;
}

.category-group-header {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 700;
  color: #2563eb;
  padding: 0.7rem 0.5rem 0.7rem 0;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  outline: none;
  transition: background 0.2s;
  min-width: 0;
  gap: 0.5rem;
}

.category-group-header:focus, .category-group-header:hover {
  background: #e8f0fe;
}

.category-group-toggle {
  font-size: 1.1em;
  transition: transform 0.2s;
  flex-shrink: 0;
  min-width: 1.5em;
  text-align: right;
  align-self: flex-start;
}

.category-group-header .category-group-label-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  flex: 1 1 0;
  gap: 0.5em;
}

.category-group-header .category-group-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-group-header .category-group-count {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 0.7em;
}

@media (max-width: 340px) {
  .category-group-header .category-group-label-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .category-group-header .category-group-count {
    margin-left: 0;
    margin-top: 2px;
  }
}

.filter-btn span {
  color: #1e293b !important;
  font-weight: 700;
  z-index: 2;
}

/* === Enhanced Responsive Breakpoints for Context-Aware Navbar === */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
  .navbar-landing {
    padding: 18px 32px;
    gap: 24px;
  }

  .navbar-app {
    padding: 14px 24px;
    gap: 16px;
  }

  .logo {
    font-size: 1.9rem;
    letter-spacing: 1.4px;
  }

  .landing-tagline {
    font-size: 1.2rem;
  }

  #search-input {
    width: 280px;
  }

  .sidebar {
    width: 280px;
    padding: 20px;
  }

  .main-content {
    padding: 0 24px 24px 24px;
  }

  .category-title {
    font-size: 2rem;
  }

  .category-desc {
    font-size: 1.1rem;
  }

  .filter-btn {
    font-size: 0.85rem;
    padding: 7px 16px;
  }
}

/* Tablets */
@media (max-width: 1024px) {
  .navbar-landing {
    grid-template-columns: auto 1fr;
    gap: 16px;
    padding: 16px 24px;
  }

  .navbar-app {
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 12px 20px;
  }

  .landing-nav-center {
    justify-self: end;
  }

  .landing-nav-right {
    justify-self: end;
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 12px;
    justify-self: center;
  }

  .app-nav-center {
    justify-self: center;
  }

  .app-nav-right {
    justify-self: end;
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 10px;
    justify-self: center;
    width: 100%;
    justify-content: center;
  }

  .nav-filters {
    gap: 3px;
    padding: 4px;
  }

  .filter-btn {
    font-size: 0.8rem;
    padding: 6px 14px;
  }

  .landing-tagline {
    font-size: 1.1rem;
  }

  .logo {
    font-size: 1.7rem;
  }

  #search-input {
    width: 100%;
    max-width: 320px;
  }

  .search-container {
    flex-grow: 1;
    max-width: 400px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
  }

  .sidebar {
    width: 260px;
  }

  .category-title {
    font-size: 1.8rem;
  }

  .category-desc {
    font-size: 1rem;
  }
}

/* Small tablets and large phones */
@media (max-width: 840px) {
  .navbar-landing {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 16px;
    padding: 16px 20px;
  }

  .navbar-app {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 12px;
    padding: 12px 16px;
  }

  .landing-nav-left, .app-nav-left {
    justify-content: center;
    order: 1;
  }

  .landing-nav-center, .app-nav-center {
    justify-self: center;
    order: 2;
    width: 100%;
  }

  .landing-nav-right, .app-nav-right {
    justify-self: center;
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 0;
  }

  .nav-filters {
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  .filter-btn {
    font-size: 0.75rem;
    padding: 5px 12px;
  }

  .btn-home {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .logo {
    font-size: 1.5rem;
    letter-spacing: 1.2px;
  }

  .favicon {
    width: 40px;
    height: 40px;
  }

  .landing-tagline {
    font-size: 1rem;
  }

  .landing-stats {
    padding: 6px 16px;
  }

  .stat-item {
    font-size: 0.8rem;
  }

  #search-input {
    width: 100%;
    max-width: 280px;
    padding: 10px 40px 10px 16px;
    font-size: 0.9rem;
  }

  .btn-discover {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .container {
    flex-direction: column;
    padding: 16px 16px;
    height: auto;
    min-height: calc(100vh - 68px);
  }

  .sidebar {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 16px #a2c7ff42;
    margin-bottom: 16px;
    padding: 16px;
    max-height: none;
    overflow-y: visible;
  }

  .sidebar-title {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }

  .category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
  }

  .category-badge {
    font-size: 0.85rem;
    padding: 8px 4px;
  }

  .main-content {
    border-radius: 16px;
    padding: 20px;
    overflow-y: visible;
    height: auto;
  }

  .category-header-panel {
    padding: 18px;
    margin-bottom: 24px;
    border-radius: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    align-self: stretch;
    justify-content: space-between;
  }

  .category-title {
    font-size: 1.6rem;
    white-space: normal;
    text-align: left;
  }

  .category-desc {
    font-size: 1rem;
    white-space: normal;
    text-align: left;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .card-header {
    padding: 12px 16px !important;
  }

  .card-header h4 {
    font-size: 1.1rem !important;
  }

  .card-header img {
    width: 36px !important;
    height: 36px !important;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
  }

  .card-footer button, .card-footer a {
    width: 100% !important;
    flex: 1 1 auto;
    max-width: none !important;
    min-width: 0 !important;
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  .modal {
    max-height: 95vh;
    margin: 10px;
  }

  .modal-header {
    padding: 14px 20px;
    flex-wrap: wrap;
  }

  .modal-header h3 {
    font-size: 1.5rem;
    white-space: normal;
  }

  .modal-content {
    padding: 20px 24px;
  }

  .modal-content .label {
    flex-basis: 120px;
    font-size: 0.9rem;
  }

  .modal-footer {
    padding: 14px 20px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .modal-footer .btn {
    min-width: 110px;
    font-size: 0.9rem;
    padding: 9px 14px;
  }
}

/* Mobile phones */
@media (max-width: 640px) {
  .navbar-landing, .navbar-app {
    padding: 12px 12px;
    gap: 12px;
  }

  .nav-filters {
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px;
  }

  .filter-btn {
    font-size: 0.7rem;
    padding: 4px 10px;
  }

  .btn-home {
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  .logo {
    font-size: 1.3rem;
    letter-spacing: 1px;
  }

  .favicon {
    width: 36px;
    height: 36px;
  }

  .landing-tagline {
    font-size: 0.9rem;
  }

  .landing-stats {
    padding: 5px 12px;
    flex-direction: column;
    gap: 4px;
  }

  .stat-divider {
    display: none;
  }

  .stat-item {
    font-size: 0.75rem;
  }

  #search-input {
    width: 100%;
    max-width: 240px;
    padding: 8px 35px 8px 14px;
    font-size: 0.85rem;
  }

  .btn-discover {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .context-info {
    font-size: 0.85rem;
  }

  .container {
    padding: 0;
  }

  .sidebar {
    padding: 12px;
    border-radius: 12px;
  }

  .sidebar-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .category-badge {
    font-size: 0.8rem;
    padding: 6px 4px;
  }

  .recently-viewed {
    padding-top: 12px;
    margin-top: 12px;
  }

  .recently-viewed h3 {
    font-size: 0.9rem;
  }

  .main-content {
    padding: 16px 12px;
    border-radius: 12px;
  }

  .category-header-panel {
    padding: 16px 12px;
    margin-bottom: 20px;
    border-radius: 12px;
  }

  .category-title {
    font-size: 1.4rem;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
  }

  .category-desc {
    font-size: 0.95rem;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
  }

  .app-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .app-card {
    min-height: 320px !important;
  }

  .card-header {
    padding: 10px 12px !important;
    min-height: 50px !important;
  }

  .card-header h4 {
    font-size: 1rem !important;
    white-space: normal !important;
    word-wrap: break-word;
  }

  .card-header img {
    width: 32px !important;
    height: 32px !important;
  }

  .details {
    padding: 8px 12px !important;
  }

  .details .description {
    font-size: 0.9rem;
    padding: 6px 8px;
  }

  .data-row {
    font-size: 0.85rem !important;
  }

  .card-footer {
    padding: 10px 12px;
  }

  .card-footer button, .card-footer a {
    font-size: 0.85rem;
    padding: 8px 10px;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  .navbar-landing, .navbar-app {
    padding: 10px 8px;
  }

  .filter-btn {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  .btn-home {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .logo {
    font-size: 1.1rem;
    letter-spacing: 0.8px;
  }

  .favicon {
    width: 32px;
    height: 32px;
  }

  .landing-tagline {
    font-size: 0.8rem;
  }

  .stat-item {
    font-size: 0.7rem;
  }

  #search-input {
    padding: 6px 30px 6px 12px;
    font-size: 0.8rem;
    max-width: 200px;
  }

  .btn-discover {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .context-info {
    font-size: 0.8rem;
  }

  .container {
    padding: 8px 4px;
  }

  .sidebar {
    padding: 8px;
    border-radius: 8px;
  }

  .sidebar-title {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 4px;
  }

  .category-badge {
    font-size: 0.7rem;
    padding: 4px 2px;
  }

  .main-content {
    padding: 12px 8px;
    border-radius: 8px;
  }

  .category-header-panel {
    padding: 12px 8px;
    margin-bottom: 16px;
    border-radius: 8px;
  }

  .category-title {
    font-size: 1.2rem;
  }

  .category-desc {
    font-size: 0.9rem;
  }

  .app-grid {
    gap: 10px;
  }

  .app-card {
    min-height: 280px !important;
    border-radius: 8px !important;
  }

  .card-header {
    padding: 8px 10px !important;
    min-height: 45px !important;
    border-radius: 8px 8px 0 0 !important;
  }

  .card-header h4 {
    font-size: 0.9rem !important;
  }

  .card-header img {
    width: 28px !important;
    height: 28px !important;
  }

  .details {
    padding: 6px 8px !important;
  }

  .details .description {
    font-size: 0.85rem;
    padding: 5px 6px;
  }

  .data-row {
    font-size: 0.8rem !important;
    margin-bottom: 4px !important;
  }

  .card-footer {
    padding: 8px 10px;
    border-radius: 0 0 12px 12px !important;
  }

  .card-footer button, .card-footer a {
    font-size: 0.8rem;
    padding: 7px 8px;
  }

  /* Modal adjustments for small screens */
  .modal-backdrop {
    padding: 10px;
    align-items: center;
  }

  .modal {
    max-height: 95vh;
    border-radius: 16px;
  }

  .modal-header {
    padding: 12px 16px;
    border-radius: 16px 16px 0 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .modal-header h3 {
    font-size: 1.2rem;
    white-space: normal;
    word-wrap: break-word;
    text-align: left;
    width: 100%;
  }

  .modal-close {
    font-size: 24px;
    align-self: flex-end;
    position: absolute;
    top: 12px;
    right: 16px;
  }

  .modal-content {
    padding: 16px 20px;
    font-size: 0.9rem;
  }

  .modal-content .section {
    flex-direction: column;
    margin-bottom: 12px;
  }

  .modal-content .label {
    flex-basis: auto;
    margin-bottom: 4px;
    font-size: 0.85rem;
  }

  .modal-content .value {
    font-size: 0.85rem;
  }

  .modal-footer {
    padding: 12px 16px;
    border-radius: 0 0 16px 16px;
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
    min-width: 0;
    font-size: 0.85rem;
    padding: 8px 12px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .navbar-landing, .navbar-app {
    padding: 8px 6px;
  }

  .filter-btn {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .btn-home {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .logo {
    font-size: 0.9rem;
    letter-spacing: 0.3px;
  }

  .favicon {
    width: 24px;
    height: 24px;
  }

  #search-input {
    padding: 5px 25px 5px 10px;
    font-size: 0.8rem;
    max-width: 140px;
  }

  .btn-accent {
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
  }

  .container {
    padding: 6px 2px;
  }

  .sidebar {
    padding: 6px;
  }

  .sidebar-title {
    font-size: 1rem;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 4px;
  }

  .category-badge {
    font-size: 0.7rem;
    padding: 4px 2px;
  }

  .main-content {
    padding: 10px 6px;
  }

  .category-header-panel {
    padding: 10px 6px;
    margin-bottom: 12px;
  }

  .category-title {
    font-size: 1rem;
  }

  .category-desc {
    font-size: 0.8rem;
  }

  .app-grid {
    gap: 8px;
  }

  .app-card {
    min-height: 250px !important;
    border-radius: 8px !important;
  }

  .card-header {
    padding: 6px 8px !important;
    min-height: 40px !important;
    border-radius: 8px 8px 0 0 !important;
  }

  .card-header h4 {
    font-size: 0.8rem !important;
  }

  .card-header img {
    width: 24px !important;
    height: 24px !important;
  }

  .details {
    padding: 5px 6px !important;
  }

  .details .description {
    font-size: 0.8rem;
    padding: 4px 5px;
  }

  .data-row {
    font-size: 0.75rem !important;
    margin-bottom: 3px !important;
  }

  .card-footer {
    padding: 6px 8px;
    border-radius: 0 0 8px 8px !important;
  }

  .card-footer button, .card-footer a {
    font-size: 0.75rem;
    padding: 6px 6px;
  }

  .modal {
    border-radius: 12px;
    margin: 5px;
  }

  .modal-header {
    padding: 10px 12px;
    border-radius: 12px 12px 0 0;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-close {
    font-size: 20px;
    top: 10px;
    right: 12px;
  }

  .modal-content {
    padding: 12px 16px;
    font-size: 0.8rem;
  }

  .modal-content .label {
    font-size: 0.8rem;
  }

  .modal-content .value {
    font-size: 0.8rem;
  }

  .modal-footer {
    padding: 10px 12px;
    border-radius: 0 0 12px 12px;
  }

  .modal-footer .btn {
    font-size: 0.8rem;
    padding: 7px 10px;
  }
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #e8f0fe 0%, #ffffff 100%);
  color: #21243d;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
  -webkit-backdrop-filter: saturate(140%) blur(7px);
  backdrop-filter: saturate(140%) blur(7px);
  overflow-x: hidden;
}

/* Scrollbar styling */
body::-webkit-scrollbar,
.app-grid::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body::-webkit-scrollbar-track,
.app-grid::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: #f3f6fa;
}

body::-webkit-scrollbar-thumb,
.app-grid::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background-color: #bfcaff;
  border-radius: 4px;
}

/* Enhanced Context-Aware Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  box-shadow: 0 4px 32px rgba(102, 126, 234, 0.25);
  backdrop-filter: blur(20px) saturate(150%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Landing Page Navbar */
.navbar-landing {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 20px 40px;
  min-height: 72px;
}

.landing-nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.landing-nav-center {
  text-align: center;
  overflow: hidden;
}

.landing-tagline {
  font-size: 1.3rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff, #f0f8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landing-nav-right {
  justify-self: end;
}

.landing-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-item {
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.stat-divider {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 300;
}

/* App Page Navbar */
.navbar-app {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  min-height: 68px;
}

.app-nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.app-nav-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Enhanced Logo and Favicon */
.favicon {
  width: 48px;
  height: 48px;
  border-radius: 0px;
  filter: drop-shadow(0 4px 16px rgba(255, 255, 255, 0.3));
  object-fit: contain;
  transition: transform 0.3s ease;
}

.favicon:hover {
  transform: scale(1.5) rotate(0deg);
}

.logo {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff, #f0f8ff, #e6f3ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1.8px;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.3);
  user-select: text;
  white-space: nowrap;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.02);
}

/* Enhanced Buttons */
.btn-home {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  border: none;
  padding: 12px 28px;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-home::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.btn-home:hover::before {
  left: 100%;
}

.btn-home:hover, .btn-home:focus {
  background: linear-gradient(135deg, #ff5252, #d32f2f);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 107, 107, 0.6);
  outline: none;
}

/* AI Apps button for landing navbar */
.btn-ai-apps {
  background: linear-gradient(135deg, #2563eb, #4f8cff);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 20px rgba(30, 64, 175, 0.13);
  white-space: nowrap;
  outline: none;
  margin: 0 0.25rem;
}

.btn-ai-apps:hover, .btn-ai-apps:focus {
  background: linear-gradient(135deg, #1746a0, #2563eb);
  color: #e0e7ef;
  box-shadow: 0 8px 32px rgba(30, 64, 175, 0.18);
  outline: none;
}

/* About Us button for landing navbar */
.btn-about {
  background: linear-gradient(135deg, #a259e6, #6d28d9);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 20px rgba(109, 40, 217, 0.13);
  white-space: nowrap;
  outline: none;
  margin: 0 0.25rem;
}

.btn-about:hover, .btn-about:focus {
  background: linear-gradient(135deg, #6d28d9, #a259e6);
  color: #e0e7ef;
  box-shadow: 0 8px 32px rgba(109, 40, 217, 0.18);
  outline: none;
}

/* Contact Us button for landing navbar */
.btn-contact-nav {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.13);
  white-space: nowrap;
  outline: none;
  margin: 0 0.25rem;
}

.btn-contact-nav:hover, .btn-contact-nav:focus {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #e0e7ef;
  box-shadow: 0 8px 32px rgba(34, 197, 94, 0.18);
  outline: none;
}

/* Enhanced Filter Buttons */
.nav-filters {
  display: flex;
  gap: 4px;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-btn {
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 16px;
}

.filter-btn span {
  position: relative;
  z-index: 1;
}

.filter-btn:hover, .filter-btn:focus {
  color: white;
  transform: translateY(-1px);
  outline: none;
}

.filter-btn:hover::before, .filter-btn:focus::before {
  opacity: 0.2;
}

.filter-btn.active {
  background: rgba(135, 156, 173, 0.25);
  /* semi-transparent blue */
  color: black;
  box-shadow: 0 4px 16px rgba(154, 200, 240, 0.15);
  transform: translateY(-1px);
  border: 1.5px solid rgba(79, 172, 254, 0.35);
}

.filter-btn.active::before {
  opacity: .4;
}

.nav-context {
  transition: opacity 0.3s ease;
}

.context-info {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* Enhanced Search Container */
.search-container {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  border-radius: 25px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#search-input {
  width: 320px;
  padding: 12px 45px 12px 20px;
  border-radius: 23px;
  border: none;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  color: #2d3748;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

#search-input::placeholder {
  color: #a0aec0;
  font-weight: 500;
}

#search-input:focus {
  background: white;
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(79, 172, 254, 0.3), inset 0 2px 8px rgba(0, 0, 0, 0.05);
  outline: none;
}

.clear-search-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  border: none;
  font-size: 14px;
  color: white;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  font-weight: bold;
}

.clear-search-btn:hover, .clear-search-btn:focus {
  background: linear-gradient(135deg, #ff5252, #d32f2f);
  transform: translateY(-50%) scale(1.1);
  outline: none;
}

.clear-search-btn.visible {
  display: flex;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.15);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-suggestions.visible {
  display: block;
}

.suggestion-item {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f7fafc;
  font-size: 0.95rem;
  color: #4a5568;
  transition: all 0.2s ease;
  font-weight: 500;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover, .suggestion-item:focus {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: white;
  outline: none;
  transform: translateX(4px);
}

/* Enhanced Discover Button */
.btn-discover {
  background: linear-gradient(135deg, #a8e6cf, #88d8a3);
  color: #2d5016;
  border: none;
  padding: 12px 24px;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(168, 230, 207, 0.4);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-discover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.btn-discover:hover::before {
  left: 100%;
}

.btn-discover:hover, .btn-discover:focus {
  background: linear-gradient(135deg, #88d8a3, #66bb6a);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(168, 230, 207, 0.6);
  outline: none;
}

/* Container */
.container {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
  padding: 0;
  gap: 12px;
  background: linear-gradient(135deg, #f7fbff 0%, #f2f4fa 100%);
}

/* Enhanced Sidebar */
.sidebar {
  flex-shrink: 0;
  width: 300px;
  min-width: 250px;
  max-width: 800px;
  background: rgba(255, 255, 255, 0.95);
  color: #7380a5;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  backdrop-filter: blur(7px);
  position: relative;
  resize: horizontal;
  transition: width 0.1s ease-out;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(115, 128, 165, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(115, 128, 165, 0.3);
}

.sidebar-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #3b82f6;
  border-bottom: 2px solid #e3e6f0;
  margin-bottom: 24px;
  user-select: none;
  text-align: center;
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-list li {
  margin: 0;
}

/* Ensure stacking context for count badge */
.category-badge {
  all: unset;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  width: 100%;
  border-radius: 8px;
  background: transparent;
  color: #647491;
  font-weight: 600;
  font-size: .925rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
  overflow: visible;
  isolation: isolate;
}
}

.category-badge .category-count {
  background: #2563eb;
  color: #fff;
  font-weight: 900;
  border-radius: 12px;
  padding: 2px 10px;
  margin-left: 0.7em;
  font-size: 0.95em;
  display: inline-block;
  min-width: 2em;
  text-align: center;
  box-shadow: 0 1px 4px #b3eefe55;
  transition: background 0.2s, color 0.2s;
  position: relative;
  z-index: 100;
  pointer-events: auto;
}

.category-badge::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 0;
  background: #3b82f6;
  border-radius: 2px;
  transition: height 0.2s ease;
}

.category-badge:hover,
.category-badge:focus,
.category-badge.active {
  background: linear-gradient(90deg, #2563eb 0%, #1746a0 100%);
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 2px 16px #2563eb33;
  outline: none;
  font-weight: 700;
}

.category-badge:hover::before,
.category-badge.active::before {
  height: 100%;
}

/* Ensure category count stays visible and matches active color */


/* Recently Viewed Section */
.recently-viewed {
  border-top: 1px solid #e3e6f0;
  padding-top: 20px;
  margin-top: auto;
}

.recently-viewed h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 12px;
  text-align: center;
}

.recent-apps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-app-item {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.recent-app-item:hover, .recent-app-item:focus {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  outline: none;
}

/* Enhanced Main content */
.main-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  user-select: text;
  position: relative;
}

/* Custom scrollbar for main content */
.main-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
  background-color: rgba(115, 128, 165, 0.2);
  border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(115, 128, 165, 0.3);
}

/* Enhanced Category Header Panel */
.category-header-panel {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  user-select: none;
  color: #2a3379;
  font-weight: 700;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e2e8f0;
}

.category-header-panel:hover,
.category-header-panel:focus-within {
  box-shadow: 0 12px 40px #63b3ff50;
  outline: none;
}

.header-content {
  flex-grow: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.category-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #226edc;
  margin-bottom: 8px;
  text-shadow: 0 0 8px #b5e8ff60;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
}

.category-desc {
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 500;
  color: #76a2ce;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
}

.results-info {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
}

.btn-clear {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-clear:hover, .btn-clear:focus {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  outline: none;
}

/* App grid */
.app-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}

/* App cards */
.app-card {
  background: rgba(250, 253, 255, 0.82) !important;
  backdrop-filter: saturate(155%) blur(10px);
  border-radius: 20px !important;
  border: 1.5px solid #e3e9f6 !important;
  box-shadow: 0 6px 26px 0 #51baff18, 0 1px 6px #deeafa85 inset;
  font-weight: 700 !important;
  color: #23266a !important;
  transition: box-shadow 0.3s, border-color 0.3s, background 0.3s !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 360px !important;
  max-height: none !important;
  overflow: hidden !important;
  width: 100%;
}

.app-card:hover, .app-card:focus-within {
  background: #f7fbff;
  border-color: #7cd1ff !important;
  box-shadow: 0 10px 32px #53a6ff29, 0 2px 10px #53a6ff33 inset;
  outline: none !important;
}

.card-header {
  background: linear-gradient(135deg, #e0eaff 30%, #b2d6fc 100%) !important;
  color: #264467 !important;
  padding: 14px 24px !important;
  border-radius: 20px 20px 0 0 !important;
  box-shadow: inset 0 -3px 14px #f2f8ff55 !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  user-select: none !important;
  min-height: 60px !important;
}

.card-header h4 {
  font-weight: 900 !important;
  font-size: 1.3rem !important;
  color: #28377d !important;
  margin: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex-grow: 1 !important;
}

.card-header img {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  filter: drop-shadow(0 0 8px #a1cafc) !important;
  object-fit: contain !important;
  flex-shrink: 0;
}

.details {
  padding: 8px !important;
  gap: 6px !important;
  display: flex !important;
  flex-direction: column !important;
  color: #42548e !important;
  user-select: text !important;
  flex-grow: 1 !important;
  overflow: hidden !important;
}

.details .description {
  max-height: none !important;
  min-height: auto !important;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  margin-bottom: 8px !important;
  color: #3365a6 !important;
  background: #eff7ff96;
  backdrop-filter: blur(4px);
  font-weight: 500;
  line-height: 1.4;
  border-radius: 8px;
  padding: 8px;
  word-wrap: break-word;
  hyphens: auto;
}

.data-row {
  margin-top: 0 !important;
  margin-bottom: 6px !important;
  color: #7a8bb8 !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  word-wrap: break-word;
}

/* Footer */
.card-footer {
  background: linear-gradient(135deg, #f1f6ff 0%, #e6f5fd 100%) !important;
  border-radius: 0 0 20px 20px !important;
  padding: 14px 16px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  flex-direction: row !important;
  align-items: center !important;
  align-content: center !important;
  justify-content: space-evenly !important;
  gap: 12px !important;
  box-shadow: 0px 2px 10px #e4f1ff33 inset;
  box-sizing: border-box;
}

.card-footer button, .card-footer a {
  flex: 1 1 auto;
  min-width: 100px;
  width: auto;
  background: linear-gradient(135deg, #5dbbff 40%, #aedde6 100%) !important;
  color: #222b38 !important;
  border-radius: 9999px !important;
  font-weight: 700 !important;
  font-size: 0.9rem !important;
  padding: 9px 12px !important;
  text-align: center !important;
  text-decoration: none !important;
  box-shadow: 0 2px 11px #e1f5ff99;
  transition: background 0.3s, box-shadow 0.3s !important;
  border: none !important;
  cursor: pointer !important;
  box-sizing: border-box;
  white-space: nowrap;
}

.card-footer button:hover, .card-footer a:hover,
.card-footer button:focus, .card-footer a:focus {
  background: linear-gradient(135deg, #369fff 34%, #e2f3fe 100%) !important;
  box-shadow: 0 0 16px #9fd8ff70 !important;
  color: #1361a7 !important;
  outline: none !important;
}

/* Modal Backdrop - translucent glass overlay */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(220, 235, 255, 0.68);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  z-index: 11000;
  backdrop-filter: blur(7px) saturate(125%);
  -webkit-backdrop-filter: blur(7px) saturate(125%);
  overflow-y: auto;
}

.modal-backdrop.hidden {
  display: none;
}

/* Modal Window */
.modal {
  background: linear-gradient(135deg, #fff, #e3f2fd 100%);
  border-radius: 26px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  box-shadow: 0 8px 34px #97dbfc70;
  color: #21243d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: text;
  margin: auto;
}

/* Modal Header */
.modal-header {
  background: linear-gradient(135deg, #e0f2ff, #cee9ff 60%, #f6fcff 100%);
  color: #264467;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 26px 26px 0 0;
  box-shadow: inset 0 -2px 8px #e7f5ff65;
  user-select: none;
  gap: 16px;
}

.modal-header h3 {
  margin: 0;
  font-weight: 900;
  font-size: 1.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.modal-close {
  background: transparent;
  border: none;
  font-weight: 900;
  font-size: 28px;
  color: #3b82f6;
  cursor: pointer;
  padding: 0;
  user-select: none;
  transition: color 0.3s;
  line-height: 1;
  flex-shrink: 0;
}

.modal-close:hover, .modal-close:focus {
  color: #216bee;
  outline: none;
}

/* Modal Content */
.modal-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px 34px;
  font-size: 1rem;
  line-height: 1.5;
  color: #293d59;
  background: transparent;
  user-select: text;
}

.modal-content .section {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-content .section:last-child {
  margin-bottom: 0;
}

.modal-content .label {
  flex-basis: 140px;
  flex-shrink: 0;
  font-weight: 700;
  color: #4494ea;
  white-space: nowrap;
  margin-right: 8px;
}

.modal-content .value {
  flex-grow: 1;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  min-width: 0;
}

.modal-content a {
  color: #319af6;
  font-weight: 700;
  transition: color 0.3s;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-content a:hover, .modal-content a:focus {
  color: #1687c9;
  outline: none;
  text-decoration: underline;
}

/* Reviews Section */
.modal-reviews {
  border-top: 1px solid #c9e5ff;
  padding-top: 14px;
  color: #6e8baa;
  user-select: text;
}

.modal-reviews h4 {
  font-weight: 900;
  font-size: 1.3rem;
  color: #319af6;
  margin-bottom: 8px;
}

.modal-reviews>div {
  margin-bottom: 14px;
  border-bottom: 1px solid #d5eafd;
  padding-bottom: 10px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-reviews>div:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.modal-reviews strong {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
  color: #222b38;
}

.modal-reviews span {
  font-style: italic;
  color: #5996c8;
  display: block;
  margin-bottom: 6px;
}

/* Modal Footer */
.modal-footer {
  background: linear-gradient(135deg, #ebf6ff, #cff0ff 100%);
  padding: 16px 30px;
  border-radius: 0 0 26px 26px;
  display: flex;
  justify-content: space-between;
  user-select: none;
  color: #293d59;
  gap: 16px;
}

.modal-footer .btn {
  min-width: 130px;
  padding: 10px 16px;
  font-weight: 900;
  font-size: 1rem;
  border-radius: 28px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: 0 4px 14px #deeeff90;
  transition: background 0.3s;
  color: #21558a;
  text-decoration: none;
  white-space: nowrap;
}

.modal-footer .btn-primary {
  background: linear-gradient(135deg, #41a7fa, #e3f7fd 100%);
  color: #fff;
}

.modal-footer .btn-primary:hover,
.modal-footer .btn-primary:focus {
  background: linear-gradient(135deg, #1476c7, #d6efff 100%);
  color: #fff;
  outline: none;
}

.modal-footer .btn-secondary {
  background: linear-gradient(135deg, #7cb8ff, #d7f3ff 100%);
  color: #21568a;
}

.modal-footer .btn-secondary:hover,
.modal-footer .btn-secondary:focus {
  background: linear-gradient(135deg, #46b2ff, #f2fafd 100%);
  color: #2162c6;
  outline: none;
}

/* === Enhanced Responsive Breakpoints === */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
  .navbar {
    padding: 16px 24px;
    gap: 16px;
  }

  .logo {
    font-size: 1.8rem;
    letter-spacing: 1.2px;
  }

  .nav-subheader {
    font-size: 1rem;
  }

  #search-input {
    width: 250px;
  }

  .sidebar {
    width: 280px;
    padding: 20px;
  }

  .main-content {
    padding: 0 24px 24px 24px;
  }

  .category-title {
    font-size: 2rem;
  }

  .category-desc {
    font-size: 1.1rem;
  }

  .filter-btn {
    font-size: 0.8rem;
    padding: 5px 12px;
  }
}

/* Tablets */
@media (max-width: 1024px) {
  .navbar {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .navbar-center {
    justify-self: center;
  }

  .nav-filters {
    gap: 6px;
  }

  .nav-stats {
    display: none;
  }

  .navbar-right {
    justify-self: end;
  }

  #search-input {
    width: 200px;
  }

  .logo {
    font-size: 1.6rem;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
  }

  .sidebar {
    width: 260px;
  }

  .category-title {
    font-size: 1.8rem;
  }

  .category-desc {
    font-size: 1rem;
  }

  .filter-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
  }
}

/* Small tablets and large phones */
@media (max-width: 840px) {
  .container {
    flex-direction: column;
    padding: 16px 16px;
    height: auto;
    min-height: calc(100vh - 56px);
  }

  .sidebar {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 16px #a2c7ff42;
    margin-bottom: 16px;
    padding: 16px;
    max-height: none;
    overflow-y: visible;
  }

  .sidebar-title {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }

  .category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
  }

  .category-badge {
    font-size: 0.85rem;
    padding: 8px 4px;
  }

  .main-content {
    border-radius: 16px;
    padding: 20px;
    overflow-y: visible;
    height: auto;
  }

  .category-header-panel {
    padding: 18px;
    margin-bottom: 24px;
    border-radius: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    align-self: stretch;
    justify-content: space-between;
  }

  .category-title {
    font-size: 1.6rem;
    white-space: normal;
    text-align: left;
  }

  .category-desc {
    font-size: 1rem;
    white-space: normal;
    text-align: left;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .navbar {
    padding: 12px 16px;
    grid-template-columns: auto auto;
    gap: 8px;
  }

  .navbar-left {
    gap: 12px;
  }

  .navbar-center {
    justify-self: end;
    grid-column: 2;
    grid-row: 1;
  }

  .navbar-right {
    justify-self: stretch;
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 8px;
    display: flex;
    gap: 8px;
  }

  .nav-filters {
    gap: 4px;
  }

  .filter-btn {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .navbar-left .btn-secondary {
    padding: 0.7rem 2rem;
    font-size: 1rem;
  }

  .logo {
    font-size: 1.4rem;
    letter-spacing: 1px;
  }

  .favicon {
    width: 36px;
    height: 36px;
  }

  #search-input {
    width: 100%;
    flex-grow: 1;
    padding: 8px 35px 8px 16px;
    font-size: 0.9rem;
  }

  .btn-accent {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .card-header {
    padding: 12px 16px !important;
  }

  .card-header h4 {
    font-size: 1.1rem !important;
  }

  .card-header img {
    width: 36px !important;
    height: 36px !important;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
  }

  .card-footer button, .card-footer a {
    width: 100% !important;
    flex: 1 1 auto;
    max-width: none !important;
    min-width: 0 !important;
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  .modal {
    max-height: 95vh;
    margin: 10px;
  }

  .modal-header {
    padding: 14px 20px;
    flex-wrap: wrap;
  }

  .modal-header h3 {
    font-size: 1.5rem;
    white-space: normal;
  }

  .modal-content {
    padding: 20px 24px;
  }

  .modal-content .label {
    flex-basis: 120px;
    font-size: 0.9rem;
  }

  .modal-footer {
    padding: 14px 20px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .modal-footer .btn {
    min-width: 110px;
    font-size: 0.9rem;
    padding: 9px 14px;
  }
}

/* Mobile phones */
@media (max-width: 640px) {
  .navbar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 16px;
    text-align: center;
  }

  .navbar-left {
    justify-content: center;
    order: 1;
  }

  .navbar-center {
    justify-self: center;
    order: 2;
    width: 100%;
  }

  .navbar-right {
    justify-self: center;
    order: 3;
    width: 100%;
  }

  .nav-filters {
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  .filter-btn {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .navbar-left .btn-secondary {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }

  .logo {
    font-size: 1.2rem;
    letter-spacing: 0.8px;
  }

  .favicon {
    width: 32px;
    height: 32px;
  }

  #search-input {
    width: 100%;
    max-width: 280px;
    padding: 8px 35px 8px 16px;
    font-size: 0.9rem;
  }

  .btn-accent {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }

  .container {
    padding: 12px 8px;
  }

  .sidebar {
    padding: 12px;
    border-radius: 12px;
  }

  .sidebar-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .category-badge {
    font-size: 0.8rem;
    padding: 6px 4px;
  }

  .recently-viewed {
    padding-top: 12px;
    margin-top: 12px;
  }

  .recently-viewed h3 {
    font-size: 0.9rem;
  }

  .main-content {
    padding: 16px 12px;
    border-radius: 12px;
  }

  .category-header-panel {
    padding: 16px 12px;
    margin-bottom: 20px;
    border-radius: 12px;
  }

  .category-title {
    font-size: 1.4rem;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
  }

  .category-desc {
    font-size: 0.95rem;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
  }

  .app-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .app-card {
    min-height: 320px !important;
  }

  .card-header {
    padding: 10px 12px !important;
    min-height: 50px !important;
  }

  .card-header h4 {
    font-size: 1rem !important;
    white-space: normal !important;
    word-wrap: break-word;
  }

  .card-header img {
    width: 32px !important;
    height: 32px !important;
  }

  .details {
    padding: 8px 12px !important;
  }

  .details .description {
    font-size: 0.9rem;
    padding: 6px 8px;
  }

  .data-row {
    font-size: 0.85rem !important;
  }

  .card-footer {
    padding: 10px 12px;
  }

  .card-footer button, .card-footer a {
    font-size: 0.85rem;
    padding: 8px 10px;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  .navbar {
    padding: 10px 12px;
  }

  .nav-filters {
    gap: 3px;
  }

  .filter-btn {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  .navbar-left .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .logo {
    font-size: 1rem;
    letter-spacing: 0.5px;
  }

  .favicon {
    width: 28px;
    height: 28px;
  }

  #search-input {
    padding: 6px 30px 6px 12px;
    font-size: 0.85rem;
    max-width: 180px;
  }

  .btn-accent {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  .container {
    padding: 8px 4px;
  }

  .sidebar {
    padding: 8px;
    border-radius: 8px;
  }

  .sidebar-title {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 6px;
  }

  .category-badge {
    font-size: 0.75rem;
    padding: 5px 2px;
  }

  .main-content {
    padding: 12px 8px;
    border-radius: 8px;
  }

  .category-header-panel {
    padding: 12px 8px;
    margin-bottom: 16px;
    border-radius: 8px;
  }

  .category-title {
    font-size: 1.2rem;
  }

  .category-desc {
    font-size: 0.9rem;
  }

  .app-grid {
    gap: 10px;
  }

  .app-card {
    min-height: 280px !important;
    border-radius: 12px !important;
  }

  .card-header {
    padding: 8px 10px !important;
    min-height: 45px !important;
    border-radius: 12px 12px 0 0 !important;
  }

  .card-header h4 {
    font-size: 0.9rem !important;
  }

  .card-header img {
    width: 28px !important;
    height: 28px !important;
  }

  .details {
    padding: 6px 8px !important;
  }

  .details .description {
    font-size: 0.85rem;
    padding: 5px 6px;
  }

  .data-row {
    font-size: 0.8rem !important;
    margin-bottom: 4px !important;
  }

  .card-footer {
    padding: 8px 10px;
    border-radius: 0 0 12px 12px !important;
  }

  .card-footer button, .card-footer a {
    font-size: 0.8rem;
    padding: 7px 8px;
  }

  /* Modal adjustments for small screens */
  .modal-backdrop {
    padding: 10px;
    align-items: center;
  }

  .modal {
    max-height: 95vh;
    border-radius: 16px;
  }

  .modal-header {
    padding: 12px 16px;
    border-radius: 16px 16px 0 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .modal-header h3 {
    font-size: 1.2rem;
    white-space: normal;
    word-wrap: break-word;
    text-align: left;
    width: 100%;
  }

  .modal-close {
    font-size: 24px;
    align-self: flex-end;
    position: absolute;
    top: 12px;
    right: 16px;
  }

  .modal-content {
    padding: 16px 20px;
    font-size: 0.9rem;
  }

  .modal-content .section {
    flex-direction: column;
    margin-bottom: 12px;
  }

  .modal-content .label {
    flex-basis: auto;
    margin-bottom: 4px;
    font-size: 0.85rem;
  }

  .modal-content .value {
    font-size: 0.85rem;
  }

  .modal-footer {
    padding: 12px 16px;
    border-radius: 0 0 16px 16px;
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
    min-width: 0;
    font-size: 0.85rem;
    padding: 8px 12px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .navbar-landing, .navbar-app {
    padding: 8px 6px;
  }

  .filter-btn {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .btn-home {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .logo {
    font-size: 0.9rem;
    letter-spacing: 0.3px;
  }

  .favicon {
    width: 24px;
    height: 24px;
  }

  #search-input {
    padding: 5px 25px 5px 10px;
    font-size: 0.8rem;
    max-width: 140px;
  }

  .btn-accent {
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
  }

  .container {
    padding: 6px 2px;
  }

  .sidebar {
    padding: 6px;
  }

  .sidebar-title {
    font-size: 1rem;
  }

  .category-list {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 4px;
  }

  .category-badge {
    font-size: 0.7rem;
    padding: 4px 2px;
  }

  .main-content {
    padding: 10px 6px;
  }

  .category-header-panel {
    padding: 10px 6px;
    margin-bottom: 12px;
  }

  .category-title {
    font-size: 1rem;
  }

  .category-desc {
    font-size: 0.8rem;
  }

  .app-grid {
    gap: 8px;
  }

  .app-card {
    min-height: 250px !important;
    border-radius: 8px !important;
  }

  .card-header {
    padding: 6px 8px !important;
    min-height: 40px !important;
    border-radius: 8px 8px 0 0 !important;
  }

  .card-header h4 {
    font-size: 0.8rem !important;
  }

  .card-header img {
    width: 24px !important;
    height: 24px !important;
  }

  .details {
    padding: 5px 6px !important;
  }

  .details .description {
    font-size: 0.8rem;
    padding: 4px 5px;
  }

  .data-row {
    font-size: 0.75rem !important;
    margin-bottom: 3px !important;
  }

  .card-footer {
    padding: 6px 8px;
    border-radius: 0 0 8px 8px !important;
  }

  .card-footer button, .card-footer a {
    font-size: 0.75rem;
    padding: 6px 6px;
  }

  .modal {
    border-radius: 12px;
    margin: 5px;
  }

  .modal-header {
    padding: 10px 12px;
    border-radius: 12px 12px 0 0;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-close {
    font-size: 20px;
    top: 10px;
    right: 12px;
  }

  .modal-content {
    padding: 12px 16px;
    font-size: 0.8rem;
  }

  .modal-content .label {
    font-size: 0.8rem;
  }

  .modal-content .value {
    font-size: 0.8rem;
  }

  .modal-footer {
    padding: 10px 12px;
    border-radius: 0 0 12px 12px;
  }

  .modal-footer .btn {
    font-size: 0.8rem;
    padding: 7px 10px;
  }
}