/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ==========================================================================
   Global / Reset
   ========================================================================== */

* { 
  box-sizing: border-box; 
}

body { 
  margin: 0; 
  padding: 0; 
  background: #f8f9fa; 
}

/* ==========================================================================
   Layout
   ========================================================================== */

.header { 
  background: white; 
  border-bottom: 1px solid #e5e7eb; 
  padding: 12px 20px; 
  margin-bottom: 0; 
}

.header-content { 
  max-width: 1200px; 
  margin: 0 auto; 
}

.header-row { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  justify-content: space-between; 
}

.header-row:not(:last-child) { 
  margin-bottom: 12px; 
}

.header-logo { 
  flex-shrink: 0; 
}

.logo-link { 
  text-decoration: none; 
  display: inline-block; 
}

.logo-text { 
  font-size: 20px; 
  font-weight: 700; 
  color: #111827; 
  transition: color 0.2s; 
}

.logo-link:hover .logo-text { 
  color: #2563eb; 
}

.header-user { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  font-size: 14px; 
  color: #374151; 
  margin-left: auto; 
  position: relative; 
}

.user-menu { 
  position: relative; 
}

.user-menu-trigger { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  background: none; 
  border: none; 
  padding: 6px 12px; 
  border-radius: 8px; 
  cursor: pointer; 
  font-size: 14px; 
  color: #374151; 
  transition: background 0.2s; 
}

.user-menu-trigger:hover { 
  background: #f3f4f6; 
}

.user-email { 
  font-weight: 500; 
}

.user-menu-arrow { 
  font-size: 10px; 
  color: #6b7280; 
  transition: transform 0.2s; 
}

.user-menu-trigger.active .user-menu-arrow { 
  transform: rotate(180deg); 
}

.user-menu-dropdown { 
  position: absolute; 
  top: calc(100% + 8px); 
  right: 0; 
  background: white; 
  border-radius: 8px; 
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06); 
  border: 1px solid #e5e7eb; 
  min-width: 180px; 
  opacity: 0; 
  visibility: hidden; 
  transform: translateY(-8px); 
  transition: all 0.2s; 
  z-index: 1000; 
  overflow: hidden; 
}

.user-menu-dropdown.active { 
  opacity: 1; 
  visibility: visible; 
  transform: translateY(0); 
}

.user-menu-item { 
  display: block; 
  padding: 12px 16px; 
  color: #374151; 
  text-decoration: none; 
  font-size: 14px; 
  transition: background 0.2s; 
  border-bottom: 1px solid #f3f4f6; 
}

.user-menu-item:last-child { 
  border-bottom: none; 
}

.user-menu-item:hover { 
  background: #f9fafb; 
  color: #111827; 
}

.header-link { 
  color: #6b7280; 
  text-decoration: none; 
  font-size: 14px; 
  font-weight: 500; 
  transition: color 0.2s; 
}

.header-link:hover { 
  color: #2563eb; 
}

.header-categories-wrapper { 
  position: relative; 
  flex-shrink: 0; 
}

.header-search-wrapper { 
  position: relative; 
  flex: 1; 
  min-width: 200px; 
  max-width: 500px; 
}

.header-row .header-categories-wrapper + .header-search-wrapper {
  margin-left: 12px;
}

.flash-container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 0 20px; 
}

.flash-container:empty { 
  display: none; 
}

.flash-notice { 
  background: #d1fae5; 
  color: #065f46; 
  padding: 12px 16px; 
  border-radius: 8px; 
  border-left: 4px solid #10b981; 
  margin-bottom: 0; 
  font-size: 14px; 
}

.flash-alert { 
  background: #fee2e2; 
  color: #991b1b; 
  padding: 12px 16px; 
  border-radius: 8px; 
  border-left: 4px solid #ef4444; 
  margin-bottom: 0; 
  font-size: 14px; 
}

/* ==========================================================================
   Container
   ========================================================================== */

.ads-container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 20px; 
}

.ads-container h1 { 
  font-size: 32px; 
  font-weight: 600; 
  color: #1a1a1a; 
  margin: 0 0 24px 0; 
}

/* ==========================================================================
   Categories Dropdown
   ========================================================================== */

.categories-dropdown { 
  position: relative; 
  display: inline-block; 
}

.categories-dropdown-btn { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 6px; 
  background: white; 
  border: 1px solid #e5e7eb; 
  border-radius: 8px; 
  padding: 8px 12px; 
  font-size: 14px; 
  font-weight: 500; 
  color: #374151; 
  cursor: pointer; 
  transition: all 0.2s; 
  min-width: 140px; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); 
  white-space: nowrap; 
}

.categories-dropdown-btn:hover { 
  background: #f9fafb; 
  border-color: #2563eb; 
}

.categories-dropdown-btn .dropdown-arrow { 
  font-size: 10px; 
  transition: transform 0.2s; 
  flex-shrink: 0; 
}

.categories-dropdown-menu { 
  position: absolute; 
  top: 100%; 
  left: 0; 
  background: white; 
  border: 1px solid #e5e7eb; 
  border-radius: 8px; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
  min-width: 360px; 
  width: auto; 
  max-height: 0; 
  overflow: hidden; 
  opacity: 0; 
  visibility: hidden; 
  transition: all 0.3s ease-out; 
  z-index: 10000; 
  margin-top: 4px; 
}

.categories-dropdown-menu.open { 
  max-height: 600px; 
  opacity: 1; 
  visibility: visible; 
  overflow: visible; 
}

.categories-list { 
  list-style: none; 
  padding: 8px 0; 
  margin: 0; 
  max-height: 500px; 
  overflow-y: auto; 
  overflow-x: hidden; 
  position: relative; 
}

.category-item { 
  margin: 0; 
  position: relative; 
}

.category-link { 
  display: flex; 
  align-items: center; 
  padding: 10px 16px; 
  text-decoration: none; 
  color: #374151; 
  transition: all 0.2s; 
  position: relative; 
}

.category-link:hover { 
  background: #f3f4f6; 
  color: #2563eb; 
}

.category-link.active { 
  background: #eff6ff; 
  color: #2563eb; 
  font-weight: 500; 
}

.category-icon { 
  font-size: 18px; 
  margin-right: 12px; 
  width: 24px; 
  text-align: center; 
}

.category-name { 
  flex: 1; 
  font-size: 14px; 
}

.category-count { 
  background: #e5e7eb; 
  color: #6b7280; 
  padding: 2px 8px; 
  border-radius: 12px; 
  font-size: 11px; 
  font-weight: 600; 
  min-width: 20px; 
  text-align: center; 
  margin-left: 8px; 
}

.category-link.active .category-count { 
  background: #2563eb; 
  color: white; 
}

.category-arrow { 
  font-size: 10px; 
  color: #9ca3af; 
  margin-left: auto; 
}

.subcategories { 
  position: fixed; 
  background: white; 
  border: 1px solid #e5e7eb; 
  border-radius: 8px; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
  min-width: 220px; 
  padding: 8px 0; 
  margin: 0; 
  list-style: none; 
  opacity: 0; 
  visibility: hidden; 
  transform: translateX(-10px); 
  transition: all 0.2s ease-out; 
  z-index: 10001; 
  display: block; 
  pointer-events: none; 
  white-space: normal; 
}

.subcategories li { 
  display: block !important; 
  width: 100%; 
  list-style: none; 
  margin: 0; 
}

.subcategory-item { 
  margin: 0; 
  display: block !important; 
  width: 100%; 
  list-style: none; 
}

.subcategory-link { 
  display: flex !important; 
  align-items: center; 
  padding: 8px 16px; 
  text-decoration: none; 
  color: #6b7280 !important; 
  transition: all 0.2s; 
  font-size: 13px; 
  width: 100%; 
  min-height: 36px; 
  box-sizing: border-box; 
}

.subcategory-link span { 
  display: inline-block !important; 
  visibility: visible !important; 
  opacity: 1 !important; 
}

.subcategory-link:hover { 
  background: #f3f4f6; 
  color: #2563eb; 
}

.subcategory-link.active { 
  background: #eff6ff; 
  color: #2563eb; 
  font-weight: 500; 
}

/* Mobile category row */
.category-row-mobile { 
  display: flex; 
  align-items: center; 
  width: 100%; 
}

.mobile-category-link { 
  flex: 2; 
  max-width: 66.66%; 
  display: flex !important; 
}

.subcategory-arrow-btn { 
  background: none; 
  border: none; 
  padding: 8px 12px; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #6b7280; 
  transition: all 0.2s; 
  flex: 1; 
  min-width: 33.33%; 
  border-left: 1px solid #e5e7eb; 
}

.subcategory-arrow-btn:hover { 
  background: #f3f4f6; 
  color: #2563eb; 
}

.subcategory-arrow-btn:active { 
  background: #e5e7eb; 
}

.subcategory-arrow-btn .category-arrow { 
  font-size: 16px; 
  font-weight: 600; 
}

.subcategories-screen { 
  display: flex; 
  flex-direction: column; 
  height: 100%; 
}

.subcategories-header { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 10px 12px; 
  border-bottom: 1px solid #e5e7eb; 
  background: white; 
}

.back-button { 
  background: #f3f4f6; 
  border: 1px solid #e5e7eb; 
  border-radius: 8px; 
  color: #374151; 
  font-size: 13px; 
  font-weight: 500; 
  cursor: pointer; 
  padding: 6px 12px; 
  display: flex; 
  align-items: center; 
  transition: all 0.2s; 
}

.back-button:hover { 
  background: #e5e7eb; 
  color: #1a1a1a; 
  border-color: #d1d5db; 
}

.back-button:active { 
  background: #d1d5db; 
}

.subcategories-title { 
  margin: 0; 
  font-size: 16px; 
  font-weight: 600; 
  color: #1a1a1a; 
  flex: 1; 
}

.subcategories-list { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
  overflow-y: auto; 
  flex: 1; 
}

.subcategories-list .subcategory-item { 
  margin: 0; 
}

.subcategories-list .subcategory-link { 
  display: flex; 
  align-items: center; 
  padding: 10px 12px; 
  text-decoration: none; 
  color: #374151; 
  border-bottom: 1px solid #f3f4f6; 
  font-size: 13px; 
}

.subcategories-list .subcategory-link:hover { 
  background: #f9fafb; 
}

.subcategories-list .subcategory-link.active { 
  background: #eff6ff; 
  color: #2563eb; 
  font-weight: 500; 
}

/* ==========================================================================
   Search Form
   ========================================================================== */

.search-form { 
  display: flex; 
  gap: 6px; 
  align-items: center; 
  flex-wrap: nowrap; 
}

.search-form form { 
  display: flex; 
  gap: 6px; 
  align-items: center; 
  flex-wrap: nowrap; 
  width: 100%; 
  margin: 0; 
  padding: 0; 
}

.search-form input[type="text"] { 
  border: 1px solid #e0e0e0; 
  border-radius: 8px; 
  padding: 8px 12px; 
  font-size: 14px; 
  transition: border-color 0.2s; 
  flex: 1; 
  min-width: 150px; 
}

.search-form input[type="text"]:focus { 
  outline: none; 
  border-color: #2563eb; 
}

.search-form input[type="submit"] { 
  width: 36px; 
  height: 36px; 
  padding: 0; 
  border-radius: 6px; 
  font-size: 16px; 
  font-weight: 500; 
  transition: all 0.2s; 
  background: #2563eb; 
  color: white; 
  border: none; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-shrink: 0; 
}

.search-form input[type="submit"]:hover { 
  background: #1d4ed8; 
}

.search-form a { 
  padding: 8px 10px; 
  border-radius: 8px; 
  font-size: 13px; 
  font-weight: 500; 
  background: #f3f4f6; 
  color: #374151; 
  text-decoration: none; 
  border: 1px solid #e5e7eb; 
  transition: background 0.2s; 
  white-space: nowrap; 
  flex-shrink: 0; 
}

.search-form a:hover { 
  background: #e5e7eb; 
}

/* ==========================================================================
   Toolbar & Buttons
   ========================================================================== */

.toolbar { 
  display: flex; 
  justify-content: flex-end; 
  align-items: center; 
  margin-bottom: 24px; 
  flex-wrap: wrap; 
  gap: 16px; 
}

.btn-primary { 
  background: #2563eb; 
  color: white; 
  padding: 12px 24px; 
  border-radius: 8px; 
  text-decoration: none; 
  font-weight: 500; 
  display: inline-block; 
  transition: background 0.2s; 
}

.btn-primary:hover { 
  background: #1d4ed8; 
}

.view-toggle { 
  display: flex; 
  gap: 4px; 
  background: #f3f4f6; 
  padding: 4px; 
  border-radius: 8px; 
}

.view-toggle a { 
  padding: 8px; 
  border-radius: 6px; 
  text-decoration: none; 
  font-size: 14px; 
  font-weight: 500; 
  transition: all 0.2s; 
  color: #6b7280; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  min-width: 36px; 
  height: 36px; 
}

.view-toggle a:hover { 
  background: #e5e7eb; 
  color: #374151; 
}

.view-toggle a.active { 
  background: white; 
  color: #2563eb; 
  box-shadow: 0 1px 2px rgba(0,0,0,0.05); 
}

.view-toggle a svg { 
  width: 20px; 
  height: 20px; 
}

/* ==========================================================================
   Ads Grid & Cards
   ========================================================================== */

.ads-grid { 
  display: grid; 
  gap: 20px; 
}

.ads-grid.one-column { 
  grid-template-columns: 1fr; 
}

.ads-grid.two-columns { 
  grid-template-columns: repeat(2, 1fr); 
  gap: 12px; 
}


.ad-card { 
  background: white; 
  border-radius: 12px; 
  overflow: hidden; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); 
  transition: all 0.2s; 
}

.ad-card:hover { 
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); 
  transform: translateY(-2px); 
}

.ad-link { 
  text-decoration: none; 
  color: inherit; 
  display: block; 
}

.ad-image { 
  width: 100%; 
  height: 200px; 
  overflow: hidden; 
  background: #f3f4f6; 
  position: relative; 
}

.ad-image img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

.ad-image-placeholder { 
  width: 100%; 
  height: 100%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #9ca3af; 
  font-size: 14px; 
}

.ad-content { 
  padding: 16px; 
}

.ad-category { 
  font-size: 12px; 
  color: #6b7280; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  margin-bottom: 8px; 
  font-weight: 500; 
}

.ad-category-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ad-category-badge {
  display: inline-block;
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  z-index: 10;
}

.ad-category-badge:hover {
  background: #e5e7eb;
  color: #374151;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ad-category-badge-parent {
  color: #9ca3af;
  font-weight: 400;
  background: #f9fafb;
}

.ad-title { 
  font-size: 18px; 
  font-weight: 600; 
  color: #1a1a1a; 
  margin: 0 0 8px 0; 
  line-height: 1.4; 
}

.ad-price { 
  font-size: 20px; 
  font-weight: 700; 
  color: #2563eb; 
  margin-bottom: 8px; 
}

.ad-description { 
  font-size: 14px; 
  color: #6b7280; 
  line-height: 1.5; 
  margin: 0 0 12px 0; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  display: -webkit-box; 
  -webkit-line-clamp: 2; 
  line-clamp: 2; 
  -webkit-box-orient: vertical; 
}

.ad-meta { 
  font-size: 12px; 
  color: #9ca3af; 
}

/* ==========================================================================
   Ad List View
   ========================================================================== */

.ad-list-card { 
  background: white; 
  border-radius: 12px; 
  overflow: hidden; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); 
  margin-bottom: 16px; 
  transition: all 0.2s; 
}

.ad-list-card:hover { 
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); 
  transform: translateY(-2px); 
}

.ad-list-link { 
  text-decoration: none; 
  color: inherit; 
  display: flex; 
  width: 100%; 
}

.ad-list-image { 
  width: 280px; 
  min-width: 280px; 
  flex-shrink: 0; 
  height: 200px; 
  overflow: hidden; 
  background: #f3f4f6; 
}

.ad-list-image img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

.ad-list-image-placeholder { 
  width: 100%; 
  height: 100%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #9ca3af; 
  font-size: 14px; 
}

.ad-list-content { 
  padding: 20px; 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  justify-content: space-between; 
}

.ad-list-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-start; 
  margin-bottom: 12px; 
}

.ad-list-category { 
  font-size: 12px; 
  color: #6b7280; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  font-weight: 500; 
}

.ad-list-category-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ad-list-category-badge {
  display: inline-block;
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  z-index: 10;
}

.ad-list-category-badge:hover {
  background: #e5e7eb;
  color: #374151;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ad-list-category-badge-parent {
  color: #9ca3af;
  font-weight: 400;
  background: #f9fafb;
}

.ad-list-price { 
  font-size: 24px; 
  font-weight: 700; 
  color: #2563eb; 
}

.ad-list-title { 
  font-size: 22px; 
  font-weight: 600; 
  color: #1a1a1a; 
  margin: 0 0 12px 0; 
  line-height: 1.3; 
}

.ad-list-description { 
  font-size: 15px; 
  color: #6b7280; 
  line-height: 1.6; 
  margin: 0 0 16px 0; 
  flex: 1; 
}

.ad-list-footer { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-top: auto; 
}

.ad-list-meta { 
  font-size: 13px; 
  color: #9ca3af; 
}

.ad-list-location { 
  font-size: 13px; 
  color: #6b7280; 
}

/* ==========================================================================
   Ad Show Page
   ========================================================================== */

.ad-show-container { 
  max-width: 900px; 
  margin: 0 auto; 
  padding: 20px; 
}

.back-link { 
  display: inline-flex; 
  align-items: center; 
  color: #2563eb; 
  text-decoration: none; 
  font-size: 14px; 
  font-weight: 500; 
  margin-bottom: 24px; 
  transition: color 0.2s; 
}

.back-link:hover { 
  color: #1d4ed8; 
}

.ad-actions { 
  display: flex; 
  gap: 12px; 
  margin-bottom: 24px; 
  flex-wrap: wrap; 
}

.btn { 
  padding: 10px 20px; 
  border-radius: 8px; 
  font-size: 14px; 
  font-weight: 500; 
  text-decoration: none; 
  display: inline-block; 
  transition: all 0.2s; 
  border: none; 
  cursor: pointer; 
}

.btn-edit { 
  background: #10b981; 
  color: white; 
}

.btn-edit:hover { 
  background: #059669; 
}

.btn-delete { 
  background: #ef4444; 
  color: white; 
}

.btn-delete:hover { 
  background: #dc2626; 
}

.ad-show-card { 
  background: white; 
  border-radius: 12px; 
  padding: 32px; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); 
}

.ad-category-badges { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  margin-bottom: 16px; 
  flex-wrap: wrap; 
}

.ad-category-badge { 
  display: inline-block; 
  font-size: 12px; 
  color: #6b7280; 
  background: #f3f4f6; 
  padding: 6px 12px; 
  border-radius: 6px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  font-weight: 500; 
  text-decoration: none; 
  transition: all 0.2s; 
}

.ad-category-badge:hover { 
  background: #e5e7eb; 
  color: #374151; 
  transform: translateY(-1px); 
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); 
}

.ad-category-badge-parent { 
  color: #9ca3af; 
  font-weight: 400; 
  background: #f9fafb; 
}

.ad-show-title { 
  font-size: 36px; 
  font-weight: 700; 
  color: #1a1a1a; 
  margin: 0 0 16px 0; 
  line-height: 1.2; 
}

.ad-show-price { 
  font-size: 40px; 
  font-weight: 700; 
  color: #2563eb; 
  margin-bottom: 32px; 
}

.ad-photos { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
  gap: 12px; 
  margin-bottom: 32px; 
}

.ad-photo { 
  width: 100%; 
  aspect-ratio: 1; 
  overflow: hidden; 
  background: #f3f4f6; 
  border-radius: 8px; 
}

.ad-photo img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

/* Photo Gallery */
.ad-photos-gallery { 
  margin-bottom: 32px; 
}

.ad-photo-main { 
  width: 100%; 
  margin-bottom: 16px; 
  border-radius: 12px; 
  overflow: hidden; 
  background: #f3f4f6; 
  aspect-ratio: 4/3; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

.ad-photo-large { 
  width: 100%; 
  height: 100%; 
  object-fit: contain; 
  cursor: pointer; 
  transition: transform 0.3s; 
}

.ad-photo-large:hover { 
  transform: scale(1.02); 
}

.ad-photos-thumbnails { 
  display: flex; 
  gap: 8px; 
  flex-wrap: wrap; 
  justify-content: center; 
}

.ad-photo-thumb { 
  width: 80px; 
  height: 80px; 
  border-radius: 8px; 
  overflow: hidden; 
  border: 2px solid transparent; 
  cursor: pointer; 
  transition: all 0.2s; 
  background: #f3f4f6; 
  flex-shrink: 0; 
}

.ad-photo-thumb:hover { 
  border-color: #2563eb; 
  transform: translateY(-2px); 
}

.ad-photo-thumb.active { 
  border-color: #2563eb; 
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); 
}

.thumbnail-img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

/* Photo Modal */
.photo-modal { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  z-index: 9999; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  opacity: 0; 
  visibility: hidden; 
  transition: opacity 0.3s, visibility 0.3s; 
}

.photo-modal.active { 
  opacity: 1; 
  visibility: visible; 
}

.photo-modal-backdrop { 
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  background: rgba(0, 0, 0, 0.95); 
  cursor: pointer; 
}

.photo-modal-content { 
  position: relative; 
  z-index: 1; 
  max-width: 90vw; 
  max-height: 90vh; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
}

.photo-modal-img { 
  max-width: 100%; 
  max-height: 85vh; 
  object-fit: contain; 
  border-radius: 8px; 
}

.photo-modal-close { 
  position: absolute; 
  top: 20px; 
  right: 20px; 
  z-index: 2; 
  background: rgba(255, 255, 255, 0.1); 
  border: none; 
  color: white; 
  font-size: 40px; 
  width: 50px; 
  height: 50px; 
  border-radius: 50%; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  transition: background 0.2s; 
  line-height: 1; 
  padding: 0; 
}

.photo-modal-close:hover { 
  background: rgba(255, 255, 255, 0.2); 
}

.photo-modal-nav { 
  position: absolute; 
  top: 50%; 
  transform: translateY(-50%); 
  z-index: 2; 
  background: rgba(255, 255, 255, 0.1); 
  border: none; 
  color: white; 
  font-size: 50px; 
  width: 60px; 
  height: 60px; 
  border-radius: 50%; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  transition: background 0.2s; 
  line-height: 1; 
  padding: 0; 
}

.photo-modal-nav:hover { 
  background: rgba(255, 255, 255, 0.2); 
}

.photo-modal-prev { 
  left: 20px; 
}

.photo-modal-next { 
  right: 20px; 
}

.photo-modal-counter { 
  position: absolute; 
  bottom: 20px; 
  left: 50%; 
  transform: translateX(-50%); 
  z-index: 2; 
  background: rgba(0, 0, 0, 0.6); 
  color: white; 
  padding: 8px 16px; 
  border-radius: 20px; 
  font-size: 14px; 
  font-weight: 500; 
}

.ad-section { 
  margin-bottom: 32px; 
}

.ad-section-title { 
  font-size: 18px; 
  font-weight: 600; 
  color: #1a1a1a; 
  margin: 0 0 12px 0; 
}

.ad-show-description { 
  font-size: 16px; 
  color: #374151; 
  line-height: 1.7; 
  white-space: pre-wrap; 
}

.ad-divider { 
  border-top: 1px solid #e5e7eb; 
  margin: 32px 0; 
}

.ad-contact-item { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  margin-bottom: 12px; 
  font-size: 15px; 
}

.ad-contact-label { 
  font-weight: 600; 
  color: #374151; 
  min-width: 100px; 
}

.ad-contact-value { 
  color: #2563eb; 
  text-decoration: none; 
}

.ad-contact-value:hover {
  text-decoration: underline; 
}

.ad-user-ads-link {
  font-size: 0.9em;
  color: #6b7280;
  font-weight: normal;
  margin-left: 4px;
}

.ad-contact-value:hover .ad-user-ads-link {
  color: #2563eb;
}

.ad-date { 
  font-size: 14px; 
  color: #9ca3af; 
  margin-top: 24px; 
  padding-top: 24px; 
  border-top: 1px solid #e5e7eb; 
}

.empty-state p { 
  font-size: 16px; 
  margin: 0; 
}

.subcategories.hidden { 
  display: none; 
}

.subcategories-screen.hidden { 
  display: none; 
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.empty-state { 
  text-align: center; 
  padding: 60px 20px; 
  color: #6b7280; 
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  /* Header */
  .header { 
    padding: 8px 12px; 
  }
  
  .header-row { 
    flex-direction: row; 
    align-items: center; 
    gap: 8px; 
    flex-wrap: wrap; 
  }
  
  .header-row:not(:last-child) { 
    margin-bottom: 8px; 
  }
  
  .header-logo { 
    order: 1; 
  }
  
  .logo-text { 
    font-size: 18px; 
  }
  
  .header-user { 
    font-size: 13px; 
    order: 3; 
  }
  
  .user-menu-dropdown { 
    right: 0; 
    left: auto; 
    min-width: 160px; 
  }
  
  .user-menu-item { 
    padding: 10px 14px; 
    font-size: 13px; 
  }
  
  .header-search-wrapper { 
    margin-left: 0; 
    flex: 1; 
    min-width: 0; 
    max-width: none; 
  }
  
  .header-categories-wrapper { 
    flex-shrink: 0; 
    width: auto; 
  }
  
  .flash-container { 
    display: none; 
  }
  
  /* Container */
  .ads-container { 
    padding: 16px; 
  }
  
  .ads-container h1 { 
    font-size: 24px; 
    margin-bottom: 20px; 
  }
  
  /* Categories */
  .categories-dropdown { 
    width: auto; 
    flex-shrink: 0; 
  }
  
  .categories-dropdown-btn { 
    width: auto; 
    padding: 6px 10px; 
    font-size: 13px; 
    min-width: 120px; 
  }
  
  .categories-dropdown-btn .dropdown-arrow { 
    font-size: 9px; 
  }
  
  .categories-dropdown-menu { 
    left: 0; 
    right: 0; 
    min-width: 320px; 
    width: 100%; 
  }
  
  .category-link { 
    padding: 8px 12px; 
    font-size: 13px; 
  }
  
  .category-icon { 
    font-size: 16px; 
    margin-right: 10px; 
    width: 20px; 
  }
  
  .category-name { 
    font-size: 13px; 
  }
  
  .subcategories { 
    display: none !important; 
  }
  
  .desktop-category-link { 
    display: none !important; 
  }
  
  .category-row-mobile { 
    display: flex; 
    align-items: center; 
    width: 100%; 
  }
  
  .mobile-category-link { 
    flex: 2; 
    max-width: 66.66%; 
    display: flex !important; 
  }
  
  /* Search */
  .search-form { 
    flex-direction: row; 
    gap: 6px; 
    align-items: center; 
    flex-wrap: nowrap; 
  }
  
  .search-form form { 
    flex-direction: row; 
    gap: 6px; 
    align-items: center; 
    flex-wrap: nowrap; 
  }
  
  .search-form input[type="text"] { 
    flex: 1; 
    min-width: 0; 
    padding: 6px 10px; 
    font-size: 13px; 
  }
  
  .search-form input[type="submit"] { 
    width: 32px; 
    height: 32px; 
    padding: 0; 
    font-size: 14px; 
    flex-shrink: 0; 
  }
  
  .search-form a { 
    padding: 6px 10px; 
    font-size: 13px; 
    flex-shrink: 0; 
  }
  
  /* Toolbar */
  .toolbar { 
    justify-content: flex-end; 
    align-items: center; 
  }
  
  .desktop-view-toggle { 
    display: none !important; 
  }
  
  .mobile-columns-toggle { 
    display: flex !important; 
  }
  
  /* Grid */
  .ads-grid.two-columns { 
    gap: 10px; 
  }
  
  
  /* Cards */
  .ad-image { 
    height: 180px; 
  }
  
  .ad-content { 
    padding: 14px; 
  }
  
  .ad-title { 
    font-size: 16px; 
  }
  
  .ad-price { 
    font-size: 18px; 
  }
  
  /* Ad List View */
  .ad-list-link { 
    flex-direction: column; 
  }
  
  .ad-list-image { 
    width: 100%; 
    height: 200px; 
  }
  
  .ad-list-content { 
    padding: 16px; 
  }
  
  .ad-list-title { 
    font-size: 18px; 
  }
  
  .ad-list-price { 
    font-size: 20px; 
  }
  
  /* Ad Show Page */
  .ad-show-container { 
    padding: 16px; 
  }
  
  .ad-show-card { 
    padding: 24px; 
  }
  
  .ad-show-title { 
    font-size: 28px; 
  }
  
  .ad-show-price { 
    font-size: 32px; 
  }
  
  .ad-photos { 
    grid-template-columns: 1fr; 
  }
  
  .ad-actions { 
    flex-direction: column; 
  }
  
  .ad-actions .btn { 
    width: 100%; 
    text-align: center; 
  }
}

@media (min-width: 769px) {
  /* Header - ensure horizontal layout */
  .header-row { 
    flex-direction: row; 
    align-items: center; 
  }
  
  .header-categories-wrapper { 
    width: auto; 
    flex-shrink: 0; 
  }
  
  .header-search-wrapper { 
    flex: 1; 
    max-width: 500px; 
    width: auto; 
  }
  
  /* Grid */
  .ads-grid { 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
  }
  
  .mobile-columns-toggle { 
    display: none !important; 
  }
  
  .desktop-view-toggle { 
    display: flex !important; 
  }
  
  .category-row-mobile { 
    display: none !important; 
  }
  
  .mobile-category-link { 
    display: none !important; 
  }
  
  .subcategory-arrow-btn { 
    display: none !important; 
  }
  
  .desktop-category-link { 
    display: flex !important; 
  }
  
  .subcategories-screen { 
    display: none !important; 
  }
  
  /* Photo Gallery Mobile */
  .ad-photo-main { 
    aspect-ratio: 1; 
  }
  
  .ad-photos-thumbnails { 
    gap: 6px; 
  }
  
  .ad-photo-thumb { 
    width: 60px; 
    height: 60px; 
  }
  
  /* Photo Modal Mobile */
  .photo-modal-nav { 
    width: 45px; 
    height: 45px; 
    font-size: 35px; 
  }
  
  .photo-modal-prev { 
    left: 10px; 
  }
  
  .photo-modal-next { 
    right: 10px; 
  }
  
  .photo-modal-close { 
    top: 10px; 
    right: 10px; 
    width: 40px; 
    height: 40px; 
    font-size: 30px; 
  }
  
  .photo-modal-img { 
    max-height: 80vh; 
  }
}

/* Dashboard / Личный кабинет */
.dashboard-container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 24px 20px; 
}

.dashboard-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 32px; 
  flex-wrap: wrap; 
  gap: 16px; 
}

.dashboard-title { 
  font-size: 32px; 
  font-weight: 700; 
  color: #111827; 
  margin: 0; 
}

.dashboard-stats { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
  gap: 12px; 
  margin-bottom: 24px; 
}

.stat-card { 
  background: white; 
  border-radius: 8px; 
  padding: 12px 16px; 
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 
  border: 1px solid #e5e7eb; 
  transition: all 0.2s; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 12px; 
}

.stat-card.stat-link { 
  text-decoration: none; 
  display: flex; 
  cursor: pointer; 
}

.stat-card.stat-link:hover { 
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 
  transform: translateY(-2px); 
  border-color: #d1d5db; 
}

.stat-card.stat-active-filter { 
  background: #f0f9ff; 
  border-color: #2563eb; 
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1); 
}


.stat-card.stat-active-filter .stat-value,
.stat-card.stat-active-filter .stat-label { 
  position: relative; 
  z-index: 2; 
}

.stat-card.stat-active { 
  border-left: 4px solid #10b981; 
}

.stat-card.stat-inactive { 
  border-left: 4px solid #ef4444; 
}

.stat-value { 
  font-size: 28px; 
  font-weight: 700; 
  color: #111827; 
  line-height: 1; 
  flex-shrink: 0; 
}

.stat-label { 
  font-size: 12px; 
  color: #6b7280; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  line-height: 1.3; 
  text-align: right; 
  flex: 1; 
}

.dashboard-categories { 
  background: white; 
  border-radius: 12px; 
  padding: 20px; 
  margin-bottom: 32px; 
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 
  border: 1px solid #e5e7eb; 
}

.dashboard-categories-title { 
  font-size: 18px; 
  font-weight: 600; 
  color: #111827; 
  margin: 0 0 16px 0; 
}

.dashboard-categories-list { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 8px; 
}

.dashboard-category-item { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 12px; 
  padding: 10px 16px; 
  background: #f9fafb; 
  border: 1px solid #e5e7eb; 
  border-radius: 8px; 
  text-decoration: none; 
  color: #374151; 
  font-size: 14px; 
  transition: all 0.2s; 
  min-width: 140px; 
}

.dashboard-category-item:hover { 
  background: #f3f4f6; 
  border-color: #d1d5db; 
  transform: translateY(-1px); 
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); 
}

.dashboard-category-item.active { 
  background: #f0f9ff; 
  border-color: #2563eb; 
  color: #2563eb; 
  font-weight: 500; 
}

.dashboard-category-item .category-name { 
  flex: 1; 
}

.dashboard-category-item .category-count { 
  background: #e5e7eb; 
  color: #6b7280; 
  padding: 2px 8px; 
  border-radius: 12px; 
  font-size: 12px; 
  font-weight: 600; 
  min-width: 24px; 
  text-align: center; 
}

.dashboard-category-item.active .category-count { 
  background: #2563eb; 
  color: white; 
}

.dashboard-categories-reset { 
  margin-top: 16px; 
  padding-top: 16px; 
  border-top: 1px solid #e5e7eb; 
}

.dashboard-ads { 
  background: white; 
  border-radius: 12px; 
  padding: 24px; 
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 
  border: 1px solid #e5e7eb; 
}

.ads-list { 
  display: flex; 
  flex-direction: column; 
  gap: 20px; 
}

.dashboard-ad-card { 
  display: flex; 
  gap: 20px; 
  padding: 20px; 
  border: 1px solid #e5e7eb; 
  border-radius: 12px; 
  transition: all 0.2s; 
  background: white; 
}

.dashboard-ad-card:hover { 
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 
  border-color: #d1d5db; 
}

.dashboard-ad-card.inactive { 
  opacity: 0.7; 
  background: #f9fafb; 
}

.dashboard-ad-image { 
  flex-shrink: 0; 
  width: 150px; 
  height: 150px; 
  border-radius: 8px; 
  overflow: hidden; 
  background: #f3f4f6; 
}

.ad-thumb { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

.ad-thumb-placeholder { 
  width: 100%; 
  height: 100%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #9ca3af; 
  font-size: 14px; 
}

.dashboard-ad-content { 
  flex: 1; 
  min-width: 0; 
}

.dashboard-ad-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-start; 
  gap: 16px; 
  margin-bottom: 12px; 
}

.dashboard-ad-title { 
  font-size: 20px; 
  font-weight: 600; 
  color: #111827; 
  margin: 0; 
  flex: 1; 
}

.ad-title-link { 
  color: #111827; 
  text-decoration: none; 
  transition: color 0.2s; 
}

.ad-title-link:hover { 
  color: #2563eb; 
}

.dashboard-ad-status { 
  flex-shrink: 0; 
}

.status-badge { 
  display: inline-block; 
  padding: 4px 12px; 
  border-radius: 12px; 
  font-size: 12px; 
  font-weight: 600; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
}

.status-badge.status-active { 
  background: #d1fae5; 
  color: #065f46; 
}

.status-badge.status-inactive { 
  background: #fee2e2; 
  color: #991b1b; 
}

.dashboard-ad-meta { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 16px; 
  margin-bottom: 12px; 
  font-size: 14px; 
  color: #6b7280; 
}

.ad-meta-item { 
  display: flex; 
  align-items: center; 
  gap: 6px; 
}

.ad-meta-item strong { 
  color: #374151; 
  font-weight: 600; 
}

.dashboard-ad-description { 
  color: #6b7280; 
  font-size: 14px; 
  line-height: 1.5; 
  margin-bottom: 16px; 
}

.dashboard-ad-actions { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 8px; 
  align-items: flex-start; 
}

.inline-form { 
  display: inline-block; 
  margin: 0; 
}

.btn-sm { 
  padding: 6px 12px; 
  font-size: 13px; 
  border-radius: 6px; 
}

.btn-success { 
  background: #10b981; 
  color: white; 
  border: none; 
}

.btn-success:hover { 
  background: #059669; 
}

.btn-warning { 
  background: #f59e0b; 
  color: white; 
  border: none; 
}

.btn-warning:hover { 
  background: #d97706; 
}

.btn-danger { 
  background: #ef4444; 
  color: white; 
  border: none; 
}

.btn-danger:hover { 
  background: #dc2626; 
}

/* ==========================================================================
   Infinite Scroll Loading Indicator
   ========================================================================== */

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  margin: 32px 0;
  color: #6b7280;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-indicator p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

.btn-link { 
  background: none; 
  color: #2563eb; 
  text-decoration: underline; 
  border: none; 
  padding: 10px 14px; 
  cursor: pointer; 
}

.btn-link:hover { 
  color: #1d4ed8; 
}

.dashboard-empty { 
  text-align: center; 
  padding: 60px 20px; 
  color: #6b7280; 
}

.dashboard-empty p { 
  font-size: 18px; 
  margin-bottom: 24px; 
}

@media (max-width: 768px) {
  .dashboard-header { 
    flex-direction: column; 
    align-items: stretch; 
  }
  
  .dashboard-title { 
    font-size: 24px; 
  }
  
  .dashboard-stats { 
    grid-template-columns: 1fr; 
    gap: 10px; 
  }
  
  .stat-card { 
    padding: 10px 12px; 
  }
  
  .stat-value { 
    font-size: 24px; 
  }
  
  .stat-label { 
    font-size: 11px; 
  }
  
  .dashboard-categories-list { 
    flex-direction: column; 
  }
  
  .dashboard-category-item { 
    width: 100%; 
    min-width: auto; 
  }
  
  .dashboard-ad-card { 
    flex-direction: column; 
  }
  
  .dashboard-ad-image { 
    width: 100%; 
    height: 200px; 
  }
  
  .dashboard-ad-header { 
    flex-direction: column; 
  }
  
  .dashboard-ad-actions { 
    flex-direction: column; 
  }
  
  .dashboard-ad-actions .btn { 
    width: 100%; 
  }
}

/* ==========================================================================
   Error Pages
   ========================================================================== */

.error-container {
  max-width: 600px;
  margin: 60px auto;
  padding: 20px;
}

.error-card {
  background: white;
  border-radius: 12px;
  padding: 48px 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}

.error-icon {
  margin-bottom: 24px;
}

.error-title {
  font-size: 72px;
  font-weight: 700;
  color: #2563eb;
  margin: 0 0 16px 0;
  line-height: 1;
}

.error-subtitle {
  font-size: 28px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 16px 0;
}

.error-message {
  font-size: 16px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0 0 32px 0;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  background: #2563eb;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: white;
  color: #374151;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

@media (max-width: 768px) {
  .error-container {
    margin: 40px auto;
    padding: 16px;
  }

  .error-card {
    padding: 32px 24px;
  }

  .error-title {
    font-size: 56px;
  }

  .error-subtitle {
    font-size: 24px;
  }

  .error-actions {
    flex-direction: column;
  }

  .error-actions .btn {
    width: 100%;
  }
}
