:root {
  --bg: #060608;
  --surface: rgba(12, 12, 16, 0.97);
  --surface-hover: rgba(20, 20, 28, 0.97);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text-primary: #f0f0f4;
  --text-secondary: #8b8b9e;
  --text-muted: #52526a;
  --green: #22c55e;
  --orange: #f97316;
  --blue: #3b82f6;
  --purple: #a855f7;
  --red: #ef4444;
  --yellow: #eab308;
  --dot-red: #ff5f57;
  --dot-yellow: #ffbd2e;
  --dot-green: #28c840;

  --bg-color: var(--bg);
  --terminal-bg: var(--surface);
  --terminal-header-bg: rgba(20, 20, 28, 0.97);
  --text-desc-pc: var(--text-muted);
  --accent-green: var(--green);
  --accent-orange: var(--orange);
  --accent-blue: var(--blue);
  --accent-red: var(--red);
  --window-border: var(--border);
  --dropdown-bg: rgba(20, 20, 28, 0.98);
  --dropdown-hover: var(--surface-hover);

  --font-mono: "Space Mono", monospace;
  --font-sans: "Inter", -apple-system, sans-serif;

  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-duration: 0.3s;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.crt-overlay {
  display: none;
}

/* Háttér — link oldallal megegyező */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 20%, transparent 75%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 55% 45% at 15% 20%,
      rgba(59, 130, 246, 0.12),
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 40% at 85% 75%,
      rgba(34, 197, 94, 0.07),
      transparent 70%
    );
}

/* ==========================================================================
   RESET ÉS ALAP STÍLUSOK (FADE-IN AZ OLDALRA)
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  animation: fadeInPage 0.8s var(--transition-smooth) forwards;
}

.site-home {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.site-home:hover .site-home__sub {
  color: var(--text-primary);
}

.site-home:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 8px;
}

.site-home__logo {
  flex-shrink: 0;
  border-radius: 8px;
}

.site-home__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-home__name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.site-home__sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

@keyframes fadeInPage {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.sys-title,
.brand-title,
.terminal-title,
.status-item,
.prompt-symbol {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hidden {
  display: none !important;
}

/* HEADER */
.sys-header {
  padding: 2rem 1rem;
  border-bottom: 1px solid var(--window-border);
  position: relative;
  z-index: 10;
}
.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 1rem;
}
.brand-title {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--text-secondary);
}
.sys-nav {
  display: flex;
  gap: 1.5rem;
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  font-family: var(--font-mono);
}
.nav-item {
  color: var(--text-secondary);
  transition: color var(--transition-duration) var(--transition-smooth);
  cursor: pointer;
}
.nav-item.active,
.nav-item:hover {
  color: var(--accent-blue);
}

/* MAIN & CONTROLS */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 10;
}
.controls-section {
  background-color: var(--terminal-bg);
  border: 1px solid var(--window-border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.terminal-bar {
  background-color: var(--terminal-header-bg);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--window-border);
  border-radius: 8px 8px 0 0;
}
.window-controls {
  display: flex;
  gap: 0.5rem;
  margin-right: 1.5rem;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-close {
  background-color: var(--dot-red);
}
.dot-min {
  background-color: var(--dot-yellow);
}
.dot-max {
  background-color: var(--dot-green);
}
.terminal-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0 auto;
  transform: translateX(-24px);
}

.controls-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.control-row {
  display: flex;
  gap: 1rem;
  width: 100%;
  flex-wrap: wrap;
}
.filters-row {
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--window-border);
}

.input-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  width: 100%;
}
.prompt-symbol {
  color: var(--accent-green);
  font-weight: 700;
}
.sys-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  outline: none;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-duration) var(--transition-smooth);
}
.sys-input::placeholder {
  color: var(--text-secondary);
}
.sys-input:focus {
  border-bottom: 1px solid var(--accent-blue);
}

/* CUSTOM DROPDOWNS ÉS GOMBOK */
.custom-dropdown {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  min-width: 180px;
}
.dropdown-selected {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  user-select: none;
  border-radius: 4px;
}
.dropdown-selected:hover {
  background: rgba(255, 255, 255, 0.05);
}
.dropdown-label {
  color: var(--text-secondary);
}
.dropdown-value {
  color: var(--text-primary);
  flex: 1;
}
.dropdown-arrow {
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: transform 0.2s;
}
.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-options {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  background-color: var(--dropdown-bg);
  border: 1px solid var(--window-border);
  border-radius: 4px;
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-duration) var(--transition-smooth);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}
.custom-dropdown.open .dropdown-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-option {
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.dropdown-option:hover {
  background-color: var(--dropdown-hover);
  color: var(--text-primary);
}
.dropdown-option.active {
  color: var(--accent-blue);
  background-color: rgba(59, 130, 246, 0.1);
}

.view-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.layout-toggles {
  display: flex;
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  padding: 0.2rem;
  border: 1px solid var(--window-border);
}
.toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.toggle-btn.active {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}
.toggle-btn.icon-btn {
  padding: 0.4rem 0.6rem;
  font-size: 1.2rem;
  line-height: 1;
}
#btnFavs.active {
  color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.3);
}

/* ==========================================================================
   APP KÁRTYÁK (GRID NÉZET - ALAPÉRTELMEZETT)
   ========================================================================== */
.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  transition: all 0.3s;
}
.app-card {
  background-color: var(--terminal-bg);
  border: 1px solid var(--window-border);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
  opacity: 0;
  transform: translateY(20px);
  position: relative;
}
.app-card.fade-in {
  opacity: 1;
  transform: translateY(0);
}
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  border-color: var(--accent-blue);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-right: 2rem;
}
.app-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background-color: var(--terminal-header-bg);
}
.app-info {
  flex: 1;
}
.app-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}
.app-category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-orange);
  text-transform: uppercase;
}

.btn-favorite {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition:
    color 0.2s,
    transform 0.2s;
}
.btn-favorite:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}
.btn-favorite.is-fav {
  color: var(--accent-orange);
}

.app-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex: 1;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--window-border);
  gap: 1rem;
}
.app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-green);
  background-color: rgba(34, 197, 94, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.tag:hover {
  background-color: var(--accent-green);
  color: var(--bg-color);
}

.download-btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background-color: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid var(--window-border);
  border-radius: 4px;
  transition: all 0.2s;
  white-space: nowrap;
}
.download-btn:hover {
  background-color: var(--text-primary);
  color: var(--bg-color);
  border-color: var(--text-primary);
}

.no-results {
  text-align: center;
  font-family: var(--font-mono);
  color: var(--text-desc-pc);
  padding: 3rem;
  grid-column: 1 / -1;
}

/* ==========================================================================
   APP KÁRTYÁK (LISTA NÉZET)
   ========================================================================== */
.app-grid.list-view {
  grid-template-columns: 1fr;
  gap: 0.8rem;
}
.app-grid.list-view .app-card {
  flex-direction: row;
  align-items: center;
  padding: 0.8rem 1rem;
  gap: 1.5rem;
}
.app-grid.list-view .btn-favorite {
  position: static;
  margin-right: 0.5rem;
}
.app-grid.list-view .card-header {
  padding-right: 0;
  min-width: 250px;
}
.app-grid.list-view .app-icon {
  width: 36px;
  height: 36px;
}
.app-grid.list-view .app-description {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}
.app-grid.list-view .card-footer {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  width: auto;
  flex: 0 0 auto;
}
.app-grid.list-view .app-tags {
  display: none;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.sys-footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--window-border);
  text-align: center;
  position: relative;
  z-index: 10;
  background: var(--bg-color);
}
.status-items {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   MEDIA QUERIES
   ========================================================================== */
@media screen and (min-width: 768px) {
  .header-container {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 2rem;
  }
  .app-grid:not(.list-view) {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (min-width: 1024px) {
  .app-grid:not(.list-view) {
    grid-template-columns: repeat(3, 1fr);
  }
  .filters-row {
    flex-wrap: nowrap;
  }
}

@media screen and (min-width: 1400px) {
  .app-grid:not(.list-view) {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media screen and (max-width: 767px) {
  .app-grid.list-view .app-card {
    flex-wrap: wrap;
  }
  .app-grid.list-view .app-description {
    display: none;
  }
  .app-grid.list-view .card-footer {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--window-border);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
  }
  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .view-controls {
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
    opacity: 1;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .app-card {
    transform: none !important;
    opacity: 1 !important;
  }
}

/* ==========================================================================
  CUSTOM SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) var(--bg-color);
}
