/* BOSSS Mobile — Global Styles */

html, body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Safe area support for notched devices — applied to the app bar itself
   so the 100dvh viewport stays intact. Bottom inset handled in BottomNav.razor.css. */
.mud-appbar {
    padding-top: env(safe-area-inset-top);
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
}

/* Flex layout: app bar + scrollable content + bottom nav */
.mud-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.mud-layout > .mud-main-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Appbar pads its own top with safe-area-inset-top, so offset content by that too
       on top of MudBlazor's default var(--mud-appbar-height). +8px buffer keeps page
       titles from feeling squashed against the (dense) appbar on notched devices. */
    padding-top: calc(var(--mud-appbar-height) + env(safe-area-inset-top) + 8px);
}

/* Loading screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #1E3A5F 0%, #2B5A8F 50%, #1E3A5F 100%);
    color: white;
}

.loading-logo {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
    opacity: 0;
    animation: logo-enter 0.4s ease-out forwards;
}

@keyframes logo-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Blazor error UI */
#blazor-error-ui {
    background: #FEE2E2;
    color: #991B1B;
    padding: 0.75rem 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    text-align: center;
    display: none;
    font-size: 0.875rem;
}

#blazor-error-ui .reload {
    color: #1E3A5F;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Tabular numerals on surfaces so counts/stats don't jitter */
.mud-paper,
.mud-main-content {
    font-variant-numeric: tabular-nums;
}

/* Elevation tokens (scoped to in-page cards only — dialogs/menus/appbar keep native shadows).
   Load order: app.css ships after MudBlazor.min.css in index.html,
   and .page-container .mud-paper.mud-elevation-1 beats .mud-elevation-1 on specificity. */
.page-container .mud-paper.mud-elevation-1 {
    box-shadow: 0 0 0 1px var(--mud-palette-lines-default);
}

.page-container .mud-paper.mud-elevation-2 {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04),
                0 12px 24px rgba(0, 0, 0, 0.05);
}

/* Mobile-first utilities */
.page-container {
    padding: 20px;
    padding-bottom: 88px;
}

.stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    border-radius: 12px !important;
}

.stat-card:active {
    transform: scale(0.97);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* Profile card styles */
.profile-card {
    border-radius: 12px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    animation: list-item-enter 0.25s ease-out backwards;
}

.profile-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* List item stagger animation */
.profile-card:nth-child(1) { animation-delay: 0ms; }
.profile-card:nth-child(2) { animation-delay: 30ms; }
.profile-card:nth-child(3) { animation-delay: 60ms; }
.profile-card:nth-child(4) { animation-delay: 90ms; }
.profile-card:nth-child(5) { animation-delay: 120ms; }
.profile-card:nth-child(6) { animation-delay: 150ms; }
.profile-card:nth-child(7) { animation-delay: 180ms; }
.profile-card:nth-child(8) { animation-delay: 210ms; }

/* Category color dot */
.category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

/* Notification list */
.notification-unread {
    border-left: 3px solid var(--mud-palette-primary);
}

.notification-read {
    border-left: 3px solid transparent;
    opacity: 0.7;
}

/* Text truncation utility */
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tab panel no padding for full-width content */
.mobile-tabs .mud-tabs-panels {
    padding: 0 !important;
}

/* Page entrance animation */
@keyframes page-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes list-item-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-container {
    animation: page-enter 0.3s ease-out;
}

/* Tab content fade */
.mud-tabpanel {
    animation: page-enter 0.2s ease-out;
}

/* Progress bar fill animation */
.mud-progress-linear-bar {
    transition: width 0.6s ease-out;
}

/* Smooth dark mode transition */
.mud-layout,
.mud-appbar,
.mud-paper,
.bottom-nav {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px;
    text-align: center;
}

.empty-state .mud-icon-root {
    font-size: 3rem;
    opacity: 0.6;
    margin-bottom: 8px;
}

.empty-state-illustration {
    width: 160px;
    max-width: 60%;
    height: auto;
    opacity: 0.9;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 4px;
}

.empty-state-compact .empty-state-illustration {
    width: 100px;
    margin-bottom: 0;
}

.empty-state-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    text-align: center;
}

.empty-state-compact .mud-icon-root {
    font-size: 2rem;
    opacity: 0.6;
    margin-bottom: 4px;
}

/* Login card entrance */
@keyframes login-card-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    animation: login-card-enter 0.4s ease-out;
}

/* Process step timeline */
.step-timeline {
    position: relative;
    padding-left: 16px;
}

.step-timeline-item {
    position: relative;
    padding-left: 20px;
    padding-bottom: 12px;
}

.step-timeline-item:last-child {
    padding-bottom: 0;
}

.step-timeline-item::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 20px;
    bottom: 0;
    width: 2px;
    background: var(--mud-palette-lines-default);
}

.step-timeline-item:last-child::before {
    display: none;
}

.step-timeline-item.step-completed::before {
    background: var(--mud-palette-success);
}

.step-timeline-icon {
    position: absolute;
    left: -5px;
    top: 0;
    z-index: 1;
}

/* Bottom safe area for iOS */
.bottom-safe-area {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    position: fixed;
    top: env(safe-area-inset-top);
    left: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--mud-palette-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08),
                0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translate(-50%, -56px);
    opacity: 0;
    z-index: 1200;
    pointer-events: none;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.ptr-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--mud-palette-lines-default);
    border-top-color: var(--mud-palette-primary);
    border-radius: 50%;
}

.ptr-refreshing .ptr-spinner {
    animation: spin 0.8s linear infinite;
}

/* ── Swipe-to-reveal row ─────────────────────────────────────── */
.swipe-row {
    --swipe-open-width: 88px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 8px;
    touch-action: pan-y;
}

.swipe-row .swipe-content {
    position: relative;
    z-index: 2;
    background: transparent;
    transform: translateX(0);
    will-change: transform;
}

.swipe-row .swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    z-index: 1;
}

.swipe-row .swipe-action {
    border: 0;
    width: var(--swipe-open-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.swipe-row .swipe-action-delete {
    background: var(--mud-palette-error);
}

.swipe-row .swipe-action-delete:active {
    filter: brightness(0.9);
}

/* Capture FAB — floats above the bottom nav */
.capture-fab-wrapper {
    position: fixed;
    right: 20px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    z-index: 1150;
}

    .capture-fab-wrapper .mud-fab {
        width: 60px;
        height: 60px;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2),
                    0 2px 6px rgba(0, 0, 0, 0.1);
        transition: transform 0.18s ease-out;
    }

        .capture-fab-wrapper .mud-fab:active {
            transform: scale(0.92);
        }

