* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0084ff;
  --secondary: #ff4458;
  --bg-dark: #0a0a0a;
  --bg-card: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border: #2a2a2a;
  
  --bg-light: #f5f5f5;
  --card-light: #ffffff;
  --text-dark: #1a1a1a;
  --text-gray: #666666;
  --border-light: #e0e0e0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  transition: 0.3s;
}

body.light {
  --bg-dark: var(--bg-light);
  --bg-card: var(--card-light);
  --text-primary: var(--text-dark);
  --text-secondary: var(--text-gray);
  --border: var(--border-light);
}

/* ===== ВЕРХНЯЯ ПАНЕЛЬ ===== */
.top-bar {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(26, 26, 26, 0.8);
}

.top-bar-inner {
  max-width: 100%;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.logo i {
  font-size: 24px;
  color: var(--primary);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  transition: 0.2s;
  padding: 8px;
}

.theme-toggle:hover {
  color: var(--primary);
  transform: rotate(20deg);
}

/* ===== ГЛАВНЫЙ КОНТЕНТ ===== */
.main-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 28px;
  margin-bottom: 16px;
  font-weight: 800;
}

.page-header input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 14px;
  transition: 0.2s;
}

.page-header input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-dark);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== НОВОСТИ ===== */
.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid var(--border);
}

.news-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.news-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.no-img {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  opacity: 0.3;
}

.news-content {
  padding: 16px;
}

.news-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.news-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== ОБЪЯВЛЕНИЯ ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.listing-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid var(--border);
  position: relative;
}

.listing-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.listing-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.listing-type {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 10px;
  border-radius: 8px;
}

.listing-content {
  padding: 12px;
}

.listing-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.price {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.listing-content p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.listing-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===== СОЗДАНИЕ ПОСТА ===== */
.create-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
}

.create-card h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

.create-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.create-tab {
  flex: 1;
  padding: 12px;
  background: var(--bg-dark);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.create-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.create-form {
  display: none;
  animation: fadeIn 0.3s ease;
}

.create-form.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.create-form input,
.create-form textarea,
.create-form select {
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: 0.2s;
}

.create-form input:focus,
.create-form textarea:focus,
.create-form select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-dark);
}

.create-form button {
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 4px;
}

.create-form button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ===== ПРОФИЛЬ ===== */
.profile-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  border: 1px solid var(--border);
}

.profile-header {
  margin-bottom: 20px;
}

.profile-header img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 12px;
  border: 2px solid var(--primary);
}

.profile-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.stat {
  background: var(--bg-dark);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.stat span {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}

.stat p {
  font-size: 13px;
  color: var(--text-secondary);
}

.profile-actions {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.profile-actions button {
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
}

.profile-actions button:first-child {
  background: var(--primary);
  color: white;
}

.profile-actions button:first-child:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--bg-dark) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
}

.btn-secondary:hover {
  border-color: var(--primary) !important;
}

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(26, 26, 26, 0.95);
}

.nav-item {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: 0.2s;
}

.nav-item i {
  font-size: 20px;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active i {
  transform: scale(1.2);
}

/* ===== МОДАЛИ ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.3s ease;
  position: relative;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 28px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--primary);
}

#postModal .modal-content img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
  margin-top: 20px;
}

.modal-body {
  margin-top: 12px;
}

.modal-body h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-body p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.contact-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-modal {
  max-width: 100%;
}

.auth-modal h2 {
  font-size: 24px;
  margin-bottom: 20px;
  text-align: center;
}

.auth-modal form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-modal input {
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
}

.auth-modal input:focus {
  outline: none;
  border-color: var(--primary);
}

.auth-modal button {
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
}

.auth-modal button:hover {
  opacity: 0.9;
}

.auth-modal p {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-modal a {
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

/* ===== УВЕДОМЛЕНИЯ ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  padding: 14px 20px;
  border-radius: 10px;
  border-left: 4px solid var(--primary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  max-width: 90%;
}

.toast.active {
  opacity: 1;
  pointer-events: all;
}

.toast.success {
  border-left-color: #10b981;
}

.toast.warn {
  border-left-color: #f59e0b;
}

.toast.error {
  border-left-color: #ef4444;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 600px) {
  .main-content {
    padding: 12px;
  }
  
  .page-header h1 {
    font-size: 24px;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
}
