/* =========================================================
   TANNAH GLOBAL LOADER + FLOATING MARK
   ========================================================= */

:root {
    --tn-loader-size: 42px;
    --tn-loader-blue: #1d3a96;
    --tn-loader-yellow: #e8b800;
    --tn-loader-red: #cc2424;
    --tn-loader-core: #1d3a96;
}

[data-theme="dark"] {
    --tn-loader-blue: #5f80ff;
    --tn-loader-yellow: #f2c522;
    --tn-loader-red: #ef4444;
    --tn-loader-core: #5f80ff;
}

.tn-loader-svg {
    width: var(--tn-loader-size);
    height: var(--tn-loader-size);
    display: block;
    overflow: visible;
}

.tn-loader-svg path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tn-loader-svg .tn-b { stroke: var(--tn-loader-blue); stroke-width: 28; }
.tn-loader-svg .tn-y { stroke: var(--tn-loader-yellow); stroke-width: 20; }
.tn-loader-svg .tn-r { stroke: var(--tn-loader-red); stroke-width: 18; }
.tn-loader-svg .tn-core { fill: var(--tn-loader-core); }

/* Every existing .loader becomes the TANNAH animation. */
.loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tn-loader-size);
    height: var(--tn-loader-size);
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    animation: none !important;
    color: inherit;
}

.btn .loader { --tn-loader-size: 16px; }
.btn-sm .loader { --tn-loader-size: 14px; }
.btn-lg .loader { --tn-loader-size: 20px; }
.card .loader { --tn-loader-size: 52px; }
#splash .loader { --tn-loader-size: 88px; }

.tn-loader-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface, #ffffff);
    transition: opacity .35s ease, visibility .35s ease;
}

.tn-loader-splash.is-out {
    opacity: 0;
    visibility: hidden;
}

.tn-loader-splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.tn-loader-splash .loader {
    --tn-loader-size: 92px;
}

.tn-loader-word {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .28em;
    color: var(--text-muted, #64748b);
}

/* Landing page floating marks */
.tn-floating-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transform-style: preserve-3d;
    will-change: transform;
    transition: none;
    transform:
        perspective(600px)
        translate3d(var(--hover-x, 0px), calc(var(--hover-y, 0px) + var(--scroll-y, 0px)), 0)
        rotateX(var(--hover-rx, 0deg))
        rotateY(var(--hover-ry, 0deg))
        rotateY(var(--scroll-ry, 0deg));
}

.tn-floating-mark--nav {
    width: 34px;
    height: 34px;
}

.tn-floating-mark--footer {
    width: 46px;
    height: 46px;
}

.tn-floating-mark .tn-float-idle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: tn-float 4.6s ease-in-out infinite;
}

.tn-floating-mark .tn-loader-svg {
    width: 100%;
    height: 100%;
}

@keyframes tn-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}

/* Offline / PWA status bar */
.tn-offline-bar {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 9500;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 36px);
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
    box-shadow: 0 12px 30px -14px rgba(15, 23, 42, .45);
    font-size: 12px;
    color: var(--text, #0f172a);
}

.tn-offline-bar.is-offline {
    border-color: rgba(217, 119, 6, .45);
    background: #fffbeb;
    color: #92400e;
}

.tn-offline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
}

.tn-offline-bar.is-offline .tn-offline-dot {
    background: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, .15);
}

.tn-offline-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tn-offline-btn {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    padding: 2px 3px;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .tn-offline-bar {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
        font-size: 11.5px;
        padding: 8px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tn-floating-mark .tn-float-idle { animation: none; }
    .tn-floating-mark { transition: none; }
}
