/* MH ImmoVerwaltung – Custom Theme CSS */

:root {
    --mh-primary: #1c1c1c;
    --mh-primary-hover: #333333;
    --mh-primary-foreground: #fafafa;
    --mh-background: #ffffff;
    --mh-foreground: #1c1c1c;
    --mh-muted: #f8f8f8;
    --mh-muted-foreground: #737373;
    --mh-border: #e5e5e5;
    --mh-card: #ffffff;
    --mh-radius: 0.625rem;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--mh-foreground);
    background-color: var(--mh-background);
    margin: 0;
}

/* Active states for toggle buttons in contact form */
.mh-day-btn.active,
.mh-time-btn.active {
    background-color: var(--mh-primary);
    color: var(--mh-primary-foreground);
    border-color: var(--mh-primary);
}

/* Accordion open state */
.mh-accordion-item.open .mh-accordion-chevron {
    transform: rotate(180deg);
    color: var(--mh-primary);
}

.mh-accordion-item.open .mh-accordion-content {
    max-height: 500px;
    opacity: 1;
}

/* FAQ open state */
.mh-faq-item.open .mh-faq-icon {
    transform: rotate(45deg);
}

.mh-faq-item.open .mh-faq-content {
    max-height: 500px;
    opacity: 1;
}

/* Footer link utility */
.footer-link {
    font-size: 0.875rem;
    color: rgba(28, 28, 28, 0.8);
    display: inline-block;
    transition: color 0.15s, transform 0.15s;
    text-decoration: none;
}
.footer-link:hover {
    color: var(--mh-foreground);
    transform: translateX(4px);
}

/* Smooth image transitions */
img {
    max-width: 100%;
    height: auto;
}

/* ===========================================
   ONOFFICE PLUGIN – THEME OVERRIDES
   Gleicht das blaue Plugin-Standarddesign an
   das MH-Theme an (dunkel, dezent, abgerundet).
   Lädt nach der Plugin-style.css → überschreibt.
   =========================================== */

/* --- Überschrift & Trefferzahl --- */
.oo-listheadline {
    padding: 0;
    margin-bottom: 0.5rem;
}
.oo-listheadline h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--mh-foreground);
    margin: 0 0 0.25rem;
}
.oo-listheadline p {
    font-size: 0.9375rem;
    color: var(--mh-muted-foreground);
    margin: 0;
}

/* --- Sortier-Dropdown-Bereich --- */
.oo-estate-sort {
    padding: 0;
}

/* =======================================================
   SUCHFORMULAR / FILTER
   ======================================================= */

.oo-searchform {
    background: var(--mh-muted);
    border: 1px solid var(--mh-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 0 0 2rem 0;
}

.oo-searchformfield {
    padding: 0 0.5rem;
}

.oo-form label,
.oo-searchformfield label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-foreground);
    margin-bottom: 0.5rem;
}

/* Eingabefelder, Textareas, Selects */
.oo-form input:not([type="checkbox"]):not([type="radio"]),
.oo-form textarea,
.oo-searchformfield input,
.ts-control {
    border: 1px solid var(--mh-border) !important;
    border-radius: 0.5rem !important;
    background: #ffffff;
    color: var(--mh-foreground);
    font-size: 0.9375rem;
}

.oo-searchformfield input:not([id$="ts-control"]) {
    height: 48px;
}

.ts-control {
    min-height: 48px;
}

.ts-dropdown,
.ts-control,
.ts-control input {
    border-color: var(--mh-border);
    color: var(--mh-foreground);
}

/* TomSelect Dropdown-Pfeil in Theme-Farbe */
.ts-wrapper .ts-control::after,
.ts-wrapper.single .ts-control::after,
.ts-wrapper.multi .ts-control::after {
    background: var(--mh-foreground);
}

/* Ausgewählte Dropdown-Option */
.ts-dropdown .option.selected,
.ts-dropdown .active {
    background-color: var(--mh-muted);
    color: var(--mh-foreground);
}

/* Fokus-Zustände: dunkel statt blau */
.oo-form input:focus,
.oo-form textarea:focus,
.oo-form select:focus,
.oo-searchformfield input:focus,
.oo-detailview a:focus,
.ts-wrapper.focus,
.ts-wrapper.single.focus,
.ts-wrapper.multi.focus,
.oo-post-nav-links a:focus,
input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: var(--mh-foreground) solid 2px !important;
    border-color: var(--mh-foreground) !important;
}

/* =======================================================
   BUTTONS (Details, Merken, Senden, Pagination)
   Blau (#3d7bb1) → Theme-Dunkel
   ======================================================= */

.oo-detailslink a,
.oo-details-btn,
button.favorize,
.favorize,
.oo-unitslink a,
.oo-leadformlink,
.oo-form input[type='submit'],
.oo-searchformfield input[type='submit'],
.leadform-back,
.leadform-forward,
.leadform-submit {
    background-color: var(--mh-primary) !important;
    color: var(--mh-primary-foreground) !important;
    border: none !important;
    border-radius: 0.5rem !important;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: background-color 0.2s;
}

.oo-detailslink a:hover,
.oo-details-btn:hover,
button.favorize:hover,
.oo-unitslink a:hover,
.oo-leadformlink:hover,
.oo-form input[type='submit']:hover,
.oo-searchformfield input[type='submit']:hover,
.oo-post-nav-links a:hover {
    background: var(--mh-primary-hover) !important;
    color: var(--mh-primary-foreground) !important;
}

button.favorize:focus,
.oo-details-btn:focus,
.oo-leadformlink:focus,
.oo-form input[type='submit']:focus {
    background: var(--mh-primary-hover) !important;
}

/* =======================================================
   PAGINATION
   ======================================================= */

.oo-post-nav-links ul {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
    padding: 0;
}

.oo-post-nav-links a,
.oo-post-nav-links .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    margin: 0;
    border: 1px solid var(--mh-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--mh-foreground);
    background: #ffffff;
}

.oo-post-nav-links .current {
    background: var(--mh-primary);
    color: var(--mh-primary-foreground) !important;
    border-color: var(--mh-primary);
    font-weight: 700;
}

/* =======================================================
   DETAILANSICHT EINES OBJEKTS
   ======================================================= */

.oo-detailsheadline {
    padding: 0;
    margin-bottom: 1.5rem;
}
.oo-detailsheadline h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--mh-foreground);
    line-height: 1.2;
}

.oo-detailview {
    max-width: 80rem;
    margin: 0 auto;
    gap: 2rem 0;
}

/* Galerie abgerundet */
.oo-detailsgallery,
.oo-detailspicture {
    border-radius: 0.75rem;
    overflow: hidden;
}

/* Highlight-Kennzahlen oben */
.oo-details-highlights-headline,
.oo-details-freetext-headline,
.oo-detailview h2,
.oo-detailview h3 {
    color: var(--mh-foreground);
    font-weight: 700;
}
.oo-details-highlights-headline {
    font-size: 1.375rem;
    margin-bottom: 1rem;
}

.oo-details-highlights-table,
.oo-details-fact__label,
.oo-details-fact__value,
.oo-detailsfreetext,
.oo-detailsmap,
.oo-area-butler,
.oo-detailspricecalculator,
.oo-units,
.oo-asp,
.oo-details-energy-certificate {
    border-color: var(--mh-border) !important;
}

.oo-details-highlight__value {
    color: var(--mh-foreground);
    font-weight: 700;
}
.oo-details-highlight__label,
.oo-details-fact__label {
    color: var(--mh-muted-foreground);
}
.oo-details-fact__value {
    color: var(--mh-foreground);
}

/* Kontakt-/Ansprechpartner-Box in Karten-Optik */
.oo-asp {
    background: var(--mh-muted);
    border: 1px solid var(--mh-border) !important;
    border-radius: 0.75rem;
    padding: 1.25rem;
}
.oo-contact-info img,
.oo-aspname img {
    border-radius: 0.5rem;
}

/* Ähnliche Objekte: Titel in Theme-Farbe */
.oo-similar .oo-listtitle {
    color: var(--mh-foreground);
}

/* =======================================================
   ONOFFICE DETAILSEITE – LAYOUT, KONTAKT & RESPONSIVE
   ======================================================= */

/* --- Grundlayout: Block statt Flex, damit Kopf + Body untereinander stehen --- */
.oo-detailview {
    display: block;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

/* --- KOPF: Galerie (links) + Kontakt/Exposé (rechts) --- */
.mh-detail-top {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    margin-bottom: 2.5rem;
}
.mh-detail-top__gallery {
    min-width: 0;
}
.mh-detail-top__aside {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.mh-detail-top__aside .oo-asp {
    margin: 0;
}

/* --- BODY: Details in voller Breite --- */
.mh-detail-body {
    min-width: 0;
}

/* Inhaltsblöcke klarer trennen */
.oo-detailsfreetext,
.oo-detailspricecalculator,
.oo-details-energy-certificate,
.oo-detailsmap,
.oo-area-butler {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
}
.oo-detailsfreetext {
    color: var(--mh-muted-foreground);
    line-height: 1.7;
}
.oo-detailsfreetext h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--mh-foreground);
    margin: 0 0 0.75rem;
}
.oo-details-fact__label,
.oo-details-fact__value {
    padding: 0.6rem 0.5rem;
}

/* --- Aside (Kontakt + Exposé): sticky auf Desktop --- */
@media (min-width: 1025px) {
    .mh-detail-top__aside {
        position: sticky;
        top: 2rem;
    }
}

/* --- KONTAKTBEREICH: E-Mail-Umbruch fixen --- */
.mh-detail-top__aside .oo-contact-info,
.mh-detail-top__aside .oo-contact-info p,
.mh-detail-top__aside .oo-aspinfo,
.mh-detail-top__aside .oo-field-label {
    overflow-wrap: anywhere;   /* lange E-Mails brechen sauber um statt zu überlaufen */
    word-break: break-word;
    hyphens: auto;
}
.mh-detail-top__aside .oo-contact-info a {
    overflow-wrap: anywhere;
    word-break: break-all;
    color: var(--mh-foreground);
}
.mh-expose-note {
    margin: 0 0 0.75rem;
    color: var(--mh-muted-foreground);
    font-size: 0.9375rem;
}
.oo-contact-info img {
    height: auto !important;
    max-height: 180px;
    width: auto;
    max-width: 100%;
    border-radius: 0.5rem;
}

/* --- GALERIE: responsive Höhe, Bilder füllen sauber --- */
.oo-detailsgallery {
    border-radius: 0.75rem;
    overflow: hidden;
}
.oo-detailspicture,
.oo-detailspicture.slick-slide {
    height: 480px;
    overflow: hidden;
    cursor: zoom-in;
}
.oo-detailspicture .oo-picture,
.oo-detailspicture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.oo-detailsgallery .slick-prev,
.oo-detailsgallery .slick-next {
    width: 44px;
    height: 44px;
    background: rgba(28, 28, 28, 0.55);
    border-radius: 9999px;
    z-index: 2;
}
.oo-detailsgallery .slick-prev:hover,
.oo-detailsgallery .slick-next:hover {
    background: rgba(28, 28, 28, 0.85);
}
.oo-detailsgallery .slick-dots {
    bottom: 12px;
}
.oo-detailsgallery .slick-dots li button:before {
    color: #ffffff;
    opacity: 0.55;
    font-size: 9px;
}
.oo-detailsgallery .slick-dots li.slick-active button:before {
    color: #ffffff;
    opacity: 1;
}

/* Galerie als Positionsanker für Overlay-Elemente */
.oo-detailsgallery {
    position: relative;
}

/* Bildzähler "X / Y" unten links */
.mh-gallery-counter {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 3;
    background: rgba(28, 28, 28, 0.72);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
    pointer-events: none;
}

/* Vollbild-Button oben rechts */
.mh-gallery-fs {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(28, 28, 28, 0.6);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background 0.15s;
}
.mh-gallery-fs:hover {
    background: rgba(28, 28, 28, 0.85);
}

/* Pagination-Dots unten mittig */
.mh-gallery-dots {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 3;
    pointer-events: none;
}
.mh-gallery-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.15s, transform 0.15s;
}
.mh-gallery-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}
.mh-gallery-dot.is-active {
    background: #ffffff;
    transform: scale(1.3);
}

/* Vollbild-Lightbox */
.mh-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mh-lightbox[hidden] {
    display: none;
}
.mh-lightbox__img {
    max-width: 92vw;
    max-height: 86vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
}
.mh-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2.25rem;
    line-height: 1;
    cursor: pointer;
}
.mh-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.mh-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.25);
}
.mh-lightbox__prev { left: 1rem; }
.mh-lightbox__next { right: 1rem; }
.mh-lightbox__counter {
    position: absolute;
    bottom: 1.25rem;
    left: 0;
    right: 0;
    text-align: center;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
}
@media (max-width: 480px) {
    .mh-lightbox__nav { width: 42px; height: 42px; font-size: 1.2rem; }
    .mh-lightbox__prev { left: 0.4rem; }
    .mh-lightbox__next { right: 0.4rem; }
}

/* --- RESPONSIVE BREAKPOINTS --- */

/* Tablet & darunter (≤1024px): Kopf einspaltig – Galerie, dann Kontakt/Exposé */
@media (max-width: 1024px) {
    .mh-detail-top {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Small Tablet (≤768px) */
@media (max-width: 768px) {
    .oo-detailspicture,
    .oo-detailspicture.slick-slide {
        height: 340px;
    }
    .oo-detailsheadline h1 {
        font-size: 1.6rem;
    }
    .oo-details-fact__label,
    .oo-details-fact__value {
        width: 50%;
    }
}

/* Mobile (≤480px) */
@media (max-width: 480px) {
    .oo-detailspicture,
    .oo-detailspicture.slick-slide {
        height: 240px;
    }
    .oo-detailsheadline h1 {
        font-size: 1.4rem;
    }
    .oo-details-fact__label {
        width: 100%;
        font-weight: 700;
        border-bottom: none;
        padding: 0.4rem 0 0;
    }
    .oo-details-fact__value {
        width: 100%;
        padding: 0 0 0.4rem;
    }
}

/* =======================================================
   EXPOSÉ-ANFRAGE MODAL
   ======================================================= */

.mh-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.mh-modal-overlay[hidden] {
    display: none;
}

.mh-modal {
    background: #ffffff;
    border-radius: 0.75rem;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.mh-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: var(--mh-muted-foreground);
    transition: color 0.15s;
}
.mh-modal-close:hover {
    color: var(--mh-foreground);
}

.mh-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mh-foreground);
    margin: 0 0 0.5rem;
}

.mh-modal-sub {
    color: var(--mh-muted-foreground);
    margin: 0 0 1.5rem;
}

body.mh-modal-open {
    overflow: hidden;
}

/* Anfrage-Button volle Breite in der Sidebar */
.mh-expose-request-btn {
    width: 100%;
    cursor: pointer;
}

/* =======================================================
   WORDPRESS ADMIN BAR SPACING
   ======================================================= */

.admin-bar header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar header nav {
        top: 46px;
    }
}
