/* App-style shell for normal frontend pages (mobile-only activation via JS) */
:root {
    --app-bg-1: #edf8f0;
    --app-bg-2: #f4f7ff;
    --app-card: #ffffff;
    --app-border: #d6e7dd;
    --app-border-strong: #bdd8c8;
    --app-shadow: 0 18px 40px -32px rgba(16, 50, 33, 0.46);
    --app-text: #173527;
    --app-muted: #5c7368;
    --app-primary: #218b4d;
    --app-primary-dark: #165d34;
    --app-primary-soft: #e7f6ed;
    --app-primary-soft-2: #f2fbf5;
    --app-blue-soft: #eef3ff;
    --app-danger-soft: #fff4f6;
    --app-warning-soft: #fff8e7;
    --app-statusbar: #1b7f45;
    --app-nav-h: 64px;
    --app-bottom-h: 70px;
}

html.mobile-app-enhanced {
    overflow-x: hidden;
}

body.mobile-app-view {
    color: var(--app-text);
    background:
        radial-gradient(circle at 8% 8%, rgba(88, 197, 126, 0.18), transparent 32%),
        radial-gradient(circle at 92% 0%, rgba(111, 157, 244, 0.16), transparent 30%),
        linear-gradient(180deg, var(--app-bg-1), var(--app-bg-2));
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-bottom: calc(var(--app-bottom-h) + env(safe-area-inset-bottom) + 10px);
}

body.mobile-app-view,
body.mobile-app-view button,
body.mobile-app-view input,
body.mobile-app-view select,
body.mobile-app-view textarea {
    font-family: "Plus Jakarta Sans", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
}

body.mobile-app-view .container,
body.mobile-app-view .container-fluid {
    max-width: 100%;
    padding-left: 14px;
    padding-right: 14px;
}

body.mobile-app-view main,
body.mobile-app-view section {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}

body.mobile-app-view .card,
body.mobile-app-view .accordion-item,
body.mobile-app-view .modal-content,
body.mobile-app-view .dropdown-menu {
    border-radius: 16px;
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow);
    overflow: hidden;
    background: var(--app-card);
}

body.mobile-app-view .card-header,
body.mobile-app-view .modal-header {
    background: linear-gradient(180deg, rgba(231, 246, 237, 0.7), #ffffff);
    border-bottom: 1px solid #e2eee8;
}

body.mobile-app-view .btn {
    border-radius: 12px;
    font-weight: 700;
    min-height: 42px;
}

body.mobile-app-view .btn-primary,
body.mobile-app-view .btn-success,
body.mobile-app-view .btn-primary-gradient {
    border-color: #197841;
    color: #fff;
    background: linear-gradient(120deg, #26a05a, #197842);
    box-shadow: 0 14px 24px -20px rgba(26, 102, 58, 0.78);
}

body.mobile-app-view .btn-outline-secondary {
    border-color: #b8d1c2;
    color: #224d37;
}

body.mobile-app-view .btn-outline-secondary:hover {
    background: #f1f7f3;
}

body.mobile-app-view .form-control,
body.mobile-app-view .form-select,
body.mobile-app-view input,
body.mobile-app-view select,
body.mobile-app-view textarea {
    border-radius: 12px;
    border-color: #cfdfd6;
    min-height: 42px;
    font-size: 16px;
    line-height: 1.35;
}

body.mobile-app-view .form-control:focus,
body.mobile-app-view .form-select:focus {
    border-color: #4fab75;
    box-shadow: 0 0 0 3px rgba(79, 171, 117, 0.2);
}

body.mobile-app-view .table-responsive {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
}

body.mobile-app-view .table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #355845;
    background: var(--app-primary-soft-2);
    border-bottom-color: #d7e6dc;
}

body.mobile-app-view .table td,
body.mobile-app-view .table th {
    border-color: #e5efe9;
    vertical-align: middle;
}

body.mobile-app-view .breadcrumb {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 0.56rem 0.74rem;
    box-shadow: 0 10px 20px -24px rgba(18, 57, 38, 0.55);
    margin-bottom: 0;
}

body.mobile-app-view .badge {
    border-radius: 999px;
}

body.mobile-app-view .alert {
    border-radius: 14px;
}

body.mobile-app-view .alert-info {
    border-color: #cfe2f2;
    background: linear-gradient(180deg, #eff8ff, #f8fbff);
}

body.mobile-app-view .alert-danger {
    border-color: #f2c9cf;
    background: var(--app-danger-soft);
}

body.mobile-app-view .alert-warning {
    border-color: #f0d89b;
    background: var(--app-warning-soft);
}

body.mobile-app-view .mobile-current-link {
    color: var(--app-primary-dark) !important;
    font-weight: 800 !important;
}

body.mobile-app-view .footer-section {
    margin-top: 1.2rem;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    overflow: hidden;
}

body.mobile-app-view #cookie-banner {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(var(--app-bottom-h) + env(safe-area-inset-bottom) + 10px) !important;
    border: 1px solid var(--app-border-strong) !important;
    border-radius: 14px !important;
    box-shadow: var(--app-shadow);
    z-index: 1091 !important;
}

body.mobile-app-view .messenger-float {
    right: 12px;
    bottom: calc(var(--app-bottom-h) + env(safe-area-inset-bottom) + 14px);
    width: 54px;
    height: 54px;
    z-index: 1089;
}

body.mobile-app-view .messenger-icon {
    width: 54px;
    height: 54px;
}

body.mobile-app-view .mobile-nav {
    background: transparent !important;
    min-height: var(--app-nav-h);
    position: sticky !important;
    top: env(safe-area-inset-top);
    left: auto !important;
    right: auto !important;
    z-index: 1092;
    padding-top: 8px;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

body.mobile-app-view .mobile-nav,
.app-bottom-nav {
    touch-action: manipulation;
}

body.mobile-app-view .mobile-nav > .container-fluid {
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--app-shadow);
    backdrop-filter: saturate(160%) blur(8px);
}

body.mobile-app-view .brand-logo-mobile {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--app-primary-dark) !important;
}

body.mobile-app-view .mobile-nav .btn-outline-light {
    color: var(--app-primary-dark) !important;
    border-radius: 10px;
    background: rgba(231, 246, 237, 0.95) !important;
}

body.mobile-app-view .mobile-nav .btn-outline-light:hover {
    background: rgba(218, 239, 225, 0.95) !important;
}

body.mobile-app-view .mobile-menu-content {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    margin: 8px 12px 0;
    box-shadow: var(--app-shadow);
}

body.mobile-app-view .mobile-user-section a.mobile-menu-btn {
    color: #264d38;
    border-radius: 10px;
    padding: 0.68rem 0.72rem;
}

body.mobile-app-view .mobile-user-section a.mobile-menu-btn:hover {
    background: var(--app-primary-soft-2);
}

body.mobile-app-view .cart-badge {
    border-radius: 999px !important;
}

body.mobile-app-view img {
    max-width: 100%;
    height: auto;
}

.android-app-prompt {
    position: fixed;
    inset: 0;
    z-index: 1110;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 12px calc(var(--app-bottom-h) + env(safe-area-inset-bottom) + 18px);
    background: rgba(14, 32, 21, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.android-app-prompt.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.android-app-prompt__dialog {
    position: relative;
    width: min(100%, 560px);
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--app-border-strong);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 22px 52px -28px rgba(11, 34, 21, 0.72);
    backdrop-filter: saturate(150%) blur(10px);
}

.android-app-prompt__media {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--app-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px #d1eadb;
}

.android-app-prompt__media img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.android-app-prompt__content {
    min-width: 0;
    padding-right: 30px;
}

.android-app-prompt__eyebrow {
    color: var(--app-primary-dark);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 2px;
}

.android-app-prompt__title {
    color: var(--app-text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 4px;
}

.android-app-prompt__body {
    color: var(--app-muted);
    font-size: 0.82rem;
    line-height: 1.42;
    margin: 0 0 12px;
}

.android-app-prompt__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.android-app-prompt__install,
.android-app-prompt__later,
.android-app-prompt__close {
    appearance: none;
    border: 0;
    font: inherit;
}

.android-app-prompt__install,
.android-app-prompt__later {
    min-height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: normal;
}

.android-app-prompt__install {
    color: #fff;
    background: linear-gradient(120deg, #178446, #0e6d39);
    box-shadow: 0 14px 24px -20px rgba(21, 107, 58, 0.86);
}

.android-app-prompt__install:hover {
    color: #fff;
    background: linear-gradient(120deg, #1a9250, #116f3c);
}

.android-app-prompt__later {
    color: #264d38;
    background: var(--app-primary-soft-2);
    border: 1px solid #d4e8dc;
}

.android-app-prompt__close {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: #42644f;
    background: #f4faf6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.android-app-prompt__close:active,
.android-app-prompt__later:active,
.android-app-prompt__install:active {
    transform: translateY(1px);
}

.app-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    height: var(--app-bottom-h);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(160%) blur(8px);
    box-shadow: var(--app-shadow);
    z-index: 1090;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px;
}

.app-bottom-nav__item {
    color: var(--app-muted);
    text-decoration: none;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 100%;
    transition: all 0.22s ease;
}

.app-bottom-nav__item i {
    font-size: 1rem;
    line-height: 1;
}

.app-bottom-nav__item span {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-bottom-nav__item.is-active {
    color: var(--app-primary-dark);
    background: var(--app-primary-soft);
    box-shadow: inset 0 0 0 1px #cbe5d5;
}

.app-bottom-nav__item:not(.is-active):hover {
    background: #f5faf7;
    color: #365c49;
}

.app-fade-in {
    animation: appFadeIn 0.42s ease both;
}

@keyframes appFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    body.mobile-app-view {
        padding-top: 0;
    }

    body.mobile-app-view .navbar.navbar-expand-lg.navbar-light.bg-white.shadow-sm.fixed-top.d-none.d-lg-block {
        display: none !important;
    }

    body.mobile-app-view .container,
    body.mobile-app-view .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    body.mobile-app-view .footer-section {
        display: none;
    }
}

@media (min-width: 992px) {
    body.mobile-app-view {
        padding-bottom: 20px;
    }

    .app-bottom-nav {
        display: none;
    }
}

@media (max-width: 420px) {
    .app-bottom-nav {
        left: 8px;
        right: 8px;
    }

    .app-bottom-nav__item span {
        font-size: 0.61rem;
    }
}
