/**
 * AquaPrime - Mobile App Shell (native-like UI)
 */

/* Investidor cards — base (mobile + desktop) */
.investidor-tanks-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.investidor-tank-card {
    background: #fff;
    border-radius: 20px;
    padding: 18px 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.investidor-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 50px;
    overflow: hidden;
}

.investidor-progress-fill {
    height: 100%;
    background: var(--ap-gradient);
    border-radius: 50px;
    min-width: 4px;
}

@media (max-width: 991.98px) {

    /* Layout base — evita quebra horizontal */

    body.aquaprime-mobile-app,

    body.aquaprime-mobile-view {

        overflow-x: hidden;

        max-width: 100vw;

        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;

    }



    body.aquaprime-mobile-app .wrapper,

    body.aquaprime-mobile-view .wrapper {

        overflow-x: hidden;

        max-width: 100%;

    }



  body.layout-fixed .wrapper,

    body.layout-fixed .content-wrapper,

    body.layout-fixed .main-sidebar {

        transform: none !important;

        -webkit-transform: none !important;

    }



    body.sidebar-open .mobile-bottom-nav,

    body.sidebar-collapse .mobile-bottom-nav,

    body.sidebar-mini .mobile-bottom-nav,

    #aquaprimeMobileNav {

        display: flex !important;

        visibility: visible !important;

        opacity: 1 !important;

        position: fixed !important;

        bottom: 0 !important;

        left: 0 !important;

        right: 0 !important;

        z-index: 2147483646 !important;

        pointer-events: auto !important;

    }



    .mobile-bottom-nav {

        height: auto;

        min-height: 56px;

        backdrop-filter: blur(14px);

        -webkit-backdrop-filter: blur(14px);

        background: rgba(255, 255, 255, 0.98) !important;

        box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.12);

    }



    /* Menu superior horizontal (cliente) */
    .mobile-top-tabs {
        margin: 0 0 12px;
        padding: 0;
        overflow: hidden;
        width: 100%;
    }

    .mobile-top-tabs-track {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 4px 2px 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        width: 100%;
    }

    .mobile-top-tabs-track::-webkit-scrollbar {
        display: none;
    }

    .ap-mobile-only {
        display: block !important;
    }



    .mobile-top-tab {

        flex: 0 0 auto;

        display: flex;

        align-items: center;

        gap: 8px;

        padding: 10px 16px;

        border-radius: 50px;

        background: #fff;

        border: 2px solid #e2e8f0;

        color: #475569;

        font-size: 13px;

        font-weight: 700;

        text-decoration: none;

        scroll-snap-align: start;

        white-space: nowrap;

        transition: all 0.25s ease;

        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);

    }



    .mobile-top-tab i {

        font-size: 15px;

        color: var(--ap-primary-light);

    }



    .mobile-top-tab.active {

        background: var(--ap-gradient);

        border-color: transparent;

        color: #fff;

        box-shadow: 0 6px 20px rgba(12, 74, 110, 0.35);

    }



    .mobile-top-tab.active i {

        color: #fff;

    }



    /* App shell — cliente */

    body.aquaprime-mobile-app .content-header {

        padding-top: 8px;

        padding-bottom: 4px;

    }



    body.aquaprime-mobile-app .content {

        padding-bottom: 8px;

    }



    body.aquaprime-mobile-app .main-header {

        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);

    }



    /* KPI horizontal scroll */

    .mobile-kpi-scroll {

        display: flex;

        gap: 12px;

        overflow-x: auto;

        padding-bottom: 8px;

        scroll-snap-type: x mandatory;

        -webkit-overflow-scrolling: touch;

        margin-bottom: 16px;

    }



    .mobile-kpi-scroll::-webkit-scrollbar {

        display: none;

    }



    .mobile-kpi-scroll .kpi-card {

        flex: 0 0 44%;

        min-width: 44%;

        scroll-snap-align: start;

        margin-bottom: 0;

        padding: 14px 12px;

    }



    .mobile-kpi-scroll .kpi-value {

        font-size: 1.35rem !important;

    }



    .mobile-kpi-scroll .kpi-label {

        font-size: 10px;

    }



    .mobile-kpi-scroll .kpi-icon {

        width: 36px;

        height: 36px;

        font-size: 16px;

    }



    /* Hero app */

    .app-mobile-hero {

        background: var(--ap-gradient);

        color: #fff;

        border-radius: 20px;

        padding: 20px 18px;

        margin-bottom: 16px;

        box-shadow: 0 8px 24px rgba(12, 74, 110, 0.25);

    }



    .app-hero-row {

        display: flex;

        align-items: flex-start;

        justify-content: space-between;

        gap: 12px;

    }



    .app-mobile-hero h2 {

        font-size: 1.35rem;

        font-weight: 800;

        margin: 0 0 4px;

        color: #fff;

    }



    .app-mobile-hero p {

        margin: 0;

        opacity: 0.9;

        font-size: 13px;

    }



    .app-hero-preco {

        background: rgba(255, 255, 255, 0.18);

        border-radius: 14px;

        padding: 10px 12px;

        text-align: center;

        flex-shrink: 0;

        border: 1px solid rgba(255, 255, 255, 0.25);

    }



    .hero-preco-label {

        display: block;

        font-size: 10px;

        opacity: 0.9;

        font-weight: 600;

        margin-bottom: 2px;

    }



    .app-hero-preco strong {

        font-size: 15px;

        font-weight: 800;

    }



    /* Investidor — cards tanque */

    .investidor-tanks-grid {

        display: flex;

        flex-direction: column;

        gap: 14px;

    }



    .investidor-tank-card {

        background: #fff;

        border-radius: 20px;

        padding: 18px 16px;

        border: 1px solid #f1f5f9;

        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);

    }



    .investidor-tank-header {

        display: flex;

        align-items: flex-start;

        justify-content: space-between;

        gap: 10px;

        margin-bottom: 16px;

    }



    .investidor-tank-title {

        display: flex;

        align-items: center;

        gap: 12px;

        min-width: 0;

    }



    .investidor-tank-icon {

        width: 44px;

        height: 44px;

        border-radius: 14px;

        background: var(--ap-gradient);

        color: #fff;

        display: flex;

        align-items: center;

        justify-content: center;

        font-size: 18px;

        flex-shrink: 0;

    }



    .investidor-tank-title h3 {

        font-size: 16px;

        font-weight: 800;

        margin: 0 0 4px;

        color: var(--ap-dark);

        line-height: 1.2;

    }



    .species-badge {

        display: inline-flex;

        align-items: center;

        gap: 5px;

        font-size: 11px;

        font-weight: 700;

        color: #059669;

        background: rgba(16, 185, 129, 0.12);

        padding: 3px 10px;

        border-radius: 50px;

    }



    .species-badge i {

        font-size: 10px;

    }



    .investidor-progress-block {

        margin-bottom: 14px;

    }



    .investidor-progress-label {

        display: flex;

        justify-content: space-between;

        align-items: center;

        font-size: 12px;

        color: #64748b;

        margin-bottom: 6px;

        gap: 8px;

    }



    .investidor-progress-label strong {

        color: var(--ap-dark);

        font-size: 12px;

        font-weight: 800;

    }



    .investidor-progress-bar {

        height: 8px;

        background: #e2e8f0;

        border-radius: 50px;

        overflow: hidden;

    }



    .investidor-progress-fill {

        height: 100%;

        background: var(--ap-gradient);

        border-radius: 50px;

        transition: width 0.6s ease;

    }



    .investidor-progress-bar.bar-racao .investidor-progress-fill {

        background: linear-gradient(90deg, #10b981, #34d399);

    }



    .investidor-progress-hint {

        display: block;

        margin-top: 6px;

        font-size: 11px;

        color: #94a3b8;

    }



    .investidor-stats {

        display: grid;

        grid-template-columns: 1fr 1fr;

        gap: 10px;

        margin-bottom: 14px;

    }



    .investidor-stat {

        background: #f8fafc;

        border-radius: 14px;

        padding: 12px 10px;

        text-align: center;

        border: 1px solid #f1f5f9;

    }



    .investidor-stat .stat-value {

        font-weight: 800;

        font-size: 17px;

        line-height: 1.2;

        color: var(--ap-dark);

    }



    .investidor-stat .stat-value small {

        font-size: 12px;

        font-weight: 700;

        opacity: 0.7;

    }



    .investidor-stat .stat-label {

        font-size: 10px;

        color: #64748b;

        margin-top: 4px;

        font-weight: 600;

        text-transform: uppercase;

        letter-spacing: 0.02em;

    }



    .investidor-stat.stat-profit .stat-value {

        color: #10b981;

        font-size: 15px;

    }



    .investidor-stat.score-high .stat-value { color: #10b981; }

    .investidor-stat.score-mid .stat-value { color: #f59e0b; }

    .investidor-stat.score-low .stat-value { color: #ef4444; }



    .investidor-chips {

        display: flex;

        flex-wrap: wrap;

        gap: 8px;

    }



    .investidor-chip {

        display: inline-flex;

        align-items: center;

        gap: 6px;

        font-size: 11px;

        font-weight: 600;

        color: #475569;

        background: #f1f5f9;

        padding: 6px 12px;

        border-radius: 50px;

    }



    .investidor-chip i {

        color: var(--ap-primary-light);

        font-size: 10px;

    }



    /* Páginas módulos — mobile */

    .feature-hero {

        padding: 22px 18px !important;

        margin-bottom: 16px !important;

        border-radius: 18px !important;

    }



    .feature-hero h2 {

        font-size: 1.25rem !important;

    }



    .feature-hero p {

        font-size: 13px !important;

    }



    .feature-hero .hero-icon {

        font-size: 36px !important;

        right: 16px !important;

    }



    .mobile-page-toolbar {

        display: flex;

        flex-direction: column;

        gap: 10px;

        margin-bottom: 16px;

    }



    .mobile-page-toolbar .btn {

        width: 100%;

    }



    /* Tabelas responsivas */

    .ap-table-scroll {

        overflow-x: auto;

        -webkit-overflow-scrolling: touch;

        margin: 0 -4px;

        padding: 0 4px;

        max-width: 100%;

    }



    .ap-table-scroll .table-premium {

        min-width: 520px;

        font-size: 12px;

    }



    .ap-table-scroll .table-premium thead th {

        font-size: 10px;

        padding: 10px 8px;

    }



    .ap-table-scroll .table-premium tbody td {

        padding: 10px 8px;

    }



    /* Charts */

    .ap-chart-box {

        position: relative;

        height: 220px;

        width: 100%;

        max-width: 100%;

    }



    .ap-chart-box canvas {

        max-height: 220px;

    }



    .card-premium {

        border-radius: 16px;

        margin-bottom: 12px;

    }



    .card-premium .card-header {

        flex-wrap: wrap;

        gap: 8px;

    }



    .container-fluid {

        padding-left: 12px;

        padding-right: 12px;

        max-width: 100%;

    }



    .row {

        margin-left: -8px;

        margin-right: -8px;

    }



    .row > [class*="col-"] {

        padding-left: 8px;

        padding-right: 8px;

    }



    .campo-header {

        padding: 16px !important;

        margin-bottom: 14px !important;

    }



    .campo-header h2 {

        font-size: 1.2rem !important;

    }



    .campo-grid {

        grid-template-columns: 1fr 1fr;

        gap: 10px;

    }



    .campo-btn {

        padding: 16px 10px;

        border-radius: 16px;

    }



    .campo-btn i {

        font-size: 28px !important;

    }



    .campo-btn span {

        font-size: 12px !important;

    }



    .campo-btn small {

        font-size: 10px !important;

        line-height: 1.2;

    }



    .tanque-selector {

        display: flex;

        flex-direction: column;

        gap: 10px;

        align-items: stretch;

        margin-bottom: 14px;

    }



    .tanque-selector label {

        font-weight: 700;

        font-size: 13px;

    }



    .tanque-selector .form-select,

    .tanque-selector .btn {

        width: 100%;

    }



    .loading-overlay {

        z-index: 2147483647;

    }



    .pwa-install-banner {

        z-index: 2147483645;

        left: 10px;

        right: 10px;

    }



    .pwa-install-inner {

        padding: 12px 14px;

    }



    .pwa-install-text strong {

        font-size: 13px;

    }



    .pwa-install-text span {

        font-size: 11px;

    }



    /* Esconde footer desktop e badges duplicados */

    body.aquaprime-mobile-app .main-footer {

        display: none !important;

    }



    body.aquaprime-mobile-app .campo-header .offline-badge {

        font-size: 10px;

        padding: 4px 10px;

    }



    /* Ajuda mobile */

    .ajuda-layout {

        grid-template-columns: 1fr !important;

        gap: 14px !important;

        min-height: auto !important;

    }



    .ajuda-sidebar {

        position: static !important;

        max-height: none !important;

    }



    .ajuda-tour-grid {

        grid-template-columns: 1fr 1fr !important;

    }

}



@media (min-width: 992px) {

    .investidor-tanks-grid {

        display: grid;

        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));

        gap: 20px;

    }



    .investidor-tank-card {

        padding: 22px 20px;

    }

}

/* ===== PWA SweetAlert Premium ===== */
.pwa-swal-popup {
    border-radius: 24px !important;
    padding: 8px 8px 20px !important;
    max-width: 92vw !important;
}

.pwa-swal-title {
    font-weight: 800 !important;
    font-size: 22px !important;
    color: #0f172a !important;
}

.pwa-modal-premium {
    text-align: center;
    padding: 4px 0;
}

.pwa-modal-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, #0c4a6e, #0ea5e9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 12px 32px rgba(12, 74, 110, 0.35);
}

.pwa-modal-text {
    font-size: 14px;
    color: #64748b;
    line-height: 1.55;
    margin: 0 0 14px;
}

.pwa-modal-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.pwa-modal-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 12px;
}

.pwa-modal-features li i {
    color: #0ea5e9;
    width: 18px;
    text-align: center;
}

.pwa-swal-btn-confirm {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0c4a6e, #0ea5e9) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 14px !important;
    padding: 14px 28px !important;
    font-weight: 800 !important;
    font-size: 15px !important;
    margin: 0 6px !important;
    box-shadow: 0 8px 24px rgba(12, 74, 110, 0.3);
}

.pwa-swal-btn-cancel {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: none !important;
    border-radius: 14px !important;
    padding: 14px 24px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    margin: 0 6px !important;
}

.pwa-manual-steps {
    text-align: left;
    font-size: 14px;
    margin: 12px 0;
    padding-left: 20px;
    color: #475569;
}

@media (min-width: 992px) {
    .ap-mobile-only {
        display: none !important;
    }
}
