/* =============================================
   Admin PWA — Splash, loaders, skeletons, nav
   Admin-only. Matches TurfBox theme tokens.
   ============================================= */

:root {
    --tb-splash-bg: #39A34B;
    --tb-splash-bg-2: #2f8a3e;
    --tb-loader-fg: #39A34B;
}

/* ---- Splash (height matches iOS shell: 100dvh + safe-bottom) ---- */
#tbAdminSplash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--pwa-shell-h, calc(100dvh + var(--pwa-safe-bottom, 34px)));
    min-height: var(--pwa-shell-h, calc(100dvh + var(--pwa-safe-bottom, 34px)));
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding:
        max(1.5rem, env(safe-area-inset-top, 0px))
        max(1.25rem, env(safe-area-inset-right, 0px))
        max(1.5rem, var(--pwa-safe-bottom, 34px))
        max(1.25rem, env(safe-area-inset-left, 0px));
    background: linear-gradient(165deg, var(--tb-splash-bg) 0%, var(--tb-splash-bg-2) 45%, #14532d 100%);
    background-color: #14532d;
    color: #fff;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    -webkit-user-select: none;
    user-select: none;
}

#tbAdminSplash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.tb-splash__inner {
    text-align: center;
    max-width: 18rem;
}

.tb-splash__logo-wrap {
    width: 5.5rem;
    height: 5.5rem;
    margin: 0 auto 1.15rem;
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.tb-splash__logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tb-splash__logo-wrap i {
    font-size: 2.25rem;
    color: #fff;
}

.tb-splash__title {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.35rem;
    line-height: 1.15;
}

.tb-splash__sub {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.82;
    margin: 0;
    line-height: 1.4;
}

.tb-splash__pulse {
    width: 2rem;
    height: 3px;
    margin: 1.35rem auto 0;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.35);
    overflow: hidden;
    position: relative;
}

.tb-splash__pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    transform: translateX(-100%);
    animation: tbSplashPulse 1s ease-in-out infinite;
}

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

/* ---- App init loader ---- */
#tbAppLoader {
    position: fixed;
    inset: 0;
    z-index: 19950;
    display: none;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

#tbAppLoader.is-visible {
    display: flex;
    opacity: 1;
}

.tb-app-loader__card {
    text-align: center;
    padding: 1.5rem 1.75rem;
}

.tb-app-loader__logo {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.9rem;
    overflow: hidden;
    margin: 0 auto 0.85rem;
    background: #ccfbf1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-app-loader__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tb-app-loader__spin {
    width: 1.5rem;
    height: 1.5rem;
    border: 2.5px solid #ccfbf1;
    border-top-color: var(--tb-loader-fg, #0f766e);
    border-radius: 50%;
    margin: 0 auto;
    animation: tbSpin 0.7s linear infinite;
}

.tb-app-loader__label {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
}

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

/* ---- Top nav progress ---- */
#tbNavProgress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5px;
    z-index: 19990;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

#tbNavProgress.is-active {
    opacity: 1;
}

#tbNavProgress > span {
    display: block;
    height: 2.5px;
    width: 0;
    background: linear-gradient(90deg, var(--primary, #0f766e), #2dd4bf);
    box-shadow: 0 0 8px rgba(15, 118, 110, 0.45);
    transition: width 0.35s ease;
}

/* ---- Skeletons ---- */
.tb-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: tbSkeletonWave 1.35s ease-in-out infinite;
    border-radius: 10px;
}

@keyframes tbSkeletonWave {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tb-skeleton--text {
    height: 0.75rem;
    margin-bottom: 0.5rem;
}

.tb-skeleton--title {
    height: 1.1rem;
    width: 55%;
    margin-bottom: 0.75rem;
}

.tb-skeleton--card {
    height: 5.5rem;
    border-radius: 14px;
}

.tb-skeleton--row {
    height: 2.75rem;
    margin-bottom: 0.45rem;
    border-radius: 8px;
}

.tb-page-skeleton {
    display: none;
    padding: 0.25rem 0 1rem;
}

.tb-page-skeleton.is-visible {
    display: block;
}

.tb-page-skeleton__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .tb-page-skeleton__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.tb-cal-skeleton {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

@media (min-width: 576px) {
    .tb-cal-skeleton {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.tb-cal-skeleton__slot {
    height: 4.25rem;
    border-radius: 12px;
}

/* ---- Button loader ---- */
.btn.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.btn.is-loading .tb-btn-spinner {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.15em;
    margin-right: 0.4rem;
    animation: tbSpin 0.65s linear infinite;
}

/* Content settle (avoid flash) */
body.tb-nav-pending .content-area {
    opacity: 0.72;
    transition: opacity 0.15s ease;
}
