﻿/* ═══════════════════════════════════════════════════════════════════════════════
   Global App Styles — Professional scrolling fix for desktop/browser view
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────────────
   BASE LAYOUT STRUCTURE
   ────────────────────────────────────────────────────────────────────────────── */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent body scroll, let main content handle it */
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ──────────────────────────────────────────────────────────────────────────────
   MUDBLAZOR LAYOUT OVERRIDES
   ────────────────────────────────────────────────────────────────────────────── */

.mud-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* CRITICAL: Enable scrolling in main content area */
.mud-main-content {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto !important;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS/Safari */
    position: relative;
}

/* Ensure MudBlazor containers don't constrain height */
.mud-container,
.mud-container-fixed,
.mud-container-maxwidth-lg,
.mud-container-maxwidth-md,
.mud-container-maxwidth-sm,
.mud-container-maxwidth-xl,
.mud-container-maxwidth-xs {
    height: auto !important;
    min-height: auto !important;
}

.mud-stack {
    height: auto !important;
}

.mud-breakpoint-provider {
    height: 100%;
    overflow: visible;
}

/* ──────────────────────────────────────────────────────────────────────────────
   APP SHELL & PAGE TRANSITIONS
   ────────────────────────────────────────────────────────────────────────────── */

.app-shell {
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 0; /* Critical for flexbox scrolling */
    overflow: visible;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ──────────────────────────────────────────────────────────────────────────────
   LOADING OVERLAYS
   ────────────────────────────────────────────────────────────────────────────── */

.page-loader-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ──────────────────────────────────────────────────────────────────────────────
   MUDBLAZOR COMPONENT ENHANCEMENTS
   ────────────────────────────────────────────────────────────────────────────── */

/* Smooth transitions for interactive elements */
.mud-button-root,
.mud-icon-button,
.mud-chip,
.mud-nav-link,
.mud-list-item,
.mud-input-root {
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
                border-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
                color 150ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* AppBar icon button hover effect */
.app-bar-icon:hover {
    transform: scale(1.1);
    background-color: var(--mud-palette-action-default-hover);
}

/* Button text enhancements */
.mud-button-root {
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Drawer header height consistency */
.mud-drawer-header {
    height: var(--mud-appbar-height);
}

/* ──────────────────────────────────────────────────────────────────────────────
   CUSTOM SCROLLBAR STYLING
   ────────────────────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--mud-palette-background);
}

::-webkit-scrollbar-thumb {
    background: var(--mud-palette-divider);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mud-palette-action-default);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--mud-palette-divider) var(--mud-palette-background);
}

/* ──────────────────────────────────────────────────────────────────────────────
   PAGE-SPECIFIC UTILITIES
   ────────────────────────────────────────────────────────────────────────────── */

.pa-3 {
    padding-bottom: 2rem !important; /* Scroll clearance */
}

/* ──────────────────────────────────────────────────────────────────────────────
   ACCESSIBILITY
   ────────────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .app-shell {
        animation: none;
    }

    .mud-button-root,
    .mud-icon-button,
    .mud-chip,
    .mud-nav-link,
    .mud-list-item,
    .mud-input-root,
    .app-bar-icon:hover {
        transition: none;
    }
}

/* ──────────────────────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN SAFETY
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 599px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
}
