/* =============================================
   SchulWebSearch – style.css
   Modern, vibrant design for students
   ============================================= */

/* ---------- CSS VARIABLES ---------- */
:root {
  --primary: #6C63FF;
  --primary-dark: #4c45cc;
  --accent-1: #FF6B6B;
  --accent-2: #48CAE4;
  --accent-3: #06D6A0;
  --accent-4: #9B5DE5;
  --accent-5: #F9C74F;
  --accent-6: #F77F00;
  --accent-7: #EF476F;

  --bg: #0d0d1a;
  --bg-card: #16162a;
  --bg-card-hover: #1e1e38;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);

  --text: #f0f0ff;
  --text-muted: #8888aa;
  --text-dim: #555577;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 40px rgba(108, 99, 255, 0.35);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.5);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.hidden {
  display: none !important;
}

/* ---------- HERO SECTION ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0d0d1a 0%, #1a1040 40%, #0f2040 100%);
  padding: 80px 0 100px;
  text-align: center;
}

/* Animated background shapes */
.hero-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: floatShape 8s ease-in-out infinite;
}

.shape-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #6C63FF, transparent);
  top: -200px;
  left: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #EF476F, transparent);
  top: -50px;
  right: -80px;
  animation-delay: 2s;
}

.shape-3 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #48CAE4, transparent);
  bottom: -200px;
  left: 50%;
  transform: translateX(-50%);
  animation-name: floatShapeCentered;
  animation-delay: 4s;
}

@keyframes floatShape {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

@keyframes floatShapeCentered {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50% { transform: translateX(-50%) translateY(-30px) scale(1.05); }
}

.hero-content {
  position: relative;
  z-index: 1;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(108, 99, 255, 0.2);
  border: 1px solid rgba(108, 99, 255, 0.4);
  color: #a99fff;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  margin-bottom: 28px;
  animation: fadeInDown 0.6s ease both;
  backdrop-filter: blur(8px);
}

.hero-title {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 20px;
  animation: fadeInDown 0.6s ease 0.1s both;
}

.gradient-text {
  background: linear-gradient(135deg, #6C63FF 0%, #EF476F 50%, #48CAE4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 40px;
  animation: fadeInDown 0.6s ease 0.2s both;
  line-height: 1.7;
}

/* Search Bar */
.search-wrapper {
  position: relative;
  max-width: 620px;
  margin: 0 auto 40px;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  transition: transform var(--transition);
}

.search-icon:hover {
  transform: translateY(-50%) scale(1.15);
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  padding: 18px 56px 18px 56px;
  outline: none;
  transition: var(--transition);
  backdrop-filter: blur(12px);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--primary);
  background: rgba(108, 99, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.2);
}

.search-clear {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0;
  pointer-events: none;
}

.search-clear.visible {
  opacity: 1;
  pointer-events: all;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

/* Hero Stats */
.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 14px 32px;
  animation: fadeInUp 0.6s ease 0.4s both;
  backdrop-filter: blur(8px);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: var(--transition);
}

a.stat-item:hover .stat-number {
  color: var(--primary);
}

a.stat-item:hover .stat-label {
  color: var(--text);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* ---------- CATEGORY NAV ---------- */
.category-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

/* Remove padding from inner container so the scroll area can own it */
.category-nav .container {
  padding: 0;
}

.category-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  /* Horizontal padding here keeps first/last button from being cut off */
  padding: 0 24px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Spacer that forces Chromium to honour the right-side padding on scroll */
.category-scroll::after {
  content: '';
  flex-shrink: 0;
  width: 24px;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.cat-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.cat-btn.active {
  background: var(--cat-color, var(--primary));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--cat-color, var(--primary)) 50%, transparent);
}

.cat-btn[data-category="alle"].active {
  background: linear-gradient(135deg, var(--primary), #EF476F);
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
}

.cat-emoji {
  font-size: 16px;
  line-height: 1;
}

/* ---------- MAIN & RESULTS HEADER ---------- */
.main {
  padding: 40px 0 80px;
  min-height: 60vh;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 14px;
}

.results-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.results-info #resultCount {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sort-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 14px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238888aa' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.sort-select option {
  background: #1e1e38;
  color: var(--text);
}

.sort-select:hover, .sort-select:focus {
  border-color: var(--primary);
  background-color: rgba(108, 99, 255, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236C63FF' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- CARD GRID ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ---------- WEBSITE CARD ---------- */
.website-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
              border-color var(--transition), background var(--transition);
  animation: cardFadeIn 0.5s ease both;
  text-decoration: none;
  color: inherit;
}

.website-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-color, var(--primary));
  opacity: 0;
  transition: opacity var(--transition);
}

.website-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.website-card:hover::before {
  opacity: 1;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 0;
}

.card-favicon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}

.card-favicon-emoji {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--card-color, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.card-category-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-top: 4px;
  background: color-mix(in srgb, var(--card-color, var(--primary)) 20%, transparent);
  color: var(--card-color, var(--primary));
  border: 1px solid color-mix(in srgb, var(--card-color, var(--primary)) 40%, transparent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Card Body */
.card-body {
  padding: 14px 20px;
  flex: 1;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tags */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.card-tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}

.website-card:hover .card-tag {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Rating */
.card-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.stars {
  display: flex;
  gap: 2px;
}

.star {
  font-size: 13px;
  line-height: 1;
}

.star.full { color: #F9C74F; }
.star.half { color: #F9C74F; opacity: 0.6; }
.star.empty { color: #333355; }

.rating-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 10px;
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.like-btn:hover {
  border-color: #EF476F;
  color: #EF476F;
  background: rgba(239, 71, 111, 0.08);
}

.like-btn.liked {
  border-color: #EF476F;
  color: #EF476F;
  background: rgba(239, 71, 111, 0.12);
}

.like-btn.liked .like-icon {
  animation: heartPop 0.3s ease;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.visit-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: relative;
  background: var(--card-color, var(--primary));
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.visit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--card-color, var(--primary)) 50%, transparent);
  opacity: 0.9;
}

.visit-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  line-height: 1;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 1rem;
}

.btn-reset {
  background: var(--primary);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 28px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-reset:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
}

/* ---------- FOOTER ---------- */
.footer {
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 10px;
  line-height: 1.6;
}

.footer-categories strong {
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 14px;
}

.footer-categories ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer-categories li {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- ANIMATIONS ---------- */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger card animations */
.website-card:nth-child(1) { animation-delay: 0.05s; }
.website-card:nth-child(2) { animation-delay: 0.10s; }
.website-card:nth-child(3) { animation-delay: 0.15s; }
.website-card:nth-child(4) { animation-delay: 0.20s; }
.website-card:nth-child(5) { animation-delay: 0.25s; }
.website-card:nth-child(6) { animation-delay: 0.30s; }
.website-card:nth-child(7) { animation-delay: 0.35s; }
.website-card:nth-child(8) { animation-delay: 0.40s; }
.website-card:nth-child(9) { animation-delay: 0.45s; }
.website-card:nth-child(10) { animation-delay: 0.50s; }

/* Pulse glow on hover for primary buttons */
.visit-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition);
  background: rgba(255, 255, 255, 0.1);
}

.visit-btn:active::after {
  opacity: 1;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(108, 99, 255, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 99, 255, 0.6);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  /* Shrink the nav's visible area so category buttons never slide under the fixed action buttons */
  .category-nav {
    padding-right: 150px;
  }

  .category-scroll {
    padding: 0 24px 4px;
  }

  .hero {
    padding: 60px 0 80px;
  }

  .hero-title br,
  .hero-subtitle br {
    display: none;
  }

  .hero-stats {
    gap: 16px;
    padding: 12px 20px;
    max-width: 100%;
  }

  .stat-number {
    font-size: 1.6rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .search-input {
    font-size: 0.95rem;
    padding: 15px 50px 15px 50px;
  }

  .hero-stats {
    gap: 12px;
    padding: 12px 16px;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .like-btn,
  .visit-btn {
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 400px) {
  .hero-stats {
    gap: 8px;
    padding: 10px 12px;
  }

  .stat-number {
    font-size: 1.3rem;
  }
}

/* =============================================
   NEW FEATURES – added styles
   ============================================= */

/* ---------- LIGHT MODE ---------- */
body.light-mode {
  --bg: #f0f2f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5ff;
  --border: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(108, 99, 255, 0.3);
  --text: #1a1a2e;
  --text-muted: #55557a;
  --text-dim: #9999bb;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 40px rgba(108, 99, 255, 0.2);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.08);
}

body.light-mode .hero {
  background: linear-gradient(135deg, #e8e4ff 0%, #d4e8ff 100%);
}

body.light-mode .category-nav {
  background: rgba(240, 242, 248, 0.95);
  border-bottom-color: rgba(0,0,0,0.08);
}

body.light-mode .search-input {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text);
}

body.light-mode .search-input:focus {
  background: #fff;
}

body.light-mode .hero-stats {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .sort-select {
  background-color: #fff;
  color: var(--text);
}

body.light-mode .sort-select option {
  background: #fff;
  color: var(--text);
}

body.light-mode .footer {
  background: rgba(0, 0, 0, 0.03);
}

body.light-mode .star.empty { color: #ccccdd; }

/* ---------- TOP ACTION BUTTONS (fixed top-right) ---------- */
.top-actions {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-btn {
  background: rgba(108, 99, 255, 0.15);
  border: 1.5px solid rgba(108, 99, 255, 0.3);
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  line-height: 1;
  white-space: nowrap;
}

.top-btn:hover {
  background: rgba(108, 99, 255, 0.3);
  transform: scale(1.08);
}

.settings-btn {
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.lang-toggle {
  height: 40px;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.profile-btn {
  height: 40px;
  padding: 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ---------- SETTINGS PANEL ---------- */
.settings-panel {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 1050;
  background: rgba(18, 18, 36, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid rgba(108, 99, 255, 0.25);
  border-radius: 18px;
  min-width: 256px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: settingsPanelIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) both;
}

body.light-mode .settings-panel {
  background: rgba(240, 242, 250, 0.98);
  border-color: rgba(108, 99, 255, 0.18);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
}

@keyframes settingsPanelIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
}

.settings-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.settings-panel-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

body.light-mode .settings-panel-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  transition: background var(--transition);
}

.settings-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

body.light-mode .settings-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-icon {
  font-size: 18px;
  line-height: 1;
  width: 24px;
  text-align: center;
}

.settings-item-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- RANDOM WEBSITE CARD POPUP ---------- */
#randomModal {
  z-index: 2500;
}

.random-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  max-width: 400px;
  width: 100%;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: randomCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

body.light-mode .random-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

@keyframes randomCardIn {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

.random-card-header {
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.random-card-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}

.random-card-logo-emoji {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.random-card-title-group {
  flex: 1;
  min-width: 0;
}

.random-card-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.random-card-category {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 5px;
}

.random-card-body {
  padding: 16px 24px 12px;
}

.random-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.random-card-footer {
  display: flex;
  gap: 10px;
  padding: 4px 24px 24px;
}

.random-card-open {
  flex: 1;
  background: linear-gradient(135deg, var(--primary), #9B5DE5);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.random-card-open:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.random-card-next {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
  transition: var(--transition);
}

.random-card-next:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(108, 99, 255, 0.5);
  transform: translateY(-1px);
}

body.light-mode .random-card-next {
  background: rgba(0, 0, 0, 0.04);
}

body.light-mode .random-card-next:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* ---------- XP / GAMIFICATION BAR ---------- */
.xp-bar-wrapper {
  margin-top: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInUp 0.6s ease 0.5s both;
}

.xp-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.xp-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.xp-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

body.light-mode .xp-track {
  background: rgba(0, 0, 0, 0.1);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #EF476F);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- SECTION TITLES (Trending / Recs) ---------- */
.section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}

.trending-section,
.rec-section {
  margin-bottom: 32px;
}

/* ---------- TRENDING / REC ROW (horizontal scroll) ---------- */
.trending-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-top: 6px;    /* space so the upward hover animation is not clipped */
  padding-bottom: 8px;
  scrollbar-width: none;
}

.trending-row::-webkit-scrollbar { display: none; }

.mini-card {
  flex-shrink: 0;
  width: 140px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  position: relative;
}

.mini-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.mini-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.mini-card:hover::before { opacity: 1; }

.mini-card-icon {
  font-size: 28px;
  line-height: 1;
}

.mini-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-card-likes {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---------- DIFFICULTY FILTER ROW ---------- */
.diff-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.diff-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

body.light-mode .diff-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}

.diff-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

body.light-mode .diff-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.diff-btn.active {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

/* ---------- CARD: FAV BUTTON ---------- */
.fav-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: transform var(--transition);
  flex-shrink: 0;
  color: var(--text-muted);
}

.fav-btn:hover {
  transform: scale(1.25);
}

.fav-btn.faved {
  animation: starPop 0.3s ease;
}

@keyframes starPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* ---------- CARD: DIFFICULTY BADGE + LEARN TIME ---------- */
.card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.diff-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.diff-badge.diff-easy   { background: rgba(6, 214, 160, 0.15); color: #06D6A0; border: 1px solid rgba(6, 214, 160, 0.3); }
.diff-badge.diff-medium { background: rgba(249, 199, 79, 0.15); color: #F9C74F; border: 1px solid rgba(249, 199, 79, 0.3); }
.diff-badge.diff-hard   { background: rgba(239, 71, 111, 0.15); color: #EF476F; border: 1px solid rgba(239, 71, 111, 0.3); }

.learn-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------- SKELETON LOADER ---------- */
.skeleton-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-height: 240px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  animation: shimmer 1.4s ease infinite;
  background-size: 200% 100%;
}

body.light-mode .skeleton-card::after {
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.05) 50%, transparent 100%);
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ---------- SUGGEST FAB ---------- */
.suggest-fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 900;
  background: linear-gradient(135deg, var(--primary), #EF476F);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.5);
  transition: transform var(--transition), box-shadow var(--transition);
}

.suggest-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(108, 99, 255, 0.6);
}

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

body.light-mode .modal-close { background: rgba(0,0,0,0.06); }

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

body.light-mode .modal-close:hover { background: rgba(0,0,0,0.12); }

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
  resize: vertical;
  color-scheme: dark;
}

body.light-mode .form-group input,
body.light-mode .form-group select,
body.light-mode .form-group textarea {
  background: #fff;
  color-scheme: light;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.btn-submit-modal {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #EF476F);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
}

.btn-submit-modal:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ---------- TOAST ---------- */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e1e38;
  border: 1.5px solid rgba(108, 99, 255, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  max-width: 280px;
}

body.light-mode .toast {
  background: #fff;
  border-color: rgba(108, 99, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  color: var(--text);
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- CARD HEADER: align fav button ---------- */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 0;
}

/* =============================================
   ADDITIONAL FEATURES
   ============================================= */

/* ---------- RANDOM BUTTON ---------- */
.random-btn-wrapper {
  margin-top: 20px;
  animation: fadeInUp 0.6s ease 0.6s both;
}

.random-btn {
  background: rgba(108, 99, 255, 0.15);
  border: 1.5px solid rgba(108, 99, 255, 0.4);
  border-radius: var(--radius-pill);
  color: #a99fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 24px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
  backdrop-filter: blur(8px);
}

.random-btn:hover {
  background: rgba(108, 99, 255, 0.28);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
}

.random-btn:active {
  transform: scale(0.97);
}

body.light-mode .random-btn {
  background: rgba(108, 99, 255, 0.1);
  border-color: rgba(108, 99, 255, 0.3);
  color: var(--primary);
}

body.light-mode .random-btn:hover {
  background: rgba(108, 99, 255, 0.2);
  color: var(--primary-dark);
}

/* ---------- HINT BADGES ON CARDS ---------- */
.hint-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.hint-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  line-height: 1.4;
}

.hint-badge.hint-beginner {
  background: rgba(6, 214, 160, 0.12);
  border: 1px solid rgba(6, 214, 160, 0.3);
  color: #06D6A0;
}

.hint-badge.hint-english {
  background: rgba(72, 202, 228, 0.12);
  border: 1px solid rgba(72, 202, 228, 0.3);
  color: #48CAE4;
}

.hint-badge.hint-visual {
  background: rgba(239, 71, 111, 0.12);
  border: 1px solid rgba(239, 71, 111, 0.3);
  color: #EF476F;
}

.hint-badge.hint-video {
  background: rgba(249, 199, 79, 0.12);
  border: 1px solid rgba(249, 199, 79, 0.3);
  color: #F9C74F;
}

.hint-badge.hint-interactive {
  background: rgba(155, 93, 229, 0.12);
  border: 1px solid rgba(155, 93, 229, 0.3);
  color: #9B5DE5;
}

/* ---------- RATE BUTTON ---------- */
.rate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.rate-btn:hover {
  border-color: #F9C74F;
  color: #F9C74F;
  background: rgba(249, 199, 79, 0.08);
}

.rate-btn.rated {
  border-color: #F9C74F;
  color: #F9C74F;
  background: rgba(249, 199, 79, 0.1);
}

/* ---------- INTERACTIVE STAR RATING INPUT ---------- */
.star-rating-input {
  display: flex;
  gap: 6px;
  font-size: 36px;
  margin: 10px 0 4px;
  cursor: pointer;
}

.star-rate {
  color: rgba(255, 255, 255, 0.15);
  transition: color 0.15s ease, transform 0.15s ease;
  line-height: 1;
  user-select: none;
}

body.light-mode .star-rate {
  color: rgba(0, 0, 0, 0.15);
}

.star-rate:hover,
.star-rate.active {
  color: #F9C74F;
  transform: scale(1.15);
}

/* ---------- RECENTLY VIEWED SECTION ---------- */
.recent-section {
  margin-bottom: 32px;
}

/* ---------- PROFILE MODAL EXTRAS ---------- */
.profile-greeting {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(108, 99, 255, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(108, 99, 255, 0.2);
}

.btn-danger {
  width: 100%;
  background: rgba(239, 71, 111, 0.08);
  border: 1.5px solid rgba(239, 71, 111, 0.3);
  border-radius: var(--radius-pill);
  color: #EF476F;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
  margin-top: 10px;
  transition: var(--transition);
}

.btn-danger:hover {
  background: rgba(239, 71, 111, 0.18);
}

/* ---------- USER RATING DISPLAY ON CARD ---------- */
.user-rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.user-rating-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.user-rating-stars {
  color: #F9C74F;
  font-size: 12px;
}

/* ---------- MOBILE UX IMPROVEMENTS ---------- */
@media (max-width: 600px) {
  .top-actions {
    gap: 6px;
  }

  .settings-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .lang-toggle,
  .profile-btn {
    height: 36px;
    padding: 0 10px;
    font-size: 0.75rem;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .random-btn {
    font-size: 0.875rem;
  }

  .settings-panel {
    right: 8px;
    min-width: 230px;
  }

  .diff-btn {
    padding: 9px 14px;
    font-size: 0.82rem;
    min-height: 40px;
  }

  .cat-btn {
    padding: 10px 18px;
    min-height: 40px;
  }

  .like-btn,
  .visit-btn,
  .rate-btn {
    min-height: 40px;
  }

  .random-card-footer {
    flex-direction: column;
  }

  .random-card-open,
  .random-card-next {
    width: 100%;
    justify-content: center;
  }
}
