
:root {
  --bg: #0f1724; --card: #182231; --glass: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.04); --text-primary: #e6eef6;
  --text-muted: #94a3b8; --accent: #06b6d4; --accent-secondary: #7c3aed;
  --radius: 14px;
}
body.light-theme {
  --bg: #f1f5f9; --card: #ffffff; --glass: #ffffff; --border-color: #e2e8f0;
  --text-primary: #1e293b; --text-muted: #64748b;
}
html, body { height: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  padding: 28px; transition: background 0.3s ease, color 0.3s ease;
}


.appstore { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
header { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; flex-shrink: 0; object-fit: cover; }
h1 { font-size: 20px; margin: 0; }
.subtitle { font-size: 13px; color: var(--text-muted); }
.search { display: flex; gap: 8px; align-items: center; }
.search input { background: var(--glass); border: 1px solid var(--border-color); padding: 10px 12px; border-radius: 10px; color: inherit; min-width: 260px; }
.theme-switcher { cursor: pointer; background: none; border: none; padding: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.theme-switcher svg { width: 24px; height: 24px; stroke: var(--text-muted); fill: none; transition: transform 0.5s cubic-bezier(0.5, -0.75, 0.25, 1.5); }
.theme-switcher .sun { stroke-width: 2; }
.theme-switcher .moon { transform: translateX(-100%); stroke-width: 2; }
body.light-theme .theme-switcher svg { transform: rotate(180deg); }
body.light-theme .theme-switcher .sun { transform: translateX(100%); opacity: 0; }
body.light-theme .theme-switcher .moon { transform: translateX(0%); opacity: 1; }


.sidebar {
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  height: fit-content;
  border: 1px solid var(--border-color);
  
  position: sticky;
  top: 28px; 
}
.category { display: flex; flex-direction: column; gap: 8px; }
.chip { font-family: inherit; font-size: 14px; padding: 8px 10px; border-radius: 999px; background: transparent; border: 1px solid var(--border-color); cursor: pointer; color: var(--text-muted); transition: all 0.2s ease; }
.chip:hover { border-color: var(--accent); color: var(--text-primary); }
.chip.active { background: linear-gradient(90deg, rgba(6,182,212,0.12), rgba(124,58,237,0.08)); border-color: rgba(6,182,212,0.3); color: var(--text-primary); font-weight: 600; }
select.chip { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1.5em 1.5em; padding-right: 2rem; }


.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card { background: var(--card); padding: 14px; border-radius: 12px; border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px; transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease; }
.card:hover { transform: scale(1.05) translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
body.light-theme .card:hover { box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.card .icon, .modal-header .icon, .similar-card .icon { width: 64px; height: 64px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; background: linear-gradient(135deg, #0ea5a4, #7c3aed); color: white; object-fit: cover; flex-shrink: 0; }
.card .title { font-weight: 600; }
.card .meta { font-size: 13px; color: var(--text-muted); }
.card .actions { margin-top: auto; display: flex; gap: 8px; }
.btn { padding: 8px 12px; border-radius: 10px; border: 0; cursor: pointer; font-family: inherit; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.btn.ghost { background: transparent; border: 1px solid var(--border-color); color: inherit; }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-secondary)); color: white; font-weight: 600; }
.btn.icon-btn { padding: 8px; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }
.empty { padding: 28px; border-radius: 12px; text-align: center; color: var(--text-muted); background: var(--card); }
.download-progress { margin-top: 12px; background-color: var(--glass); border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); display: none; }
.progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-secondary)); height: 10px; width: 0%; transition: width 0.2s linear; }
.progress-text { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; display: none; }


.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.6); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 2000; opacity: 0; transition: opacity 0.3s ease; }
.modal-backdrop.visible { opacity: 1; }
body.light-theme .modal-backdrop { background: rgba(15, 23, 42, 0.6); }
.modal { background: var(--bg); border-radius: 14px; padding: 24px; max-width: 880px; width: 100%; box-shadow: 0 10px 30px rgba(2, 6, 23, 0.7); transform: scale(0.95); transition: transform 0.3s ease; display: flex; flex-direction: column; max-height: 90vh; }
.modal-backdrop.visible .modal { transform: scale(1); }
.modal-header { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.modal-header .icon { width: 80px; height: 80px; border-radius: 18px; font-size: 28px; }
.modal-header-info { display: flex; flex-direction: column; flex-grow: 1; }
.modal-actions { margin-left: auto; flex-shrink: 0; display: flex; gap: 8px; }
.modal-tabs { display: flex; gap: 16px; margin-top: 16px; border-bottom: 1px solid var(--border-color); }
.tab-button { font-family: inherit; font-size: 1rem; font-weight: 600; color: var(--text-muted); background: none; border: none; padding: 0 4px 12px 4px; cursor: pointer; position: relative; border-bottom: 3px solid transparent; }
.tab-button.active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-content { overflow-y: auto; padding-top: 16px; scrollbar-width: thin; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.screenshot-gallery { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: thin; }
.screenshot-gallery img { height: 250px; border-radius: 12px; object-fit: cover; cursor: pointer; }
.about-section, .info-grid { padding: 8px; line-height: 1.6; }
.section-title { font-size: 1.1rem; font-weight: 600; margin: 24px 8px 12px 8px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 16px; }
.info-item { display: flex; flex-direction: column; }
.info-item .label { font-size: 13px; color: var(--text-muted); }
.info-item .value { font-weight: 600; }


.reviews-summary { display: flex; align-items: center; gap: 24px; padding: 8px; }
.summary-score { display: flex; flex-direction: column; align-items: center; }
.summary-score .score { font-size: 3rem; font-weight: 700; line-height: 1; }
.summary-score .count { font-size: 13px; color: var(--text-muted); }
.rating-bars { flex-grow: 1; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-row .star-label { color: var(--text-muted); }
.bar-container { flex-grow: 1; background: var(--glass); border-radius: 99px; height: 6px; }
.bar-fill { height: 100%; background: var(--text-muted); border-radius: 99px; }
.reviews-list { margin-top: 16px; }
.review-item { padding: 16px 8px; border-top: 1px solid var(--border-color); }
.review-header { display: flex; align-items: center; gap: 12px; }
.review-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--glass); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.review-user { font-weight: 600; }
.review-rating { color: #facc15; margin-left: auto; }
.review-comment { font-size: 14px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }
.similar-apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 8px; }
.similar-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px; background: var(--glass); border-radius: var(--radius); }
.similar-card .icon { width: 48px; height: 48px; border-radius: 12px; font-size: 16px; }
.similar-card .title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }


.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 4000; display: flex; align-items: center; justify-content: center; }
.lightbox-content { position: relative; user-select: none; }
.lightbox img { max-width: 90vw; max-height: 85vh; object-fit: contain; cursor: grab; transition: opacity 0.2s ease-in-out; }
.lightbox-close, .lightbox-nav { position: absolute; background: rgba(0,0,0,0.3); color: white; border: none; font-size: 2rem; cursor: pointer; z-index: 4001; }
.lightbox-close { top: 15px; right: 15px; width: 40px; height: 40px; border-radius: 50%; }
.lightbox-nav { top: 50%; transform: translateY(-50%); padding: 10px; }
.lightbox-nav.prev { left: 15px; }
.lightbox-nav.next { right: 15px; }


.app-footer { grid-column: 1 / -1; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-color); text-align: center; font-size: 14px; color: var(--text-muted); }
.footer-links { display: flex; justify-content: center; gap: 16px; margin-top: 8px; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.mobile-filter-button, .mobile-nav-panel, .nav-overlay { display: none; }
@media (max-width: 900px) {
  .sidebar { position: static; } 
  body { padding: 16px; } .appstore { grid-template-columns: 1fr; }
  header { justify-content: center; text-align: center; }
  .brand { flex-direction: column; width: 100%; margin-bottom: 16px; }
  .search { width: 100%; justify-content: center; } .search input { min-width: 0; width: 100%; }
  .sidebar { display: none; } .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .toolbar { flex-direction: column; gap: 16px; } .mobile-filter-button { display: block; }
  .mobile-nav-panel { display: block; position: fixed; top: 0; left: 0; width: 300px; height: 100%; background: var(--card); z-index: 3000; transform: translateX(-100%); transition: transform 0.3s ease; padding: 1.5rem; box-shadow: 5px 0 25px rgba(0,0,0,0.1); }
  .mobile-nav-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1rem;}
  .mobile-nav-header h2 { margin: 0; } .mobile-nav-close-btn { font-size: 1.5rem; background: none; border: none; cursor: pointer; color: var(--text-muted); }
  .nav-overlay { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
  body.mobile-nav-open .mobile-nav-panel { transform: translateX(0); } body.mobile-nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .modal .modal-header { flex-direction: column; align-items: center; text-align: center; }
  .screenshot-gallery img { height: 180px; }
}