:root {
  /* Neutral */
  --neutral-900: hsl(227, 75%, 14%);
  --neutral-800: hsl(226, 25%, 17%);
  --neutral-700: hsl(225, 23%, 24%);
  --neutral-600: hsl(226, 11%, 37%);
  --neutral-300: hsl(0, 0%, 78%);
  --neutral-200: hsl(217, 61%, 90%);
  --neutral-100: hsl(0, 0%, 93%);
  --neutral-0: hsl(200, 60%, 99%);

  /* Red */
  --red-400: hsl(3, 86%, 64%);
  --red-500: hsl(3, 71%, 56%);
  --red-700: hsl(3, 77%, 44%);

  /* Gradient */
  --light-gradient: linear-gradient(180deg, #EBF2FC 0%, #EEF8F9 100%);
  --dark-gradient: linear-gradient(180deg, #040918 0%, #091540 100%);

  /* Theme mappings (Light Mode Default) */
  --bg-body: var(--light-gradient);
  --bg-card: #ffffff;
  --bg-topbar: #ffffff;
  --text-primary: var(--neutral-900);
  --text-secondary: var(--neutral-600);
  --border-color: var(--neutral-200);
  
  --filter-bg: #ffffff;
  --filter-text: var(--neutral-900);
  --filter-border: var(--neutral-200);
  
  --remove-bg: #ffffff;
  --remove-text: var(--neutral-900);
  --remove-border: var(--neutral-200);
  
  --toggle-bg: var(--neutral-300);
  
  --topbar-shadow: 0 4px 20px rgba(0,0,0,0.02);
  --card-shadow: 0 10px 30px rgba(0,0,0,0.02);
}

[data-theme="dark"] {
  --bg-body: var(--dark-gradient);
  --bg-card: var(--neutral-800);
  --bg-topbar: var(--neutral-800);
  --text-primary: var(--neutral-0);
  --text-secondary: var(--neutral-300);
  --border-color: var(--neutral-700);
  
  --filter-bg: var(--neutral-800);
  --filter-text: var(--neutral-0);
  --filter-border: var(--neutral-700);
  
  --remove-bg: transparent;
  --remove-text: var(--neutral-0);
  --remove-border: var(--neutral-600);
  
  --toggle-bg: var(--neutral-600);
  
  --topbar-shadow: 0 4px 20px rgba(0,0,0,0.2);
  --card-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 1110px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

/* Top Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-topbar);
  border-radius: 12px;
  margin-top: 2rem;
  box-shadow: var(--topbar-shadow);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.logo {
  display: flex;
  align-items: center;
}

.logo svg {
  height: 28px;
  width: auto;
}

.logo-text-path {
  fill: var(--text-primary);
  transition: fill 0.3s ease;
}

.theme-toggle {
  background: var(--filter-bg);
  border: 1px solid var(--filter-border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle svg path {
  fill: var(--text-primary);
  transition: fill 0.3s ease;
}

/* Main Content */
.main-content {
  margin-top: 4rem;
  margin-bottom: 4rem;
}

.header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  background: var(--filter-bg);
  color: var(--filter-text);
  border: 1px solid var(--filter-border);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--text-primary);
}

.filter-btn.active {
  background: var(--red-500);
  color: white;
  border-color: var(--red-500);
}

/* Grid Layout */
.extensions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Card Styling */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: var(--text-primary);
}

.card-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.card-icon img {
  width: 60px;
  height: 60px;
  border-radius: 12px;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.remove-btn {
  background: var(--remove-bg);
  border: 1px solid var(--remove-border);
  color: var(--remove-text);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-btn:hover {
  background: var(--red-400);
  color: white;
  border-color: var(--red-400);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--toggle-bg);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--red-500);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

input:focus + .slider {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Footer */
.attribution {
  margin-top: auto;
  padding: 2rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.attribution a {
  color: var(--red-500);
  text-decoration: none;
  font-weight: 700;
}

.attribution a:hover {
  color: var(--red-700);
}

/* Responsive */
@media (max-width: 768px) {
  .header-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  
  .filters {
    width: 100%;
    justify-content: space-between;
  }
  
  .filter-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.5rem;
  }

  .container {
    padding: 0 1rem;
  }
}
