/* design.css */

/* --- БАЗОВЫЕ СТИЛИ --- */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; padding: 0; margin: 0; background-color: #f4f4f9; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }
h1, h2, h3 { color: #333; }
h1, h2 { text-align: center; }

/* --- ФОРМЫ И ВВОД ДАННЫХ --- */
.form-group { margin-bottom: 15px; }
label { font-weight: bold; display: block; margin-bottom: 5px; color: #555; font-size: 14px; }
input, textarea, select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }
select:disabled { background-color: #e9ecef; cursor: not-allowed; }

/* --- СЕТКИ --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
@media (max-width: 768px) {
    .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

/* --- КНОПКИ --- */
button { width: 100%; padding: 14px; background: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; font-weight: bold; margin-top: 15px; }
button:hover { background: #218838; }

/* --- БЛОК АВТОРИЗАЦИИ --- */
.login-box { text-align: center; margin-top: 50px; }

/* --- ШАПКА САЙТА --- */
.header { background: #fff; padding: 15px 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 100; }
.header-container { max-width: 1000px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 24px; font-weight: bold; color: #333; cursor: pointer; }
.btn-sell { width: auto; margin-top: 0; padding: 10px 20px; background: #0088cc; }
.btn-sell:hover { background: #006699; }

/* --- НАВИГАЦИЯ --- */
.btn-back { background: #f4f4f9; color: #333; border: 1px solid #ccc; width: auto; padding: 8px 15px; margin-bottom: 20px; font-size: 14px; }
.btn-back:hover { background: #e9ecef; }

/* --- ФИЛЬТРЫ ПОИСКА --- */
.search-filters-block { background: white; padding: 25px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.btn-search { background: #0088cc; margin-top: 20px; }
.btn-search:hover { background: #006699; }

/* --- СТИЛИ ДЛЯ ВИТРИНЫ ОБЪЯВЛЕНИЙ (КАРТОЧКИ) --- */
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; }
.ad-card { border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: transform 0.2s; cursor: pointer; }
.ad-card:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.ad-image { width: 100%; height: 180px; object-fit: cover; }
.ad-info { padding: 15px; }
.ad-title { font-size: 18px; font-weight: bold; margin: 0 0 10px; color: #333; }
.ad-price { font-size: 20px; color: #28a745; font-weight: bold; margin-bottom: 10px; }
.ad-details { font-size: 13px; color: #666; line-height: 1.5; }

/* --- ДЕТАЛЬНАЯ СТРАНИЦА ОБЪЯВЛЕНИЯ --- */
.ad-detail-container { display: flex; flex-direction: column; gap: 30px; background: #fff; padding: 25px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

/* Галерея фотографий */
.ad-detail-gallery { display: flex; flex-direction: column; gap: 15px; }
.detail-main-image { width: 100%; height: 400px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; }
.detail-thumbnails { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
.detail-thumb { width: 90px; height: 65px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 3px solid transparent; transition: border-color 0.2s; }
.detail-thumb:hover { border-color: #ccc; }
.detail-thumb.active { border-color: #0088cc; }

/* Информация об автомобиле */
.ad-detail-info { display: flex; flex-direction: column; }
.detail-title { margin: 0 0 10px; font-size: 26px; text-align: left; }
.detail-price { font-size: 32px; color: #28a745; font-weight: bold; margin-bottom: 25px; }

/* Кнопки связи */
.btn-contact { font-size: 18px; padding: 15px; border: none; border-radius: 5px; cursor: pointer; color: white; font-weight: bold; width: 100%; transition: background 0.2s; margin-top: 0; }
.telegram-btn { background: #0088cc; }
.telegram-btn:hover { background: #006699; }
.phone-btn { background: #28a745; }
.phone-btn:hover { background: #218838; }

/* Список характеристик */
.detail-attributes-list { list-style: none; padding: 0; margin: 0 0 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.detail-attributes-list li { padding: 12px; background: #f8f9fa; border-radius: 6px; font-size: 14px; color: #444; border-left: 4px solid #ddd; }

/* Описание */
.detail-description { line-height: 1.6; color: #333; white-space: pre-wrap; background: #f8f9fa; padding: 15px; border-radius: 6px; font-size: 15px; border: 1px solid #eee; }

/* Адаптивность для больших экранов */
@media (min-width: 800px) {
    .ad-detail-container { flex-direction: row; }
    .ad-detail-gallery { flex: 1.2; width: 60%; }
    .ad-detail-info { flex: 1; width: 40%; }
    .detail-attributes-list { grid-template-columns: 1fr; }
}

/* --- КНОПКИ ЛИЧНОГО КАБИНЕТА --- */
.header-buttons { display: flex; gap: 10px; }
.btn-cabinet { background: #6c757d; padding: 10px 20px; width: auto; margin-top: 0; display: none; }
.btn-cabinet:hover { background: #5a6268; }

.cabinet-actions { display: flex; gap: 10px; margin-top: 15px; }
.btn-edit { background: #ffc107; color: #333; padding: 10px; font-size: 14px; margin-top: 0; }
.btn-edit:hover { background: #e0a800; }
.btn-delete { background: #dc3545; padding: 10px; font-size: 14px; margin-top: 0; }
.btn-delete:hover { background: #c82333; }

/* --- СВАЙП-КАРУСЕЛЬ ФОТО В КАРТОЧКЕ --- */
.ad-image-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Прячем скроллбар в Firefox */
    -ms-overflow-style: none; /* Прячем скроллбар в IE/Edge */
    width: 100%;
    height: 180px;
}

/* Прячем скроллбар в Chrome/Safari/Opera */
.ad-image-slider::-webkit-scrollbar {
    display: none;
}

.ad-image-slider img {
    flex: 0 0 100%; /* Каждое фото занимает ровно 100% ширины карточки */
    width: 100%;
    height: 100%;
    object-fit: cover;
    scroll-snap-align: start; /* Фото "примагничивается" к левому краю */
}

/* --- СВАЙП-КАРУСЕЛЬ ДЛЯ ДЕТАЛЬНОЙ СТРАНИЦЫ --- */
.detail-image-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Прячем скроллбар */
    -ms-overflow-style: none;
    width: 100%;
    height: 400px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.detail-image-slider::-webkit-scrollbar {
    display: none;
}

.detail-image-slider img {
    flex: 0 0 100%; /* Фото занимает 100% ширины контейнера */
    width: 100%;
    height: 100%;
    object-fit: cover;
    scroll-snap-align: start; /* Примагничивание */
}


/* --- ВЫПАДАЮЩЕЕ МЕНЮ ПРОФИЛЯ --- */
#user-dropdown-menu div:hover {
    background-color: #f8f9fa;
}


/* --- КНОПКА ИЗБРАННОГО НА КАРТОЧКЕ --- */
.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    transition: transform 0.1s;
    color: #ccc; /* Серая звезда по умолчанию */
}
.fav-btn:hover {
    transform: scale(1.1);
}
.fav-btn.active {
    color: #f39c12; /* Желтая звезда, если в избранном */
}

/* Чтобы звезда позиционировалась относительно картинки */
.ad-card {
    position: relative; 
}

/* --- ТУМБЛЕР (ПЕРЕКЛЮЧАТЕЛЬ) ДЛЯ НАСТРОЕК --- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #28a745; /* Зеленый (Telegram ВКЛЮЧЕН) */
  transition: .4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

/* Когда чекбокс нажат (Telegram СКРЫТ) */
input:checked + .toggle-slider {
  background-color: #ccc; /* Серый (Отключено) */
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* --- ВСПЛЫВАЮЩАЯ ПОДСКАЗКА (TOOLTIP) --- */
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: help;
}

.info-icon {
    font-size: 20px;
    color: #666;
    background: #f4f4f9;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
    transition: 0.2s;
}

.info-icon:hover {
    background: #e9ecef;
    color: #333;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    line-height: 1.4;
    
    /* Позиционирование подсказки сверху */
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    margin-left: -100px; /* Половина ширины, чтобы отцентровать */
    
    /* Анимация появления */
    opacity: 0;
    transition: opacity 0.3s;
}

/* Стрелочка вниз у подсказки */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Показываем подсказку при наведении */
.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}
