/* ════════════════════════════════════════════════════════════════
   WEBNET APP CHILD — App Shell
   Wraps the entire WordPress site in a persistent mobile-app UI.
   File: assets/css/app.css
═══════════════════════════════════════════════════════════════ */

:root {
    --wn-red:        #C0181C;
    --wn-red-dark:   #8B0000;
    --wn-red-light:  #E84040;
    --wn-red-pale:   #FFF0F0;
    --wn-white:      #FFFFFF;
    --wn-off:        #F9F9F9;
    --wn-gray-100:   #F2F2F2;
    --wn-gray-200:  #E5E5E5;
    --wn-gray-400:  #9CA3AF;
    --wn-gray-700:  #4B5563;
    --wn-gray-900:  #1F2937;
    --wn-black:     #111111;
    --wn-green:     #25D366;   /* WhatsApp */

    --wn-header-h:  60px;
    --wn-tabbar-h:  68px;
    --wn-safe-top:  env(safe-area-inset-top, 0px);
    --wn-safe-bot:  env(safe-area-inset-bottom, 0px);

    --wn-radius:    14px;
    --wn-radius-sm: 8px;
    --wn-shadow:    0 4px 20px rgba(0, 0, 0, 0.08);
    --wn-shadow-lg: 0 10px 40px rgba(192, 24, 28, 0.18);

    --wn-ease:      cubic-bezier(0.4, 0, 0.2, 1);
    --wn-trans:     0.32s var(--wn-ease);
}

/* ── Body shell ────────────────────────────────────────────── */
body.webnet-app-shell {
    margin: 0;
    padding-top:    calc(var(--wn-header-h) + var(--wn-safe-top));
    padding-bottom: calc(var(--wn-tabbar-h) + var(--wn-safe-bot));
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    background: var(--wn-white);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.webnet-app-shell.wn-drawer-open {
    overflow: hidden;
}

/* App content area — parent theme renders inside this */
.webnet-app-content {
    position: relative;
    min-height: calc(100vh - var(--wn-header-h) - var(--wn-tabbar-h));
    transition: opacity 0.25s ease, transform 0.32s var(--wn-ease);
    will-change: opacity, transform;
}
.webnet-app-content.is-leaving  { opacity: 0; transform: translateY(8px); }
.webnet-app-content.is-entering { opacity: 0; transform: translateY(-8px); }

/* ════════════════════════════════════════════════════════════
   1. SPLASH SCREEN
═══════════════════════════════════════════════════════════ */
.wn-splash {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--wn-red) 0%, var(--wn-red-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.wn-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.wn-splash__inner {
    text-align: center;
    padding: 2rem;
    animation: wnSplashIn 0.6s var(--wn-ease) both;
}
@keyframes wnSplashIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.wn-splash__logo {
    width: 100px;
    height: auto;
    margin: 0 auto 1.5rem;
    filter: brightness(0) invert(1);
}
.wn-splash__title {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.4rem;
    color: #fff;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 0;
    line-height: 1.1;
}
.wn-splash__title span {
    font-size: 1rem;
    letter-spacing: 4px;
    color: #FFD0D0;
    font-weight: 600;
}
.wn-splash__tagline {
    color: #FFD0D0;
    font-style: italic;
    margin-top: 1rem;
    font-size: 0.9rem;
}
.wn-splash__loader {
    width: 140px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 99px;
    margin: 2rem auto 0;
    overflow: hidden;
}
.wn-splash__bar {
    width: 40%;
    height: 100%;
    background: #fff;
    border-radius: 99px;
    animation: wnSplashLoad 1.2s ease-in-out infinite;
}
@keyframes wnSplashLoad {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ════════════════════════════════════════════════════════════
   2. TOP HEADER
═══════════════════════════════════════════════════════════ */
.wn-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--wn-header-h) + var(--wn-safe-top));
    padding-top: var(--wn-safe-top);
    padding-left: 1rem;
    padding-right: 1rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    z-index: 100;
    transition: box-shadow 0.25s, transform 0.3s;
}
.wn-header.is-scrolled {
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.08);
}
.wn-header.is-hidden {
    transform: translateY(-100%);
}

.wn-header__menu {
    width: 42px;
    height: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: none;
    background: transparent;
    border-radius: var(--wn-radius-sm);
    cursor: pointer;
    padding: 0;
}
.wn-header__menu span {
    width: 22px;
    height: 2px;
    background: var(--wn-gray-900);
    border-radius: 2px;
    transition: all 0.25s ease;
}

.wn-header__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}
.wn-header__logo {
    height: 36px;
    width: auto;
}
.wn-header__brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}
.wn-brand-mark {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--wn-red);
    letter-spacing: 1px;
}
.wn-brand-sub {
    font-size: 0.55rem;
    letter-spacing: 3px;
    color: var(--wn-gray-700);
    margin-top: 2px;
    font-weight: 600;
}

.wn-header__call {
    width: 42px;
    height: 42px;
    background: var(--wn-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(192, 24, 28, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}
.wn-header__call:hover, .wn-header__call:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(192, 24, 28, 0.5);
}

/* ════════════════════════════════════════════════════════════
   3. SIDE DRAWER MENU
═══════════════════════════════════════════════════════════ */
.wn-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 82%;
    max-width: 340px;
    height: 100%;
    background: var(--wn-white);
    transform: translateX(-100%);
    transition: transform 0.35s var(--wn-ease);
    z-index: 200;
    display: flex;
    flex-direction: column;
    padding-top: var(--wn-safe-top);
    padding-bottom: var(--wn-safe-bot);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}
.wn-drawer.is-open {
    transform: translateX(0);
}

.wn-drawer__header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wn-gray-200);
}
.wn-drawer__logo {
    height: 38px;
    width: auto;
}
.wn-drawer__close {
    font-size: 1.4rem;
    color: var(--wn-gray-700);
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.wn-drawer__nav {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}
.wn-drawer__menu {
    list-style: none;
    padding: 0;
    margin: 0;
}
.wn-drawer__menu li {
    margin: 0;
}
.wn-drawer__menu a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1.5rem;
    color: var(--wn-gray-900);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-family: 'Montserrat', sans-serif;
}
.wn-drawer__menu a i {
    color: var(--wn-red);
    width: 22px;
    text-align: center;
    font-size: 1rem;
}
.wn-drawer__menu a:hover,
.wn-drawer__menu .current-menu-item > a {
    background: var(--wn-red-pale);
    border-left-color: var(--wn-red);
    color: var(--wn-red);
}

.wn-drawer__footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--wn-gray-200);
    font-size: 0.85rem;
}
.wn-drawer__contact {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.4rem 0;
    color: var(--wn-gray-700);
}
.wn-drawer__contact i {
    color: var(--wn-red);
    width: 18px;
}
.wn-drawer__contact a {
    color: var(--wn-gray-900);
    text-decoration: none;
    font-weight: 500;
}
.wn-drawer__social {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    margin-top: 1rem;
}
.wn-drawer__social a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--wn-gray-100);
    color: var(--wn-gray-900);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
}
.wn-drawer__social a:hover {
    background: var(--wn-red);
    color: #fff;
    transform: translateY(-2px);
}

.wn-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
    z-index: 150;
}
.wn-drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ════════════════════════════════════════════════════════════
   4. BOTTOM TAB BAR
═══════════════════════════════════════════════════════════ */
.wn-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--wn-tabbar-h) + var(--wn-safe-bot));
    padding-bottom: var(--wn-safe-bot);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--wn-gray-200);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}
.wn-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--wn-gray-700);
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 0.4rem 0;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.3px;
    position: relative;
}
.wn-tab i {
    font-size: 1.2rem;
    transition: transform 0.2s var(--wn-ease);
}
.wn-tab:hover { color: var(--wn-red-light); }
.wn-tab--active {
    color: var(--wn-red);
}
.wn-tab--active i {
    transform: scale(1.18) translateY(-1px);
}
.wn-tab--active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--wn-red);
    border-radius: 0 0 3px 3px;
}

/* ════════════════════════════════════════════════════════════
   5. FLOATING ACTION BUTTONS (FAB)
═══════════════════════════════════════════════════════════ */
.wn-fab-stack {
    position: fixed;
    bottom: calc(var(--wn-tabbar-h) + 1rem + var(--wn-safe-bot));
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    z-index: 90;
}
.wn-fab {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.wn-fab:active {
    transform: scale(0.92);
}
.wn-fab--whatsapp {
    background: var(--wn-green);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
    animation: wnPulseGreen 2.5s infinite;
}
.wn-fab--call {
    background: var(--wn-red);
    box-shadow: 0 6px 20px rgba(192, 24, 28, 0.45);
}
@keyframes wnPulseGreen {
    0%   { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45), 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70%  { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45), 0 0 0 16px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45), 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* ════════════════════════════════════════════════════════════
   6. PULL-TO-REFRESH
═══════════════════════════════════════════════════════════ */
.wn-ptr {
    position: fixed;
    top: calc(var(--wn-header-h) + var(--wn-safe-top));
    left: 50%;
    transform: translate(-50%, -100%);
    background: var(--wn-white);
    color: var(--wn-red);
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--wn-radius) var(--wn-radius);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: transform 0.25s var(--wn-ease);
    pointer-events: none;
    font-family: 'Montserrat', sans-serif;
}
.wn-ptr.is-pulling   { transform: translate(-50%, 0); }
.wn-ptr.is-refreshing { transform: translate(-50%, 0); }
.wn-ptr__spinner {
    position: relative;
    width: 18px;
    height: 18px;
}
.wn-ptr__arrow, .wn-ptr__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.2s;
}
.wn-ptr__arrow  { opacity: 1; }
.wn-ptr__loader { opacity: 0; animation: wnSpin 0.8s linear infinite; }
.wn-ptr.is-refreshing .wn-ptr__arrow  { opacity: 0; }
.wn-ptr.is-refreshing .wn-ptr__loader { opacity: 1; }
@keyframes wnSpin { to { transform: rotate(360deg); } }

/* Page-loader thin bar (top, shows during AJAX fetch) */
.wn-page-loader {
    position: fixed;
    top: calc(var(--wn-header-h) + var(--wn-safe-top));
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 101;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.wn-page-loader.is-loading { opacity: 1; }
.wn-page-loader__bar {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, transparent, var(--wn-red), transparent);
    animation: wnLoaderSweep 1s linear infinite;
}
@keyframes wnLoaderSweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ════════════════════════════════════════════════════════════
   7. PARENT-THEME COMPATIBILITY
   Hide things parent theme already renders that conflict.
═══════════════════════════════════════════════════════════ */
body.webnet-app-shell .site-header,
body.webnet-app-shell header.kingster-header,
body.webnet-app-shell .kingster-mobile-header,
body.webnet-app-shell .kingster-sticky-navigation-wrap,
body.webnet-app-shell #kingster-mobile-menu-wrap,
body.webnet-app-shell .menu-toggle,
body.webnet-app-shell #wpadminbar {
    display: none !important;
}

/* Restore any spacing parent theme expected */
body.webnet-app-shell .site,
body.webnet-app-shell .kingster-page-wrap {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* ════════════════════════════════════════════════════════════
   8. RESPONSIVE — TABLET / DESKTOP
═══════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    /* Optionally hide the tab bar on big screens */
    /* If you keep it visible on desktop, remove the block below. */
    body.webnet-app-shell {
        padding-bottom: 0;
    }
    .wn-tabbar { display: none; }
    .wn-fab-stack { bottom: 1.5rem; }
}

@media (min-width: 768px) {
    .wn-header__menu, .wn-drawer { /* tablet keeps drawer */ }
    .wn-brand-mark { font-size: 1.2rem; }
}

/* ════════════════════════════════════════════════════════════
   9. ACCESSIBILITY — reduced motion
═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .wn-fab--whatsapp { animation: none; }
}
