/**
 * FLRent cross-site compatibility layer.
 *
 * Keeps the shared theme wide where appropriate, but prevents content blocks,
 * legacy forms, media and car-listing UI from stretching edge-to-edge.
 */

/* --------------------------------------------------------------------------
 * Shared content proportions
 * ----------------------------------------------------------------------- */
/* Header/navigation can use the wider site grid, while page-builder content
 * stays at a readable width on large displays. */
#main-content.container {
  max-width: 1320px;
}

#main-content > .wp-block-media-text,
#main-content > .wp-block-columns,
#main-content > .wp-block-group,
#main-content > .wp-block-cover,
#main-content > figure,
#main-content > .wp-block-gallery {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

/* Do not leave a large gap for an actual About section. Empty/unconfigured
 * About sections are prevented from rendering in about.php. */
#about {
  margin: 2.5rem 0;
}

/* --------------------------------------------------------------------------
 * Compact site search
 * ----------------------------------------------------------------------- */
.menubar:not(.stick_head) {
  position: relative;
}

.search-outer {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: auto !important;
  padding: 0 15px !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  text-align: left;
  transition: opacity .2s ease, visibility .2s ease !important;
  z-index: 99999;
}

body.search-focus .search-outer {
  height: auto !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-outer .inner_searchbox,
.search-outer .inner_searchbox.w-100.h-100 {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 12px 64px 12px 15px;
  display: block;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .16);
}

.search-outer .inner_searchbox form.search-form {
  position: relative !important;
  inset: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 1180px !important;
  min-height: 46px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: stretch;
  border: 1px solid #c8c8c8;
  background: #fff;
}

.search-outer .inner_searchbox form.search-form label {
  width: auto !important;
  flex: 1 1 auto;
  margin: 0;
}

.search-outer .inner_searchbox input.search-field {
  width: 100% !important;
  height: 46px;
  padding: 8px 12px;
  border: 0;
  background: #fff;
  color: #222;
  font-size: 16px;
}

.search-outer .inner_searchbox button[type="submit"],
.search-outer .inner_searchbox input.search-submit {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  height: 46px;
  margin: 0;
  padding: 8px 22px;
  border: 0;
  border-radius: 0;
  background: var(--color-primary1);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.search-outer .search-close {
  top: 50% !important;
  right: 22px !important;
  transform: translateY(-50%);
  padding: 5px 8px;
  border: 1px solid #333;
  background: #fff;
  color: #222;
  font-size: 12px;
  line-height: 1.2;
}

body.admin-bar .search-outer .inner_searchbox {
  margin-top: 0 !important;
}

body.admin-bar .search-outer .search-close {
  top: 50% !important;
}

/* --------------------------------------------------------------------------
 * Auto Listings compatibility
 * ----------------------------------------------------------------------- */
/* SumoSelect uses a grey placeholder for the first field ("Ma otsin"). Keep
 * it readable and visually consistent with the price selects. */
.SumoSelect > .CaptionCont,
.SumoSelect > .CaptionCont > span,
.SumoSelect > .CaptionCont > span.placeholder {
  background: #fff;
  color: #555 !important;
}

.SumoSelect > .CaptionCont > span.placeholder {
  font-style: normal !important;
  opacity: 1;
}

/* Preserve the styling used by the existing Flameko sale-price integration
 * whenever it outputs original-price / sale-price markup. */
.original-price {
  margin-right: 8px;
  color: #888;
  text-decoration: line-through;
}

.sale-price {
  color: #d32f2f;
  font-weight: 700;
}

/* Keep listing search/forms comfortably bounded inside the wide site grid. */
.auto-listings-search,
.auto-listings .search-form,
.auto-listings-search-form,
.listings-search-form {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
 * Legacy forms/content blocks
 * ----------------------------------------------------------------------- */
/* Old Camper pages contain Bootstrap-4-era form markup. bootstrap4-legacy-
 * compat.css restores the row classes; this wrapper prevents the forms from
 * becoming excessively wide on large displays. */
.entry-content > form,
.entry-content .wpcf7,
.entry-content .wpforms-container,
.entry-content .fluentform,
.entry-content .forminator-ui,
.entry-content .everest-forms,
.entry-content .nf-form-cont {
  width: 100%;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
 * Homepage media / promotional blocks
 * ----------------------------------------------------------------------- */
#main-content .wp-block-embed-youtube,
#main-content .wp-block-embed.is-provider-youtube,
#main-content figure.wp-block-embed-youtube,
#main-content .wp-block-video {
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

#main-content iframe[src*="youtube.com"],
#main-content iframe[src*="youtube-nocookie.com"],
#main-content .wp-block-embed-youtube iframe {
  display: block;
  width: 100% !important;
  max-width: 960px;
  height: auto !important;
  aspect-ratio: 16 / 9;
  margin-left: auto;
  margin-right: auto;
}

/* Media/text promo cards (for example MATKAAUTODE MÜÜK!) should remain a
 * readable card rather than stretching across a 1600px container. */
#main-content .wp-block-media-text {
  width: 100%;
  max-width: 1180px;
}

#main-content .wp-block-media-text img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Review/testimonial screenshots contain text. Never crop or stretch them.
 * The Camper feedback artwork is square (1000x1000); on wide desktops a
 * full-column render makes two reviews dominate the viewport. Keep desktop
 * reviews readable and compact while preserving the existing mobile layout. */
#main-content .carousel img,
#main-content .slick-slide img,
#main-content .swiper-slide img,
#main-content .owl-item img,
#main-content img[src*="feedback"],
#main-content img[alt*="feedback" i],
#main-content img[alt*="review" i] {
  display: block;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain !important;
}

@media (min-width: 768px) {
  #main-content img[src*="feedback"],
  #main-content img[alt*="feedback" i],
  #main-content img[alt*="review" i] {
    max-width: 420px !important;
    max-height: 420px !important;
  }
}

/* Make common carousel pagination controls visible on white backgrounds. */
#main-content .carousel-indicators [data-bs-target],
#main-content .carousel-indicators li,
#main-content .swiper-pagination-bullet,
#main-content .owl-dots .owl-dot span,
#main-content .slick-dots li button:before,
#main-content .splide__pagination__page,
#main-content .glide__bullet,
#main-content .tns-nav button {
  border: 1px solid var(--color-primary1) !important;
  background: #fff !important;
  color: var(--color-primary1) !important;
  opacity: 1 !important;
}

#main-content .carousel-indicators .active,
#main-content .swiper-pagination-bullet-active,
#main-content .owl-dots .owl-dot.active span,
#main-content .slick-dots li.slick-active button:before,
#main-content .splide__pagination__page.is-active,
#main-content .glide__bullet--active,
#main-content .tns-nav button.tns-nav-active {
  background: var(--color-primary1) !important;
  color: var(--color-primary1) !important;
  opacity: 1 !important;
}

@media (max-width: 767px) {
  #main-content.container {
    padding-left: 18px;
    padding-right: 18px;
  }

  .search-outer {
    padding: 0 !important;
  }

  .search-outer .inner_searchbox,
  .search-outer .inner_searchbox.w-100.h-100 {
    padding: 10px 54px 10px 10px;
  }

  .search-outer .inner_searchbox input.search-field {
    font-size: 16px;
  }

  .search-outer .inner_searchbox button[type="submit"],
  .search-outer .inner_searchbox input.search-submit {
    padding-left: 14px;
    padding-right: 14px;
  }

  .search-outer .search-close {
    right: 8px !important;
  }

  #main-content .wp-block-media-text {
    display: block !important;
  }

  #main-content .wp-block-media-text .wp-block-media-text__media,
  #main-content .wp-block-media-text .wp-block-media-text__content {
    width: 100%;
    grid-column: 1 !important;
  }

  #main-content .wp-block-media-text .wp-block-media-text__content {
    padding: 18px 10px !important;
  }

  #main-content .carousel img,
  #main-content .slick-slide img,
  #main-content .swiper-slide img,
  #main-content .owl-item img,
  #main-content img[src*="feedback"],
  #main-content img[alt*="feedback" i],
  #main-content img[alt*="review" i] {
    max-width: 100% !important;
    max-height: none;
  }
}

/* --------------------------------------------------------------------------
 * 0.7.11 legacy content refinements
 * ----------------------------------------------------------------------- */
/* Old Camper contact layouts contain narrow telephone/e-mail columns. The
 * 0.7.x global break-word behavior could split these links character-by-
 * character. Preserve them as readable units and let the column grow. */
.entry-content a[href^="tel:"],
.entry-content a[href^="mailto:"],
#main-content a[href^="tel:"],
#main-content a[href^="mailto:"],
#tp_content a[href^="tel:"],
#tp_content a[href^="mailto:"] {
  white-space: nowrap;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* Do not add upstream padding to every Gutenberg column. It distorts legacy
 * table-like contact layouts and nested columns. Standard pages render under
 * #tp_content rather than the homepage-only #main-content wrapper. */
#main-content .wp-block-column.is-layout-flow.wp-block-column-is-layout-flow,
#tp_content .wp-block-column.is-layout-flow.wp-block-column-is-layout-flow {
  padding-left: 0;
  padding-right: 0;
}

/* Keep legacy tables usable and allow content (especially contact links) to
 * determine sensible column widths instead of forcing narrow fixed cells. */
#main-content table:not(.wc-block-cart-items),
#tp_content table:not(.wc-block-cart-items) {
  table-layout: auto !important;
}

#tp_content .wp-block-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
  /* Compact media/text promotional cards on phones. Text comes first so a
   * large promotional image does not dominate the entire first screen. */
  #main-content .wp-block-media-text.is-stacked-on-mobile,
  #main-content .wp-block-media-text.has-media-on-the-right {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  #main-content .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content,
  #main-content .wp-block-media-text.has-media-on-the-right .wp-block-media-text__content {
    order: 1;
    padding: 16px 4px 8px !important;
  }

  #main-content .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media,
  #main-content .wp-block-media-text.has-media-on-the-right .wp-block-media-text__media {
    order: 2;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }

  #main-content .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media img,
  #main-content .wp-block-media-text.has-media-on-the-right .wp-block-media-text__media img {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: 240px;
    object-fit: contain;
  }

  #main-content .wp-block-media-text .wp-block-buttons {
    gap: 8px;
  }

  #main-content .wp-block-media-text .wp-block-button,
  #main-content .wp-block-media-text .wp-block-button .wp-block-button__link {
    width: 100%;
  }

  #main-content .wp-block-media-text .wp-block-button .wp-block-button__link {
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
  }

  /* Contact information should stack cleanly instead of compressing text into
   * one-character columns on small screens. */
  #main-content .wp-block-columns,
  #tp_content .wp-block-columns {
    min-width: 0;
  }

  #main-content .wp-block-column,
  #tp_content .wp-block-column {
    min-width: 0;
  }
}


/* --------------------------------------------------------------------------
 * 0.7.12 header/navigation compatibility
 * ----------------------------------------------------------------------- */
/* Compact-search positioning must not cancel the sticky-header fixed state. */
.menubar.stick_head {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 99999;
}

body.admin-bar .menubar.stick_head {
  top: 32px;
  margin-top: 0;
}

@media (max-width: 782px) {
  body.admin-bar .menubar.stick_head {
    top: 46px;
  }
}

@media (max-width: 1000px) {
  /* Keep the menu close control away from the language switcher on the right. */
  .sidenav .closebtn {
    left: 18px;
    right: auto;
  }

  /* Override the old logged-in mobile rule that disabled sticky positioning. */
  .menubar.login-user.stick_head,
  body.admin-bar .menubar.stick_head {
    position: fixed;
    margin-top: 0;
  }
}

/* --------------------------------------------------------------------------
 * 0.7.12 Gutenberg floated-image / contact compatibility
 * ----------------------------------------------------------------------- */
/* The exported Camper contact page uses an alignright image followed later by
 * a nested contact group with 35/25/40 Gutenberg columns. With modern
 * constrained-layout markup that nested group can continue beside the float,
 * leaving too little width for telephone/e-mail columns. Start nested groups
 * below the floated image, matching the historical layout. */
#tp_content .wp-block-group > .wp-block-image.alignright ~ .wp-block-group,
#tp_content .wp-block-group > .wp-block-image.alignleft ~ .wp-block-group {
  clear: both;
  width: 100%;
}

@media (min-width: 782px) {
  #tp_content .wp-block-group > .wp-block-image.alignright ~ .wp-block-group .wp-block-columns,
  #tp_content .wp-block-group > .wp-block-image.alignleft ~ .wp-block-group .wp-block-columns {
    width: 100%;
    align-items: flex-start;
  }
}

/* --------------------------------------------------------------------------
 * 0.8.0 final cross-site polish
 * ----------------------------------------------------------------------- */
/* Keep long archive descriptions out of the visual page-header banner;
 * archive.php renders them once below the banner. */
.box-image-page + .box-text .taxonomy-description {
  display: none;
}

/* Extra safety for media/text and legacy blocks: never allow descendants to
 * force horizontal page overflow on phones. */
@media (max-width: 767px) {
  #main-content img,
  #tp_content img,
  #main-content iframe,
  #tp_content iframe {
    max-width: 100%;
  }
}


/* --------------------------------------------------------------------------
 * 0.8.1 navigation contrast and keyboard polish
 * ----------------------------------------------------------------------- */
/* A current submenu item used to inherit the primary link colour while the
 * submenu itself already had the primary background, making the selected item
 * effectively disappear. Keep selected submenu links readable. */
.main-navigation ul ul .current_page_item > a,
.main-navigation ul ul .current-menu-item > a,
.main-navigation ul ul .current_page_ancestor > a,
.main-navigation ul ul .current-menu-parent > a,
.main-navigation ul ul .current-menu-ancestor > a {
  color: #fff !important;
  font-weight: 600;
}

/* When the current page lives inside a top-level dropdown, make the active
 * parent state explicit and high-contrast on desktop. This also covers a
 * top-level dropdown page that is itself the current item. */
@media (min-width: 1001px) {
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-item,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-parent,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-ancestor,
  .main-navigation .main-menu > ul > li.page_item_has_children.current_page_item,
  .main-navigation .main-menu > ul > li.page_item_has_children.current_page_ancestor {
    background: var(--color-primary1);
  }

  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-item > a,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-parent > a,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-ancestor > a,
  .main-navigation .main-menu > ul > li.page_item_has_children.current_page_item > a,
  .main-navigation .main-menu > ul > li.page_item_has_children.current_page_ancestor > a,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-item::after,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-parent::after,
  .main-navigation .main-menu > ul > li.menu-item-has-children.current-menu-ancestor::after,
  .main-navigation .main-menu > ul > li.page_item_has_children.current_page_item::after,
  .main-navigation .main-menu > ul > li.page_item_has_children.current_page_ancestor::after {
    color: #fff !important;
  }
}

.main-navigation a:focus-visible,
.open-search:focus-visible,
.search-close:focus-visible,
.responsivetoggle:focus-visible,
.sidenav .closebtn:focus-visible {
  outline: 2px solid var(--color-primary1);
  outline-offset: 3px;
}


/* The theme's three optional section animations only use bounceInDown. Keep
 * the exact animation locally instead of loading the complete animate.css
 * library on every page. */
@-webkit-keyframes flrent-bounceInDown {
  from, 60%, 75%, 90%, to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
  0% { opacity: 0; -webkit-transform: translate3d(0, -3000px, 0); transform: translate3d(0, -3000px, 0); }
  60% { opacity: 1; -webkit-transform: translate3d(0, 25px, 0); transform: translate3d(0, 25px, 0); }
  75% { -webkit-transform: translate3d(0, -10px, 0); transform: translate3d(0, -10px, 0); }
  90% { -webkit-transform: translate3d(0, 5px, 0); transform: translate3d(0, 5px, 0); }
  to { -webkit-transform: none; transform: none; }
}
@keyframes flrent-bounceInDown {
  from, 60%, 75%, 90%, to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
  0% { opacity: 0; -webkit-transform: translate3d(0, -3000px, 0); transform: translate3d(0, -3000px, 0); }
  60% { opacity: 1; -webkit-transform: translate3d(0, 25px, 0); transform: translate3d(0, 25px, 0); }
  75% { -webkit-transform: translate3d(0, -10px, 0); transform: translate3d(0, -10px, 0); }
  90% { -webkit-transform: translate3d(0, 5px, 0); transform: translate3d(0, 5px, 0); }
  to { -webkit-transform: none; transform: none; }
}


/* --------------------------------------------------------------------------
 * 0.8.3 shared Flameko site-style consolidation
 * ----------------------------------------------------------------------- */
/* The blue desktop accent strip is a deliberate Flameko heritage accent shared
 * with Autohooldus.ee. Keep the fixed corporate blue instead of tying this
 * distinctive strip to the configurable primary theme colour. */
@media (min-width: 768px) {
  .site-header {
    border-top: 44px solid #024983;
  }
}

/* Social icons consume valuable horizontal space on small phones. This was a
 * shared Camper/Rent Additional CSS rule and is now part of the theme. */
@media (max-width: 480px) {
  .social-media {
    display: none !important;
  }
}

/* Preserve the compact spacing used by the historical shared Flameko layout.
 * Empty/unconfigured About sections are not rendered by the theme. */
#about {
  margin: 0;
  padding: 1% 0;
}

/* Shared desktop menu hover treatment. Submenus already use the primary
 * background, so keep this rule limited to top-level menu items. */
@media (min-width: 1001px) {
  .main-navigation .main-menu > ul > li:hover {
    background-color: var(--color-primary1);
  }

  .main-navigation .main-menu > ul > li:hover > a,
  .main-navigation .main-menu > ul > li.menu-item-has-children:hover::after,
  .main-navigation .main-menu > ul > li.page_item_has_children:hover::after {
    color: #d1d3d4 !important;
  }
}

/* Header Background mode already injects the image dynamically; retain the
 * shared legacy safety rule so the background always fills that area. */
.headerbox {
  background-size: cover;
}

/* --------------------------------------------------------------------------
 * Contact Form 7 legacy Flameko layout compatibility
 * ----------------------------------------------------------------------- */
/* Older Flameko CF7 forms use these semantic wrapper classes. Keeping their
 * layout in the theme allows the duplicated Additional CSS to be removed from
 * individual sites without editing the existing forms. */
#responsive-form {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

#responsive-form .form-row {
  width: 100%;
}

#responsive-form .column-half,
#responsive-form .column-name,
#responsive-form .column-full {
  position: relative;
  float: left;
  width: 100%;
  padding: .65rem;
  box-sizing: border-box;
}

#responsive-form .clearfix::after {
  content: "";
  display: table;
  clear: both;
}

@media (min-width: 768px) {
  #responsive-form .column-half {
    width: 50%;
  }

  #responsive-form .column-name {
    width: 25%;
  }
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
  width: 100%;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-sizing: border-box;
}

.wpcf7 input[type="text"]:focus,
.wpcf7 input[type="email"]:focus,
.wpcf7 input[type="tel"]:focus,
.wpcf7 textarea:focus {
  background: #fff;
}

.wpcf7 .wpcf7-submit {
  float: right;
  padding: 8px 20px;
  border: 0;
  background: #ca0002;
  color: #fff;
  text-transform: uppercase;
  cursor: pointer;
}

.wpcf7 .wpcf7-submit:hover,
.wpcf7 .wpcf7-submit:focus-visible {
  background: #ff0000;
}

.wpcf7 .wpcf7-not-valid-tip {
  padding: 5px;
  background: #ff0000;
  color: #fff;
  font-size: 12px;
  text-shadow: none;
}

/* Support both historical and current CF7 response classes. */
.wpcf7 div.wpcf7-validation-errors,
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.payment-required .wpcf7-response-output {
  margin: 0;
  padding: 5px;
  border-color: transparent;
  background: #f9cd00;
  color: #9c6533;
  text-align: center;
  font-size: 12px;
  text-shadow: none;
}

.wpcf7 div.wpcf7-mail-sent-ok,
.wpcf7 form.sent .wpcf7-response-output {
  margin: 0;
  padding: 5px;
  border-color: #59a80f;
  background: #59a80f;
  color: #fff;
  text-align: center;
  font-size: 12px;
  text-shadow: none;
}
