:root {
  --bg-primary: #0a0c12;
  --bg-surface: #12161e;
  --bg-surface-hover: #1a202c;
  --bg-card: #161c28;
  --border-color: #2a3040;
  --border-light: #3a4055;
  --accent: #7ee014;
  --accent-glow: rgba(126, 224, 20, 0.25);
  --accent-hover: #94f02a;
  --text-primary: #e8edf5;
  --text-secondary: #8a94a8;
  --text-muted: #5a6478;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(126, 224, 20, 0.08);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-image: url("images/bg.jpg");
  backdrop-filter: blur(2px);
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .btn-icon {
  display: flex;
  align-items: center;
  opacity: 0.8;
}

.topbar .btn-icon img {
  width: 28px;
  height: 28px;
  filter: brightness(0) saturate(100%) invert(72%) sepia(76%) saturate(529%) hue-rotate(54deg) brightness(95%) contrast(88%);
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #a8f04a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== MAIN LAYOUT ===== */
.main {
  display: flex;
  height: calc(100vh - 60px);
  gap: 0;
  animation: fadeSlideUp 0.4s ease;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 250px;
  border-right: 1px solid var(--border-color);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  overflow-y: auto;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 0 12px 8px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.cat {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  position: relative;
}

.cat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleX(0);
  width: 3px;
  height: 60%;
  border-radius: 0 4px 4px 0;
  transition: var(--transition);
}

.cat:hover {
  color: var(--text-primary);
}

.cat.active {
  color: var(--accent);
}

.cat.active::before {
  transform: translateY(-50%) scaleX(1);
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

.content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.toolbar input {
  flex: 1;
  min-width: 200px;
}

.toolbar input::placeholder {
  color: var(--text-muted);
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.toolbar select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a94a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  appearance: none;
}

.toolbar select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  outline: none;
}

.help-btn:hover,
.help-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Блок подсказки */
.help-tooltip {
  display: none;
  position: absolute;
  top: 65px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  z-index: 100;
  animation: fadeSlideUp 0.25s ease;
}

.help-tooltip.show {
  display: block;
}

.help-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.help-tooltip p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== LIST ROWS ===== */
#list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(126, 224, 20, 0.02));
  pointer-events: none;
}

.row:hover {
  transform: translateX(6px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  background: var(--bg-surface-hover);
}

.row .name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.row:hover .name {
  color: var(--accent);
}

.row .desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== APP DETAIL PAGE ===== */
.app-page {
  padding: 8px 4px 40px;
  max-width: 1500px;
  animation: fadeSlideUp 0.4s ease;
}

.details, .downloads-section, .screenshots {
  color: white;
  margin-bottom: 20px;
}

.details p {
  line-height: 1.6;
  margin: 0;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-header {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-color);
}

.app-icon {
  width: 130px;
  height: 130px;
  flex-shrink: 0;
  border-radius: 30px;
  overflow: hidden;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 50px rgba(126, 224, 20, 0.15);
  border: 2px solid var(--border-color);
  transition: var(--transition);
}

.app-icon:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

.app-icon img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.icon-placeholder {
  font-size: 80px;
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #a8f04a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-info h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), #b0b8c8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-info .meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.app-info .meta span {
  background: var(--bg-surface);
  padding: 4px 14px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.app-info .desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 600px;
}

/* ===== DOWNLOADS ===== */
.downloads-section {
  margin: 32px 0;
}

.downloads-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}

.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.download-btn {
  background: linear-gradient(135deg, var(--accent), #5aae0e);
  color: #0a0c12;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(126, 224, 20, 0.35);
  transition: var(--transition);
  min-width: 200px;
  text-align: center;
  border: none;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.download-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(126, 224, 20, 0.5);
  background: linear-gradient(135deg, #94f02a, #6ac012);
}

.download-btn small {
  font-weight: 400;
  opacity: 0.75;
  font-size: 0.8rem;
}

/* ===== SCREENSHOTS ===== */
.screenshots {
  margin: 28px 0;
}

.screenshots h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.screenshot-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.screenshot-grid img:hover {
  transform: scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(126, 224, 20, 0.15);
}

/* ===== BACK BUTTON ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
  margin-bottom: 20px;
  font-weight: 500;
}

.back-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateX(-4px);
}

/* ===== ANIMATIONS FOR RETURN LIST ===== */
@keyframes listFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.list-animating .row {
  animation: listFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}


/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
    padding: 12px 8px;
  }

  .content {
    padding: 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .app-icon {
    width: 100px;
    height: 100px;
  }

  .app-info h1 {
    font-size: 1.5rem;
  }

  .download-buttons {
    flex-direction: column;
  }

  .download-btn {
    min-width: unset;
    width: 100%;
  }

  .screenshot-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar input {
    min-width: unset;
  }
}

@media (max-width: 480px) {
  .sidebar {
    display: none;
  }

  .screenshot-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    gap: 16px;
  }

  .app-icon {
    width: 80px;
    height: 80px;
  }
}