/* Mobile Global Styles - Header & Footer Responsive */

@media (max-width: 767px) {
    /* Header navbar centrado */
    .navbar:first-of-type > div {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        width: 100%;
    }

    .navbar:first-of-type .navbar-toggler {
        position: absolute;
        left: 1rem;
        z-index: 10;
    }

    /* Ocultar toggle dark mode en mobile */
    .navbar .hide-theme-dark,
    .navbar .hide-theme-light,
    .navbar [data-bs-theme-value] {
        display: none !important;
    }

    /* Logo spacing */
    .navbar a img {
        margin-top: 0.4rem;
        margin-bottom: 0.4rem;
    }

    /* Fix layout para scroll y footer visible - Romper flex de Tabler */
    .page,
    .page-wrapper,
    .page-body,
    .page-body > .container-xl,
    .container-xl {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        position: static !important;
        flex: none !important;
    }

    html {
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    body {
        height: auto !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Alinear títulos y contenido con hamburger (1rem) */
    .page-header,
    .page-title,
    .page-body > .container-xl,
    .container-xl {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    h1, h2.page-title, .page-header h1 {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    /* Formularios oficina - columnas responsive */
    .form-oficina .row.form-oficina-fields {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem;
    }

    .form-oficina .form-oficina-fields > .col-4 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .form-oficina .form-oficina-fields > .col-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Footer visible */
    .footer {
        display: block !important;
        position: static !important;
        padding: 1.5rem 1rem;
        text-align: center;
        background: var(--tblr-body-bg);
    }

    /* Streaming dashboard - charts swipe horizontal */
    .mobile-swipe-charts {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 0.75rem;
        padding-bottom: 0.5rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-swipe-charts::-webkit-scrollbar {
        display: none;
    }

    .mobile-swipe-charts > .col-4 {
        flex: 0 0 85% !important;
        max-width: 85% !important;
        scroll-snap-align: start;
    }

    /* Battery y tabla - layout normal apilado */
    .mobile-fixed-row {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

    .mobile-fixed-row > .col-12,
    .mobile-fixed-row > .col-md-8,
    .mobile-fixed-row > .col-md-4 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Profile page - cards 100% width apiladas */
    .profile-page-content .row-deck.row-cards {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem;
    }

    .profile-page-content .col-5,
    .profile-page-content .col-7 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Profile forms - espaciado consistente como Invoicing */
    .profile-page-content .card-body .row {
        margin-bottom: 0 !important;
        margin-top: 0 !important;
    }

    .profile-page-content .card-body .row > div[class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Labels con mismo margin que Invoicing: 16px 0 4px */
    .profile-page-content .card-body label,
    .profile-page-content .card-body .form-label {
        margin: 16px 0 4px !important;
        display: block !important;
    }

    /* Primera label después del h2 */
    .profile-page-content .card-body h2 {
        margin-bottom: 0 !important;
    }

    /* Botón submit con margin top */
    .profile-page-content .card-body .btn,
    .profile-page-content .card-body button[type="submit"] {
        margin-top: 1.75rem !important;
    }

    .profile-card .form-label-col {
        margin-top: 0.75rem;
    }

    /* Dify chat widget - asegurar visibilidad sin forzar apertura */
    #dify-chatbot-bubble-button,
    .dify-chatbot-bubble-button {
        position: fixed !important;
        z-index: 9999 !important;
        overflow: visible !important;
    }

    #dify-chatbot-bubble-window,
    .dify-chatbot-bubble-window {
        z-index: 9998 !important;
    }

    /* Checkboxes alineados horizontalmente */
    .profile-alerts-section .row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
    }

    .profile-alerts-section .row .col-md-2 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

    .profile-alerts-section .row .col-md-1 {
        flex: 0 0 auto !important;
        max-width: none !important;
        width: auto !important;
        padding-right: 0.5rem;
    }

    .profile-alerts-section .row .col-md-9 {
        flex: 1 !important;
        max-width: none !important;
    }

    .profile-alerts-section .row .col-md-1,
    .profile-alerts-section .row .col-md-9 {
        display: flex;
        align-items: flex-start;
    }
}
