:root {
  --bg: #fff;
  --surface: #fff;
  --border: #eee;
  --text: #000;
  --primary: #ff0066;
  --radius: 5px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --surface: #000;
    --border: #242424;
    --text: #eee;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Outfit", sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Preloader */
#preloader {
  position: fixed;
  inset: 0;
  background: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  z-index: 9999;
}

#preloader.show {
  display: block;
}

.spinner {
  display: none;
}

/* Header */
header {
  background: var(--bg);
  padding: 0.7rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

.header-content {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.pro-btn {
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 0.8rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
}

/* Sticky Action Bar */
.action-bar {
  background: var(--surface);
  padding: 0.5rem;
  position: sticky;
  top: 50px; /* Accounts for header height roughly */
  z-index: 1;
}

.action-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  width: 100%;
}

select {
  padding: 0.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--border);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  outline: none;
  min-width: 200px;
}

.search-container {
  position: relative;
  flex: 1;
  max-width: 100%;
}

input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  padding-left: 3rem;
  background: var(--border);
  border: none;
  color: var(--text);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text);
  width: 20px;
  height: 20px;
}

input[type="text"]::placeholder {
  color: var(--border);
}

/* Suggestions */
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 0.5rem;
  display: none;
}

.suggestion-item {
  padding: 1rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

#iconCount {
  color: var(--text) !important;
}

/* Main Content */
main {
  max-width: 100%;
  margin: 0.5rem auto;
  padding: 0 1rem;
}

.stats-bar {
  margin-bottom: 2rem;
  color: var(--text);
  font-size: 1.1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}

.icon-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  cursor: pointer;
}

.icon-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

@media (prefers-color-scheme: dark) {
  .icon-img,
  .suggestion-item img,
  #modalTitle img {
    filter: invert(1);
  }
}

.icon-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  word-break: break-all;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  justify-content: center;
  z-index: 2;
  padding: 0;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

#modalTitle {
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text);
}

.modal-body {
  padding: 0.5rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.close-btn {
  background: var(--bg);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: normal;
  cursor: pointer;
  border: none;
  color: var(--text);
}

.code-block {
  background: var(--border);
  border-radius: var(--radius);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding-bottom: 0.5rem;
}

.code-title {
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  font-size: 0.85rem;
}

.copy-btn {
  background: var(--text);
  color: var(--bg);
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}

pre {
  padding: 0.5rem;
  color: var(--text);
  overflow-x: auto;
  font-size: 0.95rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 1rem;
  background: var(--text);
  color: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 0.75rem;
  z-index: 2;
}

.toast.show {
  display: flex;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius);
}

/* Footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 4rem;
}

.footer-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  color: var(--text);
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  select {
    width: 100%;
  }
}
