@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #1e293b;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Модальное окно входа */
.welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: modalFadeIn 0.5s ease-out;
}

.welcome-modal.fade-out {
  animation: modalFadeOut 0.3s ease-in forwards;
}

.welcome-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 24px;
  padding: 48px;
  max-width: 500px;
  width: 90vw;
  box-shadow: 0 25px 80px rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.1);
  animation: contentSlideIn 0.6s ease-out;
  position: relative;
}

.welcome-header {
  text-align: center;
  margin-bottom: 40px;
}

.welcome-header h2 {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: #1e293b;
}

.brand-highlight {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6, #1d4ed8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  color: #64748b;
  font-size: 1rem;
  margin: 0;
  font-weight: 400;
}

.welcome-options {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.login-section, .guest-section {
  text-align: center;
}

.login-section h3, .guest-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: #1e293b;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  background: #ffffff;
}

.input-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.login-btn, .guest-btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.login-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.login-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.guest-btn {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #1e293b;
  border: 2px solid #e2e8f0;
}

.guest-btn:hover {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(148, 163, 184, 0.2);
}

.guest-section p {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0 0 16px 0;
}

.divider {
  position: relative;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  margin: 8px 0;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e8f0;
  z-index: 1;
}

.divider span {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 0 16px;
  position: relative;
  z-index: 2;
}

/* Размытие основного сайта */
.main-site.blurred {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

/* Анимации */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes contentSlideIn {
  from {
    transform: scale(0.9) translateY(30px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .welcome-content {
    padding: 32px 24px;
    max-width: 420px;
  }
  
  .welcome-header h2 {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .welcome-content {
    padding: 24px 20px;
    margin: 16px;
  }
  
  .welcome-header h2 {
    font-size: 1.6rem;
  }
  
  .welcome-options {
    gap: 24px;
  }
}

/* Переключатель категорий */
.category-selector {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 32px 0;
  padding: 0 20px;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #64748b;
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.1);
}

.category-btn:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(148, 163, 184, 0.15);
}

.category-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.category-btn.active:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.category-icon {
  font-size: 1.3rem;
}

.category-text {
  font-weight: 600;
}

/* Анимации переключения фильтров */
.filter-group {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.4s ease;
  pointer-events: none;
}

.filter-group.active {
  opacity: 1;
  max-height: 500px;
  pointer-events: all;
}

.common-filters {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #e2e8f0;
}

header {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 0 0 24px 0;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
  border-radius: 0 0 24px 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px 0 32px;
}

.brand-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.add-ad-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  font-family: 'Inter', sans-serif;
}

.add-ad-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.logo {
  width: 420px;
  height: 120px;
  object-fit: contain;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logo:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

h1 {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  position: relative;
  transition: all 0.3s ease;
}

.home-link {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6, #1d4ed8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  display: inline-block;
}

.home-link:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1d4ed8, #2563eb, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(30, 58, 138, 0.2);
}

.header-sub {
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  color: #64748b;
  padding: 4px 12px;
  border-radius: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: 'Inter', Arial, sans-serif;
  display: inline-block;
  text-align: center;
  line-height: 1;
  width: fit-content;
  border: 1px solid #e2e8f0;
}

#mainContent {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: flex-start;
  margin: 24px 32px;
  max-width: 1400px;
  margin: 24px auto;
}

.content-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.search-bar {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.05);
}

.search-bar input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background-color: #ffffff;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.search-bar input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

#filters {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 16px;
  padding: 24px;
  position: sticky;
  top: 24px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.05);
  height: fit-content;
}

#filters h3 {
  margin: 0 0 20px 0;
  color: #1e293b;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

#filters label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: #1e293b;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  margin-bottom: 16px;
}

#filters select,
#filters input {
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background-color: #ffffff;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  margin-top: 6px;
  font-size: 0.9rem;
}

#filters select:focus,
#filters input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

button {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  color: white;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

button:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

#horseList, #utstyrList {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 0;
}

main div {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.08);
  padding: 24px;
  transition: all 0.3s ease;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

main div:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.2);
}

h3 {
  margin-top: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
}

footer {
  text-align: center;
  font-size: 0.9rem;
  color: #64748b;
  padding: 32px 0;
  border-top: 1px solid rgba(59, 130, 246, 0.1);
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  font-family: 'Inter', sans-serif;
  margin-top: 48px;
}

.horse-card {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.08);
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  height: auto;
  border: 1px solid rgba(59, 130, 246, 0.1);
  width: 100%;
  box-sizing: border-box;
}

.horse-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  margin: 0 auto 16px auto;
  display: block;
  background-color: #f1f5f9;
  border: 2px solid rgba(59, 130, 246, 0.1);
}

/* Специальные стили для изображений оборудования */
.utstyr-card img {
  width: 100%;
  height: 220px; /* Увеличена высота для оборудования */
  object-fit: contain; /* Сохранение пропорций без обрезки */
  object-position: center;
  border-radius: 12px;
  margin: 0 auto 16px auto;
  display: block;
  background-color: #ffffff;
  border: 2px solid rgba(59, 130, 246, 0.1);
  padding: 8px; /* Небольшой отступ для лучшего отображения */
}

.horse-card .card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.horse-card h4 {
  margin: 0 0 12px 0;
  color: #1e293b;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.horse-card p {
  margin: 6px 0;
  color: #64748b;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
}

.horse-card .price-text {
  color: #3b82f6;
  font-weight: 700;
  font-size: 1.1rem;
  font-family: 'Inter', sans-serif;
}

.horse-card:hover {
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15);
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(59, 130, 246, 0.2);
}

.horse-card button {
  margin-top: 16px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.horse-card button:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; 
  top: 0; 
  width: 100vw; 
  height: 100vh;
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(8px);
}

.modal-content {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 20px;
  padding: 32px;
  max-width: 600px;
  width: 90vw;
  max-height: 88vh;
  overflow-y: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.1);
  animation: modalIn 0.3s ease-out;
  font-family: 'Inter', sans-serif;
}

@keyframes modalIn {
  from { 
    transform: translate(-50%, -50%) scale(0.95); 
    opacity: 0; 
  }
  to { 
    transform: translate(-50%, -50%) scale(1); 
    opacity: 1; 
  }
}
.close {
  position: absolute;
  right: 18px;
  top: 12px;
  font-size: 2rem;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s;
}
.close:hover {
  color: #333;
}

/* Modal bildegalleri */
.modal-image-gallery {
  margin: 15px 0 20px 0;
}

.modal-horse-image {
  width: 100%;
  max-height: 165px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background-color: #f8f6f2;
}

/* Hvis 2 eller flere bilder, vis i rutenett */
.modal-image-gallery:has(.modal-horse-image:nth-child(2)) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-image-gallery:has(.modal-horse-image:nth-child(2)) .modal-horse-image {
  width: 100%;
  max-height: 140px;
  margin-bottom: 0;
}

/* Hvis 3 bilder, første bilde tar full bredde */
.modal-image-gallery:has(.modal-horse-image:nth-child(3)) {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}

.modal-image-gallery:has(.modal-horse-image:nth-child(3)) .modal-horse-image:first-child {
  grid-column: 1 / -1;
  max-height: 190px;
}

.modal-horse-info {
  border-top: 1px solid #eee;
  padding-top: 15px;
}

#filterBtn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  width: 100%;
  margin-top: 16px;
}

#filterBtn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Stiler for ny annonse form */
#addAdForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#addAdForm label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
}

#addAdForm input,
#addAdForm select,
#addAdForm textarea {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  background: #ffffff;
}

#addAdForm input:focus,
#addAdForm select:focus,
#addAdForm textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#addAdForm textarea {
  resize: vertical;
  font-family: 'Inter', sans-serif;
}

.form-buttons {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.form-buttons button {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}

.form-buttons button[type="submit"] {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.form-buttons button[type="submit"]:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.form-buttons button[type="button"] {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #1e293b;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.form-buttons button[type="button"]:hover {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.3);
}

/* Stiler for ad-details.html siden */
.ad-details-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.back-btn {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #1e293b;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 24px;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.back-btn:hover {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.3);
}

/* Совместимость со старым кодом horse-details */
.horse-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.horse-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.horse-gallery .horse-image {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* Унифицированные стили для ad-details структуры */
.horse-details,
.ad-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 32px;
}

.horse-gallery,
.ad-image-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.horse-info,
.ad-info-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Hvis mer enn ett bilde, vis dem i rutenett */
.horse-gallery:has(.horse-image:nth-child(2)) {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Hvis 3 bilder, lag spesielt rutenett */
.horse-gallery:has(.horse-image:nth-child(3)) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
}

.horse-gallery:has(.horse-image:nth-child(3)) .horse-image:first-child {
  grid-column: 1 / -1;
  max-height: 400px;
}

.horse-gallery .horse-image:not(:first-child) {
  max-height: 200px;
}

.horse-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  object-position: center;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
  background-color: #ffffff;
  border: 2px solid rgba(59, 130, 246, 0.1);
  padding: 16px;
}

.horse-image:first-child {
  max-height: 400px;
  min-height: 200px;
}

/* Специальные стили для изображений оборудования в ad-details */
.ad-image-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ad-main-image {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.ad-main-image img {
  width: 100%;
  max-height: 400px;
  min-height: 200px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  background-color: #ffffff;
  border: 2px solid rgba(59, 130, 246, 0.1);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.1);
  padding: 16px;
}

/* Стили для контента ad-details */
.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid rgba(59, 130, 246, 0.1);
}

.ad-title-section {
  flex: 1;
}

.ad-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 12px 0;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ad-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 0.95rem;
}

.ad-price-section {
  text-align: right;
}

.ad-price {
  font-size: 2rem;
  font-weight: 800;
  color: #059669;
  margin-bottom: 12px;
}

.favorite-btn {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border: 2px solid #e2e8f0;
  color: #64748b;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.favorite-btn:hover {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  transform: translateY(-1px);
}

.favorite-btn.favorited {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: #fca5a5;
  color: #dc2626;
}

.ad-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 32px;
}

.ad-info-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ad-details-grid {
  display: grid;
  gap: 16px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.detail-label {
  font-weight: 600;
  color: #475569;
}

.detail-value {
  font-weight: 500;
  color: #1e293b;
}

.ad-description h3 {
  color: #1e293b;
  margin: 0 0 16px 0;
  font-size: 1.3rem;
}

.ad-description p {
  color: #475569;
  line-height: 1.6;
  margin: 0;
}

.ad-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-btn, .share-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-family: 'Inter', sans-serif;
}

.contact-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.contact-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.share-btn {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #475569;
  border: 2px solid #e2e8f0;
}

.share-btn:hover {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  transform: translateY(-2px);
}

/* Унифицированные стили заголовков */
.horse-title,
.ad-title {
  font-size: 2.2rem;
  color: #1e293b;
  margin: 0 0 12px 0;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Унифицированные стили спецификаций */
.horse-specs,
.ad-details-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 32px;
}

.spec-item,
.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.spec-label,
.detail-label {
  font-weight: 600;
  color: #475569;
}

.spec-value,
.detail-value {
  font-weight: 500;
  color: #1e293b;
}

.spec-value.price {
  color: #059669;
  font-weight: 700;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

.spec-label {
  font-weight: 600;
  color: #64748b;
  font-family: 'Inter', sans-serif;
}

.spec-value {
  font-weight: 600;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
}

.spec-value.price {
  font-size: 1.4rem;
  font-weight: 700;
  color: #3b82f6;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.horse-description {
  margin-bottom: 40px;
}

.horse-description h3 {
  color: #1e293b;
  margin-bottom: 16px;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.horse-description p {
  line-height: 1.6;
  color: #64748b;
  font-family: 'Inter', sans-serif;
}

/* Унифицированные стили для кнопок действий */
.action-buttons,
.ad-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.action-buttons button,
.contact-btn, 
.share-btn,
.favorite-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
}

/* Стили для contact-btn */
.contact-btn,
.action-buttons .contact-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.contact-btn:hover,
.action-buttons .contact-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.contact-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.contact-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.favorite-btn {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.2);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.1);
}

.favorite-btn:hover {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.2);
}

.share-btn {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.share-btn:hover {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
}

.error-message {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.error-message h2 {
  color: #d32f2f;
  margin-bottom: 16px;
}

.back-to-main-btn {
  background: #7d5c2b;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.2s;
}

.back-to-main-btn:hover {
  background: #6b4d24;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  font-size: 1.2rem;
  color: #6a5b4b;
}

@media (max-width: 768px) {
  h1 {
    font-size: 2.0rem;
  }
  
  .header-sub {
    font-size: 10px;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 10px;
  }
  
  #mainContent {
    grid-template-columns: 1fr;
    margin: 16px;
    gap: 24px;
  }
  
  #filters {
    position: static;
    margin-bottom: 24px;
  }
  
  .search-bar {
    margin-bottom: 16px;
  }
  
  #horseList, #utstyrList {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .horse-card {
    padding: 16px;
  }
  
  .horse-card img {
    width: 100%;
    max-width: 240px;
    height: 160px;
  }

  .utstyr-card img {
    height: 180px;
    padding: 4px;
  }

  /* Modal tilpasning for tablet */
  .modal-content {
    max-width: 90vw;
    padding: 20px 16px 16px 16px;
  }

  .modal-image-gallery:has(.modal-horse-image:nth-child(3)) .modal-horse-image:first-child {
    max-height: 165px;
  }

  .modal-horse-image {
    max-height: 140px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
    letter-spacing: -0.3px;
  }
  
  .header-sub {
    font-size: 9px;
    letter-spacing: 0.6px;
    padding: 2px 8px;
    border-radius: 8px;
  }
  
  #mainContent {
    margin: 12px;
    gap: 20px;
  }
  
  .search-bar {
    margin-bottom: 12px;
    padding: 12px;
  }
  
  .search-bar input {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  #horseList, #utstyrList {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .horse-card {
    width: 90vw;
    max-width: 320px;
  }
  
  .horse-card img {
    width: 100%;
    height: 180px;
  }

  .utstyr-card img {
    height: 200px;
    padding: 6px;
  }

  /* Modal tilpasning for mobil */
  .modal-content {
    width: 95vw;
    max-height: 85vh;
    padding: 16px 12px 12px 12px;
  }

  .modal-image-gallery:has(.modal-horse-image:nth-child(2)) {
    grid-template-columns: 1fr;
  }

  .modal-image-gallery:has(.modal-horse-image:nth-child(3)) {
    grid-template-columns: 1fr;
  }

  .modal-image-gallery:has(.modal-horse-image:nth-child(3)) .modal-horse-image:first-child {
    grid-column: 1;
    max-height: 185px;
  }

  .modal-horse-image {
    max-height: 165px;
  }
  
  #horseList, #utstyrList {
    gap: 16px;
    padding: 0 10px;
  }
}

/* Responsivt design for ad-details */
@media (max-width: 768px) {
  .horse-details {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }
  
  .horse-title {
    font-size: 2rem;
  }
  
  .horse-image:first-child {
    max-height: 300px;
    min-height: 200px;
  }
  
  .horse-gallery .horse-image:not(:first-child) {
    max-height: 150px;
  }

  /* Адаптивные стили для utstyr-details */
  .ad-body {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .ad-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .ad-price-section {
    text-align: left;
  }

  .ad-title {
    font-size: 1.8rem;
  }

  .ad-price {
    font-size: 1.6rem;
  }

  .ad-main-image img {
    max-height: 300px;
    min-height: 180px;
    padding: 12px;
  }

  .ad-actions {
    flex-direction: column;
  }

  .contact-btn, .share-btn {
    width: 100%;
    justify-content: center;
  }

  /* Mobil tilpasning для galleri med 3 bilder */
  .horse-gallery:has(.horse-image:nth-child(3)) {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .horse-gallery:has(.horse-image:nth-child(3)) .horse-image:first-child {
    grid-column: 1;
    max-height: 300px;
  }
  
  .action-buttons {
    margin-top: 20px;
  }
  
  .ad-details-container {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .horse-image:first-child {
    max-height: 250px;
    min-height: 180px;
  }
  
  .horse-gallery .horse-image:not(:first-child) {
    max-height: 120px;
  }

  /* Адаптивные стили для utstyr-details на очень маленьких экранах */
  .ad-title {
    font-size: 1.5rem;
  }

  .ad-price {
    font-size: 1.4rem;
  }

  .ad-main-image img {
    max-height: 250px;
    min-height: 160px;
    padding: 8px;
  }

  .ad-meta {
    flex-direction: column;
    gap: 8px;
  }

  .detail-item {
    padding: 8px 12px;
  }

  /* Veldig små skjermer - alle bilder i kolonne */
  .horse-gallery:has(.horse-image:nth-child(3)) {
    grid-template-columns: 1fr;
  }

  .horse-gallery:has(.horse-image:nth-child(3)) .horse-image:first-child {
    max-height: 250px;
  }
  
  .horse-title {
    font-size: 1.8rem;
  }
}

/* Header link stiler for ad-details siden */
h1 a {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6, #1d4ed8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: all 0.3s ease;
}

h1 a:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1d4ed8, #2563eb, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
