/* ConstroiFolhada - Custom Styles */

/* Marker HQ no mapa (sede) - usar ícone dedicado, sem círculo extra */

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 100px;
    right: 25px;
    background-color: #25d366;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    background-color: #128c7e;
    color: #fff;
    transform: scale(1.1);
}

.whatsapp-float i {
    margin: 0;
}

/* Alert styles */
.alert-success {
    background-color: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin-bottom: 20px;
}

.alert-success i {
    margin-right: 10px;
}

/* Form validation */
.is-invalid {
    border-color: #dc3545 !important;
}

/* Contact section (home): email e texto longo não cortados em mobile */
.contact-bottom-items .info-items .content {
    min-width: 0;
}
.contact-bottom-items .info-items .content h6,
.contact-bottom-items .info-items .content h6 a {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Orçamento / Contact: nice-select "Tipo de Trabalho" - texto visível e alinhado */
.nice-select {
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
    min-height: 58px;
}

.nice-select .current {
    line-height: 1.5 !important;
    display: block !important;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: center;
}

.pagination-wrapper nav {
    display: flex;
    gap: 5px;
}

.pagination-wrapper .page-link {
    padding: 10px 18px;
    border: 1px solid #e0e0e0;
    color: #333;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.pagination-wrapper .page-link:hover,
.pagination-wrapper .page-item.active .page-link {
    background: var(--theme);
    border-color: var(--theme);
    color: #fff;
}

/* Breadcrumb styling override */
.breadcrumb-section {
    padding: 150px 0 80px;
    position: relative;
}

.breadcrumb-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.breadcrumb-content {
    position: relative;
    z-index: 1;
}

.breadcrumb-content h1 {
    color: #fff;
    font-size: 48px;
    margin-bottom: 20px;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.breadcrumb-list li {
    color: #fff;
}

.breadcrumb-list li a {
    color: rgba(255, 255, 255, 0.8);
}

.breadcrumb-list li a:hover {
    color: var(--theme);
}

.breadcrumb-list li i {
    font-size: 12px;
}

/* Fix: PEDIR ORÇAMENTO button visibility and width */
/* Fix: Group ORÇAMENTO text and Hamburger into a solid red block */
/* Using ::before pseudo-element on .header-2 like the template */

.header-2 {
    position: relative;
}

.header-2::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 270px;
    height: 100px;
    background-color: var(--theme);
    z-index: -1;
}

.header-2 .container-fluid {
    padding-right: 60px !important;
    /* Match template's container padding */
}

.header-2,
.header-2 .container-fluid,
.header-2 .header-main {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
}

.header-main {
    height: 100%;
    display: flex;
    align-items: center;
}

.header-right {
    height: 100%;
    align-items: center;
    display: flex;
}

.header__hamburger {
    background-color: transparent;
    /* Red comes from ::before now */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 100px;
    min-width: auto !important;
    gap: 30px;
    margin-left: 20px;
    cursor: pointer;
    align-self: stretch;
    transition: all 0.3s ease-in-out;
}

/* ========================================
   Parallax: escavadora (.shape1) + pedra (.about-image)
   Desktop ≥992px: parallax activo
   Mobile/Tablet ≤991px: layout limpo, sem parallax
   ======================================== */

/* --- Base: esconder escavadora, mostrar imagem mobile --- */
.counter-section .shape1 {
    display: none !important;
}

#about.about-section .about-left-item-style-1 .about-image .about-img-desktop {
    display: none;
}

#about.about-section .about-left-item-style-1 .about-image .about-img-mobile {
    display: block;
    width: 100%;
    height: auto;
}

#about.about-section .about-left-item-style-1 .about-image {
    margin-top: 0;
    transform: none;
}

/* --- Desktop ≥992px: parallax activo --- */
@media (min-width: 992px) {
    .counter-section .shape1 {
        display: block !important;
        pointer-events: none;
    }

    .counter-section .shape1 img {
        width: clamp(280px, 55vw, 900px);
        height: auto;
    }

    #about.about-section .about-left-item-style-1 .about-image .about-img-desktop {
        display: block;
    }

    #about.about-section .about-left-item-style-1 .about-image .about-img-mobile {
        display: none;
    }

    /* HD desktops (992px–1599px): valores ajustados */
    #about.about-section .about-left-item-style-1 .about-image {
        margin-top: -45%;
        transform: translateX(5.5%) translateY(-8.5%) scale(1.15);
    }
}

/* --- Full HD (1600px–2559px): valores testados pelo utilizador --- */
@media (min-width: 1600px) {
    #about.about-section .about-left-item-style-1 .about-image {
        margin-top: -45%;
        transform: translateX(-9.5%) translateY(-8.5%) scale(1.15);
    }
}

/* --- 2K (2560px–3839px): valores testados pelo utilizador --- */
@media (min-width: 2560px) {
    #about.about-section .about-left-item-style-1 .about-image {
        margin-top: -50%;
        transform: translateX(-16.5%) translateY(-0.5%) scale(0.95);
    }
}

/* --- 4K (3840px–5119px): valores testados pelo utilizador --- */
@media (min-width: 3840px) {
    #about.about-section .about-left-item-style-1 .about-image {
        margin-top: -50%;
        transform: translateX(-16%) translateY(25.5%) scale(0.95);
    }
}

/* --- 5K+ (≥5120px): valores testados pelo utilizador --- */
@media (min-width: 5120px) {
    #about.about-section .about-left-item-style-1 .about-image {
        margin-top: -29%;
        transform: translateX(-15.5%) translateY(11.5%) scale(0.95);
    }
}

@media (max-width: 991px) {
    .header-2::before {
        display: none;
    }
}

/* Ensure the red block goes all the way to the edge */
.mega-menu-wrapper {
    overflow: visible;
}

/* Mobile: .flooring-image visível (pedreira) - override height:100% do main.css */
.flooring-image {
    display: block !important;
}

.flooring-image img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
}

@media (max-width: 991px) {
    .flooring-image {
        display: block !important;
        min-height: 280px;
    }

    .flooring-image img {
        width: 100% !important;
        height: auto !important;
        min-height: 280px;
        object-fit: cover;
    }
}

/* Mobile: .feature-bg-image-style-3 visível (secção impacto) */
.feature-bg-image-style-3,
.feature-bg-image-style-3 img {
    display: block !important;
}

@media (max-width: 767px) {
    .feature-bg-image-style-3 {
        display: block !important;
        overflow: hidden;
        height: 500px !important;
    }

    .feature-bg-image-style-3 img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
    }
}

/* Galeria: overlay com cor vermelha do tema em vez de laranja */
.gallery-card-item-inner .gallery-image::before,
.gallery-card-item .gallery-image::before {
    background: rgba(192, 12, 27, 0.68) !important;
}

.gallery-card-item-inner:hover .gallery-image::before,
.gallery-card-item:hover .gallery-image::before {
    background: rgba(192, 12, 27, 0.68) !important;
}



.header__hamburger .contact-btn {
    padding: 0 !important;
    min-width: auto !important;
    width: auto !important;
    background: transparent !important;
    color: #fff !important;

    border: none;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

.header__hamburger .sidebar__toggle .header-bar span {
    display: block;
    background-color: #fff !important;
    width: 35px;
    height: 2px;
}

.header__hamburger .sidebar__toggle .header-bar span:not(:last-child) {
    margin-bottom: 8px;
}

.header__hamburger .sidebar__toggle .header-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.header__hamburger .sidebar__toggle {
    margin-left: 0 !important;
    width: 40px;
}

/* Fix: Service icon size - limitar ao tamanho original do tema (83x83) */
.service-box-item-3-style-3 .top-item .icon img {
    width: 83px;
    height: 83px;
    max-width: 83px;
    max-height: 83px;
    object-fit: contain;
}

/* Fix: Service cards equal height - swiper slides */
.service-slider-2 .swiper-wrapper {
    align-items: stretch;
}

.service-slider-2 .swiper-slide {
    height: auto !important;
}

.service-box-item-3-style-3 {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    padding-bottom: 30px !important;
}

.service-box-item-3-style-3 .top-item {
    flex: 1;
}

.service-box-item-3-style-3 .list-item {
    margin-top: auto;
    padding: 0 22px;
}

/* Fix: Service-slider (section 1) cards equal height */
.service-slider .swiper-wrapper {
    align-items: stretch;
}

.service-slider .swiper-slide {
    height: auto !important;
}

.service-card-items-style-2 {
    height: 100%;
}

.service-card-items-style-2 .service-image {
    height: 100%;
}

/* Fix: Service-slider (section 1) - taller cards, icon centered mid-card */
.service-slider .swiper-slide .service-card-items-style-2 .service-image .hover-img {
    height: 420px !important;
}

.service-card-items-style-2 .service-image .service-content {
    position: absolute;
    left: 30px;
    right: 30px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 30px;
    z-index: 99;
}

.service-card-items-style-2 .service-image .service-content .icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin-bottom: 15px;
}

.service-card-items-style-2 .service-image .service-content .icon img {
    width: 45px !important;
    height: 45px !important;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.service-card-items-style-2:hover .service-image .service-content .icon {
    background-color: var(--header);
}

/* Fix: Service section overflow visible for cards not being cut */
.service-section-3.fix {
    overflow: visible !important;
}

.service-slider-2 {
    overflow: visible !important;
    padding-bottom: 15px;
}

/* Fix: Service slider navigation arrows clickable */
.service-section .section-title-area {
    position: relative;
    z-index: 10;
}

.service-section .array-buttons {
    position: relative;
    z-index: 10;
}

.service-section .array-buttons button {
    cursor: pointer;
    pointer-events: auto;
}

/* Fix: Service detail sidebar content-box vertical center */
.main-sideber .sideber-image .content-box {
    bottom: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, 50%) !important;
    width: 85%;
}

/* Fix: Impact icons equal height */
.impact-icon-item-style-3 {
    height: 100%;
    min-height: 200px;
}

/* Fix: Equipment text overlap (Retroescavadoras) */
.project-card-items.style-3 .project-content h3 {
    font-size: 20px;
    /* Reduced from default to fit 'Retroescavadoras' */
    word-break: break-word;
}

@media (min-width: 1200px) {
    .project-card-items.style-3 .project-content h3 {
        font-size: 18px;
        /* Further reduce on smaller XL screens if needed */
    }
}

/* Hero title styling - CONSTROÍ above FOLHADA with indent */
.hero-section .hero-content h1 {
    display: block !important;
    line-height: 0.9;
}

.hero-section .hero-content h1 .line-folhada {
    display: block;
    padding-left: 5.5rem;
    /* Exact alignment: F under T */
    margin-top: 0;
}

/* Fix: Hide desktop nav on mobile - meanmenu unreliable on homepage */
@media (max-width: 1199px) {
    nav#mobile-menu {
        display: none !important;
    }
}

/* Offcanvas content padding bottom */
.offcanvas__content {
    padding-bottom: 40px !important;
}

/* Fix: Offcanvas title (company name) não cabe em mobile */
.offcanvas-title {
    word-break: break-word;
    line-height: 1.2;
}

@media (max-width: 575px) {
    .offcanvas-title {
        font-size: 24px !important;
        margin-bottom: 10px !important;
    }

    .offcanvas__top {
        flex-wrap: wrap;
        gap: 10px;
    }

    .offcanvas__logo {
        flex: 0 0 auto;
    }

    .offcanvas__close {
        flex: 0 0 auto;
    }
}

/* Offcanvas fallback nav styling */
.offcanvas-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.offcanvas-nav ul li {
    border-bottom: 1px solid #e0e3ed;
}

.offcanvas-nav ul li:last-child {
    border-bottom: none;
}

.offcanvas-nav ul li a {
    display: block;
    padding: 12px 0;
    color: #414141;
    font-size: 16px;
    font-weight: 500;
    font-family: "Barlow", sans-serif;
    text-decoration: none;
    transition: color 0.3s ease;
}

.offcanvas-nav ul li a:hover {
    color: var(--theme);
}

.offcanvas-submenu {
    list-style: none;
    padding: 0 0 0 15px;
    margin: 0;
    display: none;
}

.offcanvas-has-sub.open .offcanvas-submenu {
    display: block;
}

.offcanvas-has-sub.open .offcanvas-toggle {
    transform: rotate(45deg);
}

.offcanvas-has-sub .offcanvas-parent-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.offcanvas-has-sub .offcanvas-toggle {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.offcanvas-submenu li {
    border-bottom: none !important;
}

.offcanvas-submenu li a {
    padding: 8px 0 !important;
    font-size: 14px !important;
    color: #666 !important;
}

.offcanvas-submenu li a:hover {
    color: var(--theme) !important;
}

@media (max-width: 991px) {
    .header__hamburger .contact-btn {
        color: #191919 !important;
    }

    .header__hamburger .sidebar__toggle .header-bar span {
        background-color: #191919 !important;
    }

}

/* Fix for whitespace below footer */
#smooth-wrapper {
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
}

#smooth-content {
    flex: 1 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
}

.footer-section {
    margin-top: auto !important;
}

/* Responsive Fixes for Counters and Hero */
@media (max-width: 767px) {

    /* Hero Section Adjustments */
    .hero-section .hero-content h1 {
        font-size: 3.5rem !important;
    }

    .hero-section .hero-content h1 .line-folhada {
        padding-left: 2.5rem !important;
        /* Reduced indent for small screens */
    }

    .hero-section .hero-content p {
        font-size: 1.1rem !important;
        max-width: 100% !important;
        /* Better width usage */
        padding-right: 15px;
    }

    /* Counter Section - Force 2x2 grid instead of uneven flex wrap */
    .counter-wrapper-2.style-3 {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 30px 10px !important;
        justify-items: center;
        text-align: center;
    }

    .counter-wrapper-2 .counter-item {
        margin: 0 !important;
        width: 100%;
    }

    .counter-wrapper-2 .counter-item h2 {
        font-size: 36px !important;
    }

    .counter-wrapper-2 .counter-item p {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .hero-section .hero-content h1 {
        font-size: 2.8rem !important;
    }

    .hero-section .hero-content h1 .line-folhada {
        padding-left: 1.5rem !important;
    }

    /* Hero buttons stacking on very small screens */
    .hero-button {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .hero-button .theme-btn-main {
        margin-right: 0 !important;
        width: auto;
    }

    /* Section padding normalization */
    .section-padding {
        padding: 50px 0 !important;
    }
}

/* Ensure no accidental margins at the very bottom */
body,
html {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Fix: Gallery cards equal height for all rows */
.instagram-section-5 .row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.instagram-section-5 .row>[class*="col-"] {
    display: flex;
    align-items: stretch;
}

.instagram-section-5 .instagram-box-style-5,
.instagram-section-5 .instagram-image-style-5 {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

/* Force all gallery cards to have same height regardless of row */
.instagram-section-5 .row>[class*="col-"]>div {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.instagram-section-5 .instagram-image-style-5 img {
    flex: 1;
    object-fit: cover;
}

/* Fix: Testimonial cards equal height in swiper */
.testimonial-slider-3 {
    height: auto !important;
}

.testimonial-slider-3 .swiper-wrapper {
    align-items: stretch !important;
    display: flex !important;
    height: auto !important;
}

.testimonial-slider-3 .swiper-slide {
    height: auto !important;
    display: flex !important;
    align-items: stretch !important;
}

.testimonial-slider-3 .swiper-slide>div {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.testimonial-card-items-style-3 {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
    min-height: 100% !important;
}

.testimonial-card-items-style-3 .star {
    flex-shrink: 0;
}

.testimonial-card-items-style-3 h5 {
    flex-shrink: 0;
}

.testimonial-card-items-style-3 p {
    flex-grow: 1 !important;
    flex-shrink: 0;
    margin-bottom: 0 !important;
    margin-top: 20px !important;
    min-height: 0 !important;
}

/* Override main.css margin-bottom that causes height differences */
.testimonial-card-items-style-3 p {
    margin-bottom: 0 !important;
}

@media (max-width: 1399px) {
    .testimonial-card-items-style-3 p {
        margin-bottom: 0 !important;
    }
}

/* Navbar: dropdown "Obras" – imagens das categorias com tamanho igual (normalizado) */
.header-main .main-menu ul li .has-homemenu .homemenu-items .homemenu .homemenu-thumb {
    aspect-ratio: 4/3;
    overflow: hidden;
}

.header-main .main-menu ul li .has-homemenu .homemenu-items .homemenu .homemenu-thumb .navbar-obras-dropdown-category-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lista de obras (/projectos): diferenciar categoria vs título no hover do card */
.project-section-inner .project-box-items-style-2 .project-image .content h3 a {
    display: block;
}

.project-section-inner .project-box-items-style-2 .project-image .content .project-card-category-line {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25em;
    line-height: 1.3;
}

.project-section-inner .project-box-items-style-2 .project-image .content .project-card-category-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-shrink: 0;
    order: -1;
    object-fit: contain;
    opacity: 0.95;
    vertical-align: middle;
    display: block;
    position: relative;
    z-index: 1;
}

.project-section-inner .project-box-items-style-2 .project-image .content .project-card-category {
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.9;
}

.project-section-inner .project-box-items-style-2 .project-image .content .project-card-title {
    display: block;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.25;
}

/* Lista de projetos (/projectos): em mobile, mostrar título e seta sempre visíveis
   para que o primeiro toque abra o detalhe da obra (evitar dois toques) */
@media (max-width: 767px) {
    .project-section-inner .project-box-items-style-2 .project-image::before {
        opacity: 1;
        visibility: visible;
        z-index: 2;
    }

    .project-section-inner .project-box-items-style-2 .project-image .content {
        left: 20px;
        bottom: 20px;
        opacity: 1;
        visibility: visible;
        z-index: 3;
    }

    .project-section-inner .project-box-items-style-2 .project-image .arrow {
        right: 20px;
        top: 20px;
        opacity: 1;
        visibility: visible;
        z-index: 3;
    }
}

/* Fix: Project detail page headings centered */
.project-detail-page h3.text-center {
    text-align: center !important;
}

/* Force center alignment for project detail headings */
.project-detail-page .row .col-12 h3.mb-4 {
    text-align: center !important;
}

/* Specifically target gallery and location headings */
.project-detail-page h3.mb-4.text-center {
    text-align: center !important;
    width: 100%;
    display: block;
}

/* Vídeo do hero: popup expandido (Magnific Popup) */
.mfp-wrap.mfp-video-expanded .mfp-content {
    max-width: 90vw;
    width: 90vw;
    max-height: 90vh;
    height: 90vh;
}

.mfp-wrap.mfp-video-expanded .mfp-iframe-scaler {
    padding-top: 0;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.mfp-wrap.mfp-video-expanded .mfp-iframe-scaler iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Fix: Contact page section headings centered */
.contact-page-section .section-title h2 {
    text-align: center !important;
}

/* Fix: Contact info wrapper centrado (orçamento e contactos) */
.contact-info-wrapper {
    padding-left: 0 !important;
}

@media (max-width: 991px) {
    .contact-info-wrapper {
        margin-top: 30px;
    }
}

/* Fix File Manager: Move modal z-index when image preview is open */
/* When preview modal is open and move modal opens, ensure move modal is on top */
/* Target both the modal container and overlay */
.fi-modal[data-modal-id*="move-modal"],
.fi-modal[data-modal-id*="embedded-move-modal"],
[data-modal-id*="move-modal"],
[data-modal-id*="embedded-move-modal"] {
    z-index: 10000 !important;
}

/* Ensure move modal overlay is above preview modal overlay */
.fi-modal-overlay[data-modal-id*="move-modal"],
.fi-modal-overlay[data-modal-id*="embedded-move-modal"] {
    z-index: 9999 !important;
}

/* Preview modal should have lower z-index when move modal is open */
/* Using :has() selector for modern browsers, with fallback */
.fi-modal-open:has([data-modal-id*="move-modal"]) [data-modal-id*="preview-modal"],
.fi-modal-open:has([data-modal-id*="embedded-move-modal"]) [data-modal-id*="embedded-preview-modal"] {
    z-index: 9998 !important;
}

/* Fallback: when move modal exists, lower preview modal z-index */
body:has([data-modal-id*="move-modal"]) [data-modal-id*="preview-modal"],
body:has([data-modal-id*="embedded-move-modal"]) [data-modal-id*="embedded-preview-modal"] {
    z-index: 9998 !important;
}