/*
Theme Name:   Autodeal Child Theme
Description:  Write here a brief description about your child-theme
Author:       Themesflat
Author URL:   https://autodealwp.themesflat.co/
Template:     autodeal
Version:      1.0.0
Tested up to: 5.8.1
Requires PHP: 5.6
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  autodeal-child-theme
*/
/* Header button dropdown overrides for child theme */
.tf-btn-wrap {
  position: relative;
  display: inline-block;
}

/* Make the button define wrap width so dropdown matches exactly */
.tf-btn-wrap>.tf-btn {
  display: block;
}

/* Stretch-down illusion: dropdown sits flush under the button and animates open */
.tf-btn-wrap .tf-btn-dropdown {
  list-style: none;
  margin: 0 0 0 25px;
  padding: 0;
  /* inner items handle their own padding */
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0;
  /* align flush with button */
  background: #ff7101;
  /* same as button color */
  border-radius: 0 0 12px 12px;
  /* continue the button radius only at bottom */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height .28s ease, opacity .2s ease, visibility .2s ease;
  z-index: 50;
}

/* no collar needed when dropdown shares same background as button */
.tf-btn-wrap .tf-btn-dropdown::before {
  content: none;
}

.tf-btn-wrap .tf-btn-dropdown li {
  margin: 0;
}

.tf-btn-wrap .tf-btn-dropdown a {
  display: block;
  padding: 12px 16px;
  color: #fff;
  background: transparent;
  text-align: center;
}

.tf-btn-wrap .tf-btn-dropdown li+li a {
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.tf-btn-wrap .tf-btn-dropdown a:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Open states: hover/focus and JS-driven .open */
.tf-btn-wrap.has-dropdown:hover .tf-btn-dropdown,
.tf-btn-wrap.has-dropdown:focus-within .tf-btn-dropdown,
.tf-btn-wrap.open .tf-btn-dropdown {
  max-height: 500px;
  /* large enough to reveal all items */
  opacity: 1;
  visibility: visible;
}

/* Optional: soften the button's bottom radius when open for a continuous shape */
.tf-btn-wrap.has-dropdown:hover>.tf-btn,
.tf-btn-wrap.has-dropdown:focus-within>.tf-btn,
.tf-btn-wrap.open>.tf-btn {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

/* Mobile tweaks: keep dropdown aligned to the button and inside viewport */
@media (max-width: 767.98px) {
  .tf-btn-wrap {
    position: relative;
  }

  .tf-btn-wrap>.tf-btn {
    display: inline-flex;
    align-items: center;
  }

  .tf-btn-wrap .tf-btn-dropdown {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    margin-left: 0;
    /* cancel desktop left offset */
    top: 100%;
    width: min-content;
    min-width: 145px;
    /* comfortable tap width */
    max-width: calc(100vw - 32px);
    /* keep inside viewport with 16px gutters */
    border-radius: 0 0 12px 12px;
    z-index: 9999;
    /* above sticky header/fab */
  }

  .tf-btn-wrap .tf-btn-dropdown a {
    padding: 14px 18px;
    font-size: 12px;
  }
}

.header-user-icon {
  font-size: 24px;
  margin-left: 20px;
  color: #24272C;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

#header.fixed-show .header-user-icon {
  color: #24272C;
}

.header-user-icon:hover {
  color: var(--theme-primary-color);
}

#header .header-user-icon+.tf-btn-wrap,
#header .header-user-icon+.tf-btn {
  margin-left: 20px;
}

.widget_login_menu_widget--header .user-display-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.widget_login_menu_widget--header .user-display-name .user-email-text,
.widget_login_menu_widget--header .user-dropdown-menu,
.widget_login_menu_widget--header .user-dropdown .user-icon {
  display: none;
}

.widget_login_menu_widget--header .user-display-name .user-name {
  display: inline-block;
}

@media (max-width: 767.98px) {

  .widget_login_menu_widget--header,
  .header-user-icon,
  .tfcl-header-favorite,
  .login-header {
    display: none !important;
  }
}

#themesflat-content {
  padding-top: 20px !important;
}

.sidebar-dashboard--compressed {
  height: 60vh !important;
  overflow-y: auto;
}

/* Compact toolbar filter btn: click target must be button, not SVG children */
.tfcl-compact-filter-btn svg,
.tfcl-compact-filter-btn svg * {
  pointer-events: none;
}

/* === Попап фільтр: ховаємо subtype за замовчуванням === */
/* Плагін покаже його через JS коли вибрано body з підтипами */
/* Використовуємо display: none щоб completely запобігти рендерингу */
@media (max-width: 991px) {

  /* Базовий стан - ПОВНІСТЮ приховати, максимально специфічно */
  .tfcl-mobile-filter-popup .subtype-field-wrapper.tfcl-subtype-hidden,
  .tfcl-mobile-filter-popup .subtype-field-wrapper.tfcl-deps-hidden,
  .tfcl-mobile-filter-popup .tfcl-field-listing-subtype.tfcl-subtype-hidden,
  .tfcl-mobile-filter-popup .tfcl-field-listing-subtype.tfcl-deps-hidden,
  .search-more-options .subtype-field-wrapper.tfcl-subtype-hidden,
  .search-more-options .subtype-field-wrapper.tfcl-deps-hidden,
  .search-more-options .tfcl-field-listing-subtype.tfcl-subtype-hidden,
  .search-more-options .tfcl-field-listing-subtype.tfcl-deps-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    width: 0 !important;
    max-width: 0 !important;
    border: none !important;
  }

  /* Select element для subtype */
  .tfcl-mobile-filter-popup select[name="subtype"],
  .tfcl-mobile-filter-popup select[name="subtype"][style*="display"],
  .tfcl-mobile-filter-popup select.tfcl-listing-subtype-ajax,
  .tfcl-mobile-filter-popup select.tfcl-listing-subtype-ajax[style*="display"],
  .search-more-options select[name="subtype"],
  .search-more-options select[name="subtype"][style*="display"],
  .search-more-options select.tfcl-listing-subtype-ajax,
  .search-more-options select.tfcl-listing-subtype-ajax[style*="display"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
  }

  /* Select2 контейнери для subtype */
  .tfcl-mobile-filter-popup .select2-container[aria-owns*="subtype"],
  .tfcl-mobile-filter-popup .select2-container[data-placeholder*="узо"],
  .tfcl-mobile-filter-popup span.select2-container[title*="узо"],
  .search-more-options .select2-container[aria-owns*="subtype"],
  .search-more-options .select2-container[data-placeholder*="узо"],
  .search-more-options span.select2-container[title*="узо"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  /* Коли body вибрано АБО есть класVisible - ПОКАЗАТИ */
  .tfcl-mobile-filter-popup .subtype-field-wrapper.visible,
  .tfcl-mobile-filter-popup .tfcl-field-listing-subtype.visible,
  .search-more-options .subtype-field-wrapper.visible,
  .search-more-options .tfcl-field-listing-subtype.visible,
  .tfcl-mobile-filter-popup .subtype-field-wrapper.tfcl-subtype-shown,
  .search-more-options .subtype-field-wrapper.tfcl-subtype-shown {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: unset !important;
    max-height: unset !important;
    overflow: visible !important;
    margin: 0 0 15px !important;
    padding: 0 !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    left: auto !important;
  }

  /* Select2 dropdown що висить поза popup - також приховати якщо body не вибраний */
  .select2-dropdown[aria-owns*="subtype"],
  #select2-_subtype_ajax-results,
  #select2-_tfcl_listing_subtype_ajax-results {
    display: none !important;
    visibility: hidden !important;
  }
}

/* === Homepage Mobile: search-more-options overlay fix === */
@media (max-width: 991px) {

  body.home .search-more-options.mobile,
  body.home .search-more-options {
    position: relative;
    z-index: 100;
    background: #fff;
  }

  /* Compact toolbar — hidden by default, shown via .visible */
  body.home .tfcl-homepage-compact-toolbar {
    position: fixed;
    top: var(--tfcl-sticky-header-height, 60px);
    left: 0;
    right: 0;
    z-index: 999999;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 15px;
  }

  body.home .tfcl-homepage-compact-toolbar.visible {
    display: flex;
  }

  /* Кнопка Фільтр в compact toolbar */
  .tfcl-compact-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--theme-primary-color, #f60);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }

  .tfcl-compact-sort-wrap {
    flex: 1;
    min-width: 0;
  }

  .tfcl-compact-sort-wrap select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
  }
}

/* Mobile filter popup — білий фон */
.tfcl-mobile-filter-popup {
  background: #fff !important;
}

.tfcl-mobile-filter-popup-content,
.tfcl-mobile-filter-popup-body,
.tfcl-mobile-filter-section {
  background: #fff !important;
}

/* Ховаємо основну форму коли popup відкритий — запобігає просвічуванню Select2 */
body.filter-popup-open .search-listing-form:not(.tfcl-mobile-filter-popup .search-listing-form) {
  visibility: hidden !important;
}

body.tfcl-mobile-filter-popup-open .search-listing-form:not(.tfcl-mobile-filter-popup .search-listing-form) {
  visibility: hidden !important;
}

/* === Homepage Mobile: ховаємо зайві елементи біля сортування === */
@media (max-width: 991px) {

  /* Ховаємо кнопку "Фільтр" біля сортування на головній (є в compact toolbar при скролі) */
  body.home .listing-list-wrap .tf-search-more-btn.filter-popup,
  body.home .listing-list-wrap a.tf-search-more-btn.enable-mobile,
  body.home .toolbar-search-list .tf-search-more-btn,
  body.home .toolbar-search-list .filter-popup,
  body.home .group-filter-listing .tf-search-more-btn,
  body.home .group-filter-listing .filter-popup:not(.tfcl-mobile-filter-popup) {
    display: none !important;
  }

  /* Ховаємо wrap-reset-filter та layout buttons на головній mobile */
  body.home .listing-list-wrap .wrap-reset-filter,
  body.home .listing-list-wrap .tf-control-layout,
  body.home .listing-list-wrap .btn-display-listing-grid,
  body.home .listing-list-wrap .btn-display-listing-list {
    display: none !important;
  }
}

.page-header .page-title .inner-breadcrumb {
  margin-bottom: 20px;
}

/* === Покращення адаптивності сайту для великих екранів === */
@media (min-width: 1400px) {
  .container,
  .elementor-section.elementor-section-boxed > .elementor-container,
  #header.header-default .inner-header .container,
  .themesflat-top .container {
    max-width: 1380px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

@media (min-width: 1600px) {
  .container,
  .elementor-section.elementor-section-boxed > .elementor-container,
  #header.header-default .inner-header .container,
  .themesflat-top .container {
    max-width: 1540px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

@media (min-width: 1800px) {
  .container,
  .elementor-section.elementor-section-boxed > .elementor-container,
  #header.header-default .inner-header .container,
  .themesflat-top .container {
    max-width: 1720px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* ============================================================
   NOTIFICATION BELL — Dashboard
   ============================================================ */

/* Позиціонування блоку дзвіночка в блоці автора */
.db-author .author {
  position: relative;
  align-items: center;
}

.tfcl-notification-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

/* Кнопка дзвіночка */
.tfcl-notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #f4f6f8;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #555;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  padding: 0;
  outline: none;
}

.tfcl-notification-bell:hover {
  background: var(--theme-primary-color, #ff7101);
  color: #fff;
  transform: scale(1.08);
}

.tfcl-notification-bell svg {
  display: block;
  pointer-events: none;
}

/* Badge лічильника */
.tfcl-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(229,57,53,0.4);
  animation: tfcl-badge-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

.tfcl-notification-badge--hidden {
  display: none;
}

@keyframes tfcl-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Dropdown панель сповіщень */
.tfcl-notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-height: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  border: 1px solid #e8ecf0;
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: tfcl-dropdown-in 0.18s ease;
}

@keyframes tfcl-dropdown-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Шапка dropdown */
.tfcl-notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f3f6;
  font-weight: 700;
  font-size: 13px;
  color: #222;
  flex-shrink: 0;
}

.tfcl-notification-mark-read {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--theme-primary-color, #ff7101);
  font-size: 11px;
  font-weight: 500;
  padding: 0;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.tfcl-notification-mark-read:hover {
  opacity: 0.75;
}

/* Список сповіщень */
.tfcl-notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.tfcl-notification-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background 0.15s ease;
}

.tfcl-notification-item:last-child {
  border-bottom: none;
}

.tfcl-notification-item:hover {
  background: rgba(0,0,0,0.03);
}

.tfcl-notification-item--unread {
  background: rgba(255, 113, 1, 0.06);
  border-left: 3px solid var(--theme-primary-color, #ff7101);
}

/* Clickable notification link */
.tfcl-notification-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: inherit;
  width: 100%;
}

.tfcl-notification-link:hover {
  color: var(--theme-primary-color, #ff7101);
  text-decoration: none;
}

.tfcl-notification-link .tfcl-notification-msg {
  font-weight: 500;
}

.tfcl-notification-link .tfcl-notification-time {
  font-size: 11px;
  color: #999;
}

.tfcl-notification-item--unread:hover {
  background: #fff3ea;
}

.tfcl-notification-msg {
  font-size: 13px;
  color: #333;
  line-height: 1.45;
}

.tfcl-notification-time {
  font-size: 11px;
  color: #999;
}

.tfcl-notification-empty {
  padding: 24px 16px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}

/* ============================================================
   LISTING EXPIRY DATE & STATUS LABELS
   ============================================================ */

/* Дата закінчення під статусом */
.tfcl-expire-date-info {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #888;
  font-weight: 400;
  white-space: nowrap;
}

/* Кольорові статуси */
.tfcl-listing-status.status-publish {
  color: #2e7d32;
  font-weight: 600;
}

.tfcl-listing-status.status-expired {
  color: #b71c1c;
  font-weight: 600;
}

.tfcl-listing-status.status-pending {
  color: #e65100;
  font-weight: 600;
}

.tfcl-listing-status.status-hidden {
  color: #546e7a;
  font-weight: 600;
}

.tfcl-listing-status.status-sold {
  color: #1565c0;
  font-weight: 600;
}

.tfcl-listing-status.status-under_deposit {
  color: #ad5f00;
  font-weight: 600;
}

.tfcl-availability-status-sold {
  background: #24272C !important;
}

.tfcl-availability-status-under_deposit {
  background: #ff7101 !important;
}

.single-listing-element .tfcl-availability-status,
.listing-post .tfcl-availability-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin: 0 0 10px;
  padding: 5px 10px;
  border-radius: 5px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

/* Кнопка "Перепублікувати" */
.action-republish a,
a[data-action="republish"] {
  background: linear-gradient(135deg, #ff7101 0%, #ff9800 100%) !important;
  color: #fff !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  transition: opacity 0.2s ease !important;
}

.action-republish a:hover,
a[data-action="republish"]:hover {
  opacity: 0.85 !important;
  color: #fff !important;
}

/* ============================================================
   FLOATING BELL (universal — shown on all dashboard pages)
   Fixed in top-right corner, always visible for logged-in users
   ============================================================ */

.tfcl-floating-bell-wrap {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 99999;
}

.tfcl-floating-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  cursor: pointer;
  color: #333;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  padding: 0;
  outline: none;
}

.tfcl-floating-bell:hover {
  background: var(--theme-primary-color, #ff7101);
  color: #fff;
  transform: scale(1.08);
}

.tfcl-floating-bell svg {
  display: block;
  pointer-events: none;
}

.tfcl-floating-bell-wrap .tfcl-notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
}

.tfcl-floating-bell-wrap .tfcl-notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
}

/* Mobile: dropdown позиція */
@media (max-width: 600px) {
  .tfcl-notification-dropdown {
    right: -60px;
    width: 280px;
  }
  .tfcl-floating-bell-wrap {
    top: 70px;
    right: 12px;
  }
}

/* ============================================================
   ORIGIN BADGES — кольорові кола + назва місця знаходження
   ============================================================ */

/* Контейнер рядка з бейджами */
.tfcl-origin-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 1px 0 10px;
}

/* Окремий бейдж: коло + текст */
.tfcl-origin-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1;
}

/* Кольорове коло */
.tfcl-origin-dot {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

/* Назва поруч з колом */
.tfcl-origin-label {
    color: #444;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* === У картці — трохи менший розмір === */
.tfcl-origin-badges--card {
    /* -14px компенсує margin-bottom:18px у .title, залишає ~4px між h3 і бейджем */
    margin: -14px 0 8px;
    gap: 6px 12px;
}

.tfcl-origin-badges--card .tfcl-origin-dot {
    width: 11px;
    height: 11px;
}

.tfcl-origin-badges--card .tfcl-origin-label {
    font-size: 13px;
    color: #555;
}

/* === На сторінці оголошення — трохи більший === */
.single-listing-element .tfcl-origin-badges {
    margin: 4px 0 12px;
}

.single-listing-element .tfcl-origin-dot {
    width: 14px;
    height: 14px;
}

.single-listing-element .tfcl-origin-label {
    font-size: 15px;
    color: #333;
}

/* Адаптив для маленьких екранів */
@media (max-width: 575px) {
    .tfcl-origin-badges {
        gap: 6px 12px;
    }
    .tfcl-origin-badge {
        font-size: 13px;
    }
    .tfcl-origin-dot {
        width: 11px;
        height: 11px;
    }
}


