/* ===== SIDEBAR (Desktop >= 992px) ===== */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    z-index: 1000;
    overflow-y: auto;
}

#sidebar .sidebar-brand {
    padding: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    color: var(--bs-body-color);
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
    font-size: 0.9rem;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

#sidebar .nav-link i {
    font-size: 1.25rem;
}

@media (min-width: 992px) {
    #main-content {
        margin-left: 220px;
    }
}

/* ===== BOTTOM NAV (Mobile < 992px) ===== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

#bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.65rem;
    color: var(--bs-body-color);
    text-decoration: none;
    line-height: 1.2;
}

#bottom-nav .nav-link i {
    font-size: 1.35rem;
    margin-bottom: 0.125rem;
}

#bottom-nav .nav-link:hover,
#bottom-nav .nav-link.active {
    color: var(--bs-primary);
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: 3rem;
    }
}

/* ===== TOP BAR ===== */
#top-bar {
    border-bottom: 1px solid var(--bs-border-color);
}

/* ===== GENERAL ===== */
.card {
    margin-bottom: 0.75rem;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

#htmx-page-loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9998;
    overflow: hidden;
}

#htmx-page-loader.active {
    display: block;
}

#htmx-page-loader::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: var(--bs-primary);
    animation: htmx-slide 1s ease-in-out infinite;
}

@keyframes htmx-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ===== PWA INSTALL BANNER ===== */
#pwa-install-banner {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-banner-content.pwa-banner-generic {
    max-width: 720px;
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.pwa-banner-text strong {
    font-size: 0.9rem;
}

.pwa-banner-text span {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.pwa-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ===== HTMX VIEW TRANSITIONS ===== */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#main-content {
    animation: fade-in 0.15s ease-out;
}

.htmx-swapping #main-content {
    opacity: 0;
    transition: opacity 0.1s ease-out;
}

/* ===== SKELETON LOADING ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bs-gray-200) 25%, var(--bs-gray-100) 50%, var(--bs-gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

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

.skeleton-card {
    height: 80px;
    margin-bottom: 0.75rem;
}

.skeleton-line {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-line.short {
    width: 60%;
}

/* ===== SW UPDATE TOAST ===== */
.sw-update-toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 9999;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    animation: fade-in 0.2s ease-out;
}

/* ===== BALANCES TABLE ===== */
.table td.balance-leaf {
    background-color: #f0f6ff !important;
}

@media (max-width: 991.98px) {
    .sw-update-toast {
        bottom: 4rem;
    }
}
