/* Mobile-first UX — Cerrajeros Profesionales */

:root {
    --brand: #eb9e00;
    --brand-dark: #ca6017;
    --call-bar-h: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    -webkit-tap-highlight-color: rgba(235, 158, 0, 0.2);
}

/* ── Barra fija de llamada (móvil) ── */
.mobile-call-bar {
    display: none;
}

@media (max-width: 767px) {
    body {
        padding-bottom: calc(var(--call-bar-h) + var(--safe-bottom) + 8px);
    }

    .mobile-call-bar {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        padding: 0 0 var(--safe-bottom);
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.12) 100%);
        pointer-events: none;
    }

    .mobile-call-bar__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin: 0 10px 10px;
        padding: 14px 18px;
        background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
        color: #fff !important;
        font-weight: 800;
        font-size: 17px;
        line-height: 1.2;
        text-decoration: none !important;
        border-radius: 14px;
        box-shadow: 0 6px 24px rgba(202, 96, 23, 0.45);
        pointer-events: auto;
        min-height: 52px;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .mobile-call-bar__btn:active {
        transform: scale(0.98);
        box-shadow: 0 3px 12px rgba(202, 96, 23, 0.35);
    }

    .mobile-call-bar__badge {
        flex-shrink: 0;
        background: #fff;
        color: var(--brand-dark);
        font-size: 11px;
        font-weight: 800;
        padding: 4px 8px;
        border-radius: 6px;
        letter-spacing: 0.04em;
    }

    .mobile-call-bar__label {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-call-bar__number {
        font-size: 18px;
        letter-spacing: 0.02em;
    }

    /* Ocultar botón flotante duplicado */
    .scroll-to-top {
        display: none !important;
    }

    /* ── Cabecera móvil unificada ── */
    .site-header {
        position: sticky;
        top: 0;
        z-index: 900;
        background: #fff;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
        padding: 0 !important;
        width: 100% !important;
        margin-bottom: 0;
    }

    .site-header-bar {
        display: grid;
        grid-template-columns: 48px 1fr auto;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        min-height: 60px;
    }

    /* Botón menú personalizado */
    .site-header-menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        grid-column: 1;
        margin: 0 !important;
        padding: 0 !important;
        width: 48px;
        height: 48px;
        border: none !important;
        border-radius: 12px !important;
        background: #fff8ee !important;
        float: none !important;
    }

    .site-header-menu__icon {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 22px;
        height: 18px;
    }

    .site-header-menu__icon span {
        display: block;
        height: 3px;
        width: 100%;
        background: var(--brand-dark);
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }

    .site-header-menu:not(.collapsed) .site-header-menu__icon span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .site-header-menu:not(.collapsed) .site-header-menu__icon span:nth-child(2) {
        opacity: 0;
    }

    .site-header-menu:not(.collapsed) .site-header-menu__icon span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .site-navbar-desktop-toggle {
        display: none !important;
    }

    /* Logo centrado */
    .site-header-logo {
        grid-column: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        text-decoration: none !important;
    }

    .site-header-logo .logo,
    .site-header-logo .logo:hover {
        max-width: min(200px, 100%) !important;
        max-height: 44px;
        width: auto;
        height: auto;
        padding: 0 !important;
        margin: 0 auto;
        object-fit: contain;
    }

    /* Botón llamar */
    .site-header-call {
        grid-column: 3;
        position: relative;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 14px !important;
        font-weight: 800 !important;
        padding: 0 14px !important;
        min-height: 48px;
        border-radius: 12px !important;
        white-space: nowrap;
        box-shadow: 0 4px 14px rgba(202, 96, 23, 0.35);
        overflow: hidden;
    }

    .site-header-call__pulse {
        position: absolute;
        inset: 0;
        background: rgba(255, 255, 255, 0.15);
        animation: header-call-pulse 2s ease-in-out infinite;
        pointer-events: none;
    }

    @keyframes header-call-pulse {
        0%, 100% { opacity: 0; }
        50% { opacity: 1; }
    }

    .site-header-call i {
        font-size: 15px;
        position: relative;
        z-index: 1;
    }

    .site-header-call__text {
        position: relative;
        z-index: 1;
        letter-spacing: 0.01em;
    }

    /* Franja de confianza */
    .site-header-trust {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin: 0;
        padding: 8px 14px;
        background: linear-gradient(90deg, #fff8ee 0%, #fff 50%, #fff8ee 100%);
        border-top: 1px solid #f5ead6;
        border-bottom: 1px solid #f0f0f0;
        font-size: 12px;
        font-weight: 700;
        color: #666;
        letter-spacing: 0.02em;
        text-align: center;
        line-height: 1.3;
    }

    .site-header-trust__dot {
        flex-shrink: 0;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #2ecc71;
        box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25);
        animation: trust-dot-blink 2s ease-in-out infinite;
    }

    @keyframes trust-dot-blink {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
    }

    /* Panel menú desplegable */
    #header .site-navbar {
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none;
        background: #fff;
    }

    #header .site-navbar .navbar-collapse {
        display: none !important;
        width: 100% !important;
        padding: 0;
        border-top: none;
        max-height: none;
        overflow: hidden;
        box-shadow: none;
    }

    #header .site-navbar .navbar-collapse.in,
    #header .site-navbar .navbar-collapse.collapsing {
        display: block !important;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #f0f0f0;
    }

    #header .site-navbar .navbar-collapse.collapsing {
        overflow: hidden;
    }

    #header .site-navbar .main-menu {
        display: block !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        margin: 0 !important;
        float: none !important;
    }

    #header .site-navbar .main-menu > li {
        display: block !important;
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }

    #header .site-navbar .main-menu > li > a {
        display: flex;
        align-items: center;
        width: 100%;
        font-size: 17px !important;
        padding: 15px 18px !important;
        min-height: 52px;
        color: #333 !important;
        border-bottom: 1px solid #f5f5f5;
        white-space: normal !important;
        transition: background 0.15s ease, padding-left 0.15s ease;
    }

    #header .site-navbar .main-menu > li:last-child > a {
        border-bottom: none;
    }

    #header .site-navbar .main-menu > li > a:active {
        background: #fff8ee;
        padding-left: 22px !important;
    }

    #header .site-navbar .main-menu > li.active > a {
        background: #fff8ee;
        color: var(--brand-dark) !important;
        border-left: 4px solid var(--brand);
        font-weight: 800;
    }

    #header .site-navbar .nav-social {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin: 0 !important;
        float: none !important;
        background: #fafafa;
        padding: 14px 0;
        border-top: 1px solid #eee;
    }

    #header .site-navbar .nav-social > li {
        float: none !important;
        padding: 0 !important;
    }

    #header .site-navbar .nav-social > li > a {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        padding: 0 !important;
        font-size: 20px !important;
        border-radius: 12px;
    }

    #header .site-navbar .nav > li {
        padding: 0 !important;
    }

    .navbar .navbar-nav > li > a {
        font-size: 17px !important;
        padding: 15px 18px !important;
    }

    .nav-mobile-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin: 14px 16px 16px;
        padding: 16px 18px;
        background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
        color: #fff !important;
        font-weight: 800;
        font-size: 16px;
        border-radius: 12px;
        text-decoration: none !important;
        box-shadow: 0 4px 16px rgba(202, 96, 23, 0.3);
        min-height: 52px;
    }

    .nav-mobile-cta:active {
        transform: scale(0.98);
    }

    /* Espacio bajo header sticky */
    .site-header + .container.blanco {
        padding-top: 4px;
    }

    /* ── Tipografía y contenido ── */
    h1 {
        font-size: 28px !important;
        line-height: 1.2 !important;
        word-wrap: break-word;
    }

    h2 {
        font-size: 20px !important;
        padding: 10px 14px !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 18px !important;
    }

    body,
    .content-page {
        font-size: 17px;
        line-height: 1.6;
    }

    .container.blanco {
        padding-left: 12px;
        padding-right: 12px;
    }

    .padding {
        padding: 12px !important;
    }

    .espacio {
        padding: 16px !important;
    }

    .telefonollama {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-size: 22px !important;
        padding: 14px 20px !important;
        min-height: 52px;
        width: 100%;
        max-width: 100%;
        text-align: center;
        border-radius: 12px;
        background: #fff8ee;
        border: 2px solid var(--brand);
    }

    /* Formularios — evita zoom iOS y mejora tacto */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="submit"],
    textarea,
    select,
    .form-control {
        font-size: 16px !important;
        min-height: 48px;
        padding: 12px 14px !important;
        border-radius: 8px;
    }

    .btn,
    .btn-danger,
    .btn-default {
        font-size: 16px !important;
        min-height: 48px;
        padding: 12px 16px !important;
        border-radius: 8px;
        line-height: 1.3;
    }

    .btn-block {
        margin-bottom: 10px;
    }

    /* Enlaces en listas — área táctil amplia */
    .col-sm-4,
    .col-sm-6,
    .col-sm-3,
    .col-sm-12 {
        margin-bottom: 4px;
    }

    .col-sm-4 > a,
    .col-sm-6 > a,
    .col-sm-3 > a,
    .col-sm-12 > a,
    .content-link-list a,
    .table-of-contents a {
        display: block;
        padding: 10px 4px;
        min-height: 44px;
        line-height: 1.4;
    }

    .table-of-contents {
        padding: 12px 14px;
        border-radius: 8px;
        margin-bottom: 16px;
    }

    .table-of-contents ul {
        padding-left: 0;
        margin: 0;
    }

    .table-of-contents li {
        margin-bottom: 4px;
    }

    /* Imágenes */
    .img-responsive {
        max-width: 100%;
        height: auto;
    }

    .espacio img,
    .espacio2 img {
        max-width: 180px;
    }

    #map {
        height: 280px !important;
    }

    /* Sidebar en landings — va debajo del contenido */
    .col-sm-8,
    .col-sm-4,
    .col-sm-7,
    .col-sm-5 {
        width: 100%;
        float: none;
    }

    .col-sm-4.padding.blanco {
        margin-top: 20px;
        border-top: 3px solid var(--brand);
        padding-top: 20px !important;
    }

    .centra {
        padding: 24px 0 !important;
    }

    /* Cookie banner */
    #layerAcceptCookie {
        left: 10px;
        right: 10px;
        bottom: calc(var(--call-bar-h) + var(--safe-bottom) + 14px);
        max-width: none;
        border-radius: 12px;
    }

    #layerAcceptCookie .close-ck {
        display: block;
        margin-top: 12px;
        padding: 12px 16px;
        background: var(--brand);
        color: #fff;
        text-align: center;
        font-weight: 800;
        border-radius: 8px;
        min-height: 48px;
        line-height: 1.3;
    }

    /* Footer */
    #footer .col-sm-3 {
        width: 100%;
        margin-bottom: 8px;
        padding: 16px 12px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    #footer .col-sm-3:last-child {
        border-bottom: none;
    }

    #footer a {
        display: inline-block;
        padding: 6px 0;
        min-height: 36px;
    }

    /* Guías hub */
    .guias-hero-title {
        font-size: 26px !important;
    }

    .guias-hero-lead {
        font-size: 16px !important;
    }

    .guia-card-title {
        font-size: 18px !important;
    }

    /* Provincias / comunidades */
    .provincia-muni-item,
    .comunidad-prov-card {
        width: 100% !important;
    }

    .prov-muni-search,
    .comunidades-search-wrap input {
        font-size: 16px !important;
        min-height: 48px;
    }

    /* Breadcrumbs */
    .breadcrumb {
        font-size: 14px;
        flex-wrap: wrap;
    }
}

@media (max-width: 380px) {
    .mobile-call-bar__number {
        font-size: 16px;
    }

    .site-header-call__text {
        display: none;
    }

    .site-header-call {
        width: 48px;
        padding: 0 !important;
    }

    .site-header-call i {
        font-size: 18px;
    }

    .site-header-trust {
        font-size: 11px;
        padding: 7px 10px;
    }
}

@media (min-width: 768px) {
    .site-header {
        position: static;
        box-shadow: none;
        padding-left: 15px;
        padding-right: 15px;
    }

    .site-header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0;
        min-height: auto;
    }

    .site-header-menu {
        display: none !important;
    }

    .site-header-logo {
        flex: 0 0 auto;
        justify-content: flex-start;
    }

    .site-header-logo .logo,
    .site-header-logo .logo:hover {
        max-width: 390px !important;
        max-height: none;
        padding: 40px 0 20px 40px !important;
    }

    .site-header-call {
        margin-top: 20px;
        font-size: 38px !important;
        padding: 10px 20px !important;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .site-header-call__pulse {
        display: none;
    }

    .site-header-trust {
        display: none;
    }

    .site-navbar-desktop-toggle {
        display: none !important;
    }

    .nav-mobile-cta {
        display: none !important;
    }
}
