/* styles.css — Космический UI "Космо-Маркет"
   Темы: cyberpunk / realistic / minimal  · светлая/тёмная · star-field
   Все классы согласованы с app.js и components/*.js.
*/

:root {
  --color-bg: #0d021a;
  --color-bg-card: #1b0a31cc;
  --color-panel: #150721;
  --color-text: #e8e1f2;
  --color-text-muted: #b3a6c9;
  --color-accent: #5ee7df;
  --color-accent2: #7bf6ff;
  --color-danger: #ff5e8a;
  --color-success: #4caf50;
  --color-border: #3a1d6e;
  --font-main: "Inter", "Segoe UI", Tahoma, sans-serif;
}

/* ===== Темы ===== */
body.theme-cyberpunk {
  --color-bg: #0d021a;
  --color-bg-card: #1b0a31cc;
  --color-text: #e8e1f2;
  --color-accent: #ff3e96;
  --color-accent2: #5ee7df;
  --color-border: #5a218c;
}
body.theme-realistic {
  --color-bg: #0a1f33;
  --color-bg-card: #162f45cc;
  --color-text: #d6e3f2;
  --color-accent: #3b82f6;
  --color-accent2: #60a5fa;
  --color-border: #2a4a6e;
}
body.theme-minimal {
  --color-bg: #f7f8fa;
  --color-bg-card: #ffffffcc;
  --color-text: #1f2933;
  --color-accent: #3f51b5;
  --color-accent2: #7986cb;
  --color-border: #dddfe3;
}
body.theme-light {
  --color-bg: #f7f8fa;
  --color-bg-card: #ffffffcc;
  --color-text: #1f2933;
}

/* ===== Базовые стили ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font-main); }
body {
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ===== Звёздное поле ===== */
.star-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}
.star-field::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1px 1px at 20% 40%, #fff4 0 0) 0 0 / 40px 40px repeat,
              radial-gradient(1px 1px at 70% 90%, #fff4 0 0) 0 0 / 50px 50px repeat;
  opacity: 0.55;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}
.star { position: absolute; background: #fff; border-radius: 50%; animation: twinkle 2s infinite; }

/* ===== Анимации ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

.shimmer { background: linear-gradient(90deg, var(--color-border) 25%, #3a2a5c 50%, var(--color-border) 75%); background-size: 200% 100%; animation: shimmer 2.2s infinite; }
.fade-in { animation: fadeIn 0.5s ease-in; }
.float { animation: float 3s ease-in-out infinite; }
.spin { animation: spin 1s linear infinite; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }

/* ===== Layout ===== */
.cosmic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, #1b0a31, #3a1d6e);
  border-bottom: 2px solid var(--color-accent);
  position: sticky;
  top: 0;
  z-index: 10;
}
.cosmic-header .logo { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.5px; }
.cosmic-header .logo .rocket { display: inline-block; }

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 0.6rem 0.3rem;
  background: var(--color-panel);
  border-top: 1px solid var(--color-border);
  z-index: 10;
}
.bottom-nav button { flex: 1; padding: 0.55rem 0.3rem; border: none; color: var(--color-text-muted); font-size: 0.78rem; }
.bottom-nav button.active, .bottom-nav button:hover { color: var(--color-accent); }
.bottom-nav button .icon { font-size: 1.2rem; }

/* ===== Card ===== */
.advert-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: transform 0.12s, border-color 0.12s;
  position: relative;
  overflow: hidden;
}
.advert-card:hover { transform: translateY(-2px); border-color: var(--color-accent); }
.advert-card .photo { width: 90px; height: 70px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.advert-card .photo-placeholder { width: 90px; height: 70px; border-radius: 8px; background: var(--color-border); flex-shrink: 0; }
.advert-card .content { flex: 1; min-width: 0; }
.advert-card .title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem; }
.advert-card .price { color: var(--color-accent2); font-weight: 700; }
.advert-card .meta { color: var(--color-text-muted); font-size: 0.78rem; }
.advert-card .top-badge { position: absolute; top: 6px; right: 6px; background: var(--color-accent); color: #000; font-size: 0.65rem; padding: 2px 6px; border-radius: 999px; }

.reputation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: linear-gradient(90deg, #1b0a31, #3a1d6e);
  border: 1px solid var(--color-accent);
}
.reputation-badge .level { color: var(--color-accent2); }

.theme-toggle { display: flex; align-items: center; gap: 0.5rem; }
.theme-toggle button { padding: 0.3rem 0.6rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-panel); color: var(--color-text); }
.theme-toggle button.active { background: var(--color-accent); color: #000; }
.theme-toggle button[aria-label="dark"] { display: inline-flex; }

/* ===== Heatmap ===== */
.heatmap { display: grid; gap: 2px; }
.heatmap .cell { background: var(--color-border); border-radius: 3px; }
.heatmap .legend { display: flex; justify-content: space-between; margin-top: 0.5rem; color: var(--color-text-muted); font-size: 0.75rem; }

/* ===== Forms ===== */
.form-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.7rem; }
.form-field label { font-size: 0.8rem; color: var(--color-text-muted); }
.form-field input, .form-field textarea, .form-field select {
  padding: 0.55rem 0.7rem; border: 1px solid var(--color-border); border-radius: 8px;
  background: var(--color-panel); color: var(--color-text); outline: none;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--color-accent); }
.btn-primary { background: var(--color-accent); color: #000; border: none; padding: 0.6rem 1rem; border-radius: 999px; font-weight: 700; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--color-accent); color: var(--color-accent); padding: 0.45rem 0.9rem; border-radius: 999px; }

/* ===== Layout utility ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0.9rem; padding-bottom: 60px; }
.grid { display: grid; gap: 0.85rem; }
.muted { color: var(--color-text-muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container { padding: 0.5rem; padding-bottom: 70px; }
  .advert-card { gap: 0.45rem; padding: 0.55rem; }
  .advert-card .photo, .advert-card .photo-placeholder { width: 70px; height: 55px; }
  .cosmic-header { padding: 0.5rem 0.4rem; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .bottom-nav button { font-size: 0.68rem; }
  .cosmic-header .logo { font-size: 1rem; }
}
