/* ==========================================
   GYB360° — Mobile-Native Shell CSS
   WebView-first design system
   ========================================== */

/* --- Reset for WebView --- */
html,
body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    scroll-behavior: smooth;
}

/* Safe area insets for notches & home indicators */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: calc(env(safe-area-inset-bottom) + 72px);
    /* 72px = bottom nav height */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Hide scrollbars globally */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
}

/* Disable long-press context menus */
img,
a,
button,
[role="button"] {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow text selection in inputs/textareas */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

/* Minimum touch targets (48x48px) */
a,
button,
[role="button"],
.nav-link,
.btn,
.sidebar a,
input[type="submit"],
input[type="button"],
select {
    min-height: 48px;
    min-width: 48px;
}

/* --- App Shell Loading Screen --- */
.app-shell-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0f1115;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.app-shell-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-shell-loader .logo-pulse {
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -1px;
    animation: pulseBrand 1.5s ease-in-out infinite;
}

.app-shell-loader .logo-pulse span {
    color: #00ff66;
    text-shadow: 0 0 20px rgba(0, 176, 80, 0.4);
}

.app-shell-loader .loader-bar {
    width: 120px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-top: 24px;
    overflow: hidden;
}

.app-shell-loader .loader-bar::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: #00ff66;
    border-radius: 4px;
    animation: slideBar 1.2s ease-in-out infinite;
}

@keyframes pulseBrand {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.97);
    }
}

@keyframes slideBar {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

/* --- Fixed Bottom Navigation Bar --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: #0f1115;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #6b7280;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.2s;
    padding: 8px 16px;
    min-height: 48px;
    min-width: 48px;
    justify-content: center;
    position: relative;
}

.bottom-nav .nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.bottom-nav .nav-item.active {
    color: #00ff66;
}

.bottom-nav .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: #00ff66;
    border-radius: 0 0 4px 4px;
}

/* Notification badge */
.bottom-nav .nav-item .badge-dot {
    position: absolute;
    top: 6px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid #0f1115;
}

/* Hide bottom nav on desktop */
@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }

    body {
        padding-bottom: 0;
    }
}

/* --- Pull-to-Refresh Indicator --- */
.ptr-indicator {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1b1f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.2s ease;
    z-index: 99998;
}

.ptr-indicator.active {
    top: calc(env(safe-area-inset-top, 0px) + 16px);
}

.ptr-indicator .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 176, 80, 0.2);
    border-top-color: #00ff66;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Mobile Responsive Overrides --- */
@media (max-width: 768px) {

    /* Hide desktop sidebar on mobile */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content takes full width */
    .main-content,
    .content-area,
    main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Mobile header visible */
    .mobile-header,
    .mobile-topbar {
        display: flex !important;
    }
}