/* app-shell.css - Loading screen with circuitry and animated progress bar */
/* Reusable loading screen for JadedSoftware Blazor WebAssembly applications */

@import url('https://fonts.googleapis.com/css2?family=Edu+VIC+WA+NT+Hand:wght@400;500;600;700&display=swap');

#loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.06), transparent 45%),
        radial-gradient(circle at 80% 30%, rgba(129, 140, 248, 0.05), transparent 55%),
        #000000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
    color: #e2e8f0;
    opacity: 1;
    transform: scale(1);
    will-change: opacity, transform;
}

#loading-container::before,
#loading-container::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#loading-container::before {
    background-image:
        repeating-linear-gradient(0deg, rgba(59, 130, 246, 0.04) 0, rgba(59, 130, 246, 0.04) 1px, transparent 1px, transparent 80px),
        repeating-linear-gradient(90deg, rgba(59, 130, 246, 0.03) 0, rgba(59, 130, 246, 0.03) 1px, transparent 1px, transparent 80px);
    opacity: 0.4;
    animation: gridPulse 24s linear infinite;
}

#loading-container::after {
    background: radial-gradient(circle at 50% 30%, rgba(59, 130, 246, 0.08), transparent 60%);
    filter: blur(40px);
    opacity: 0.35;
    animation: auroraDrift 18s ease-in-out infinite alternate;
}

/* Subtle scan line effect */
.circuit-scene::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(59, 130, 246, 0.02) 2px,
        rgba(59, 130, 246, 0.02) 4px
    );
    pointer-events: none;
    opacity: 0.3;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(100vh);
    }
}

.circuits-wallpaper {
    position: absolute;
    inset: 0;
    background-image: url('/_content/JadedSoftware.UI/assets/wallpapers/circuits.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.circuit-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.circuit-layer {
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
    will-change: transform, opacity, background-position;
}

.circuit-layer--grid {
    background-image:
        linear-gradient(120deg, rgba(59, 130, 246, 0) 30%, rgba(59, 130, 246, 0.18) 50%, rgba(59, 130, 246, 0) 70%),
        linear-gradient(300deg, rgba(129, 140, 248, 0) 35%, rgba(129, 140, 248, 0.18) 52%, rgba(129, 140, 248, 0) 70%);
    background-size: 400px 400px, 360px 360px;
    opacity: 0.3;
    animation: traceFlow 12s ease-in-out infinite;
}

.circuit-layer--pulses {
    background-image:
        radial-gradient(circle at 18% 25%, rgba(56, 189, 248, 0.4) 0, rgba(56, 189, 248, 0) 55%),
        radial-gradient(circle at 72% 42%, rgba(129, 140, 248, 0.45) 0, rgba(129, 140, 248, 0) 45%),
        radial-gradient(circle at 40% 76%, rgba(96, 165, 250, 0.35) 0, rgba(96, 165, 250, 0) 50%);
    opacity: 0.4;
    animation: nodePulse 9s ease-in-out infinite;
}

.circuit-path {
    position: absolute;
    height: 2px;
    width: 180%;
    background-image: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.5) 25%, rgba(147, 197, 253, 0.8) 50%, rgba(167, 139, 250, 0.5) 75%, transparent 100%);
    background-size: 120px 100%;
    opacity: 0.6;
    filter: drop-shadow(0 0 4px rgba(94, 234, 212, 0.2));
    animation: pathSweep 5s linear infinite;
    mix-blend-mode: screen;
}

.circuit-path::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    filter: blur(1px);
    opacity: 0.5;
}

.circuit-path::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(165, 243, 252, 0.7) 0%, rgba(59, 130, 246, 0) 70%);
    box-shadow: 0 0 12px rgba(165, 243, 252, 0.4);
    animation: nodeTravel 5s linear infinite;
}

.circuit-path--primary {
    top: 20%;
    left: -50%;
    transform: rotate(35deg) skewY(-2deg);
}

.circuit-path--secondary {
    bottom: 15%;
    left: -30%;
    transform: rotate(-30deg) skewY(2deg);
    animation-duration: 6.5s;
}

.circuit-path--secondary::after {
    animation-duration: 6.5s;
}

.brand-container {
    position: relative;
    z-index: 10;
    text-align: center;
    animation: fadeInUp 1s ease-out;
    max-width: 90vw;
}

.brand-logo-wrapper {
    position: relative;
    display: inline-block;
    padding: 3.5rem 6rem;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(10, 10, 20, 0.92) 100%);
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.5),
        0 10px 40px rgba(0, 0, 0, 0.95),
        0 0 100px rgba(59, 130, 246, 0.12),
        inset 0 0 80px rgba(0, 0, 0, 0.7);
    margin-bottom: 3rem;
}

.brand-logo-wrapper::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.8) 0%,
        rgba(129, 140, 248, 0.8) 25%,
        rgba(167, 139, 250, 0.8) 50%,
        rgba(129, 140, 248, 0.8) 75%,
        rgba(59, 130, 246, 0.8) 100%
    );
    background-size: 200% 200%;
    animation: borderRotate 3s linear infinite;
    z-index: -1;
    opacity: 0.95;
    filter: blur(1px);
}

.brand-logo-wrapper::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: linear-gradient(135deg,
        transparent 0%,
        rgba(59, 130, 246, 0.6) 50%,
        transparent 100%
    );
    background-size: 200% 200%;
    animation: borderRotate 3s linear infinite reverse;
    z-index: -1;
    filter: blur(14px);
    opacity: 0.75;
}

.brand-logo-image {
    position: relative;
    display: block;
    width: 400px;
    height: auto;
    margin: 0;
    padding: 0;
    filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.5))
            drop-shadow(0 0 40px rgba(167, 139, 250, 0.3));
    animation: logoGlow 3.5s ease-in-out infinite;
}

.loading-message {
    margin-top: 2.5rem;
    margin-bottom: 2rem;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #60a5fa 0%, #818cf8 25%, #a78bfa 50%, #c084fc 75%, #e879f9 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-message .logo-gem {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-right: 0.5rem;
    -webkit-text-fill-color: initial;
    background-clip: initial;
    -webkit-background-clip: initial;
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.6));
    animation: gemPulse 2s ease-in-out infinite;
}

.loading-message span {
    display: inline-block;
    animation: letterScale 2.5s ease-in-out infinite;
}

/* Stagger animation for each letter */
.loading-message span:nth-child(1) { animation-delay: 0s; }
.loading-message span:nth-child(2) { animation-delay: 0.05s; }
.loading-message span:nth-child(3) { animation-delay: 0.1s; }
.loading-message span:nth-child(4) { animation-delay: 0.15s; }
.loading-message span:nth-child(5) { animation-delay: 0.2s; }
.loading-message span:nth-child(6) { animation-delay: 0.25s; }
.loading-message span:nth-child(7) { animation-delay: 0.3s; }
.loading-message span:nth-child(8) { animation-delay: 0.35s; }
.loading-message span:nth-child(9) { animation-delay: 0.4s; }
.loading-message span:nth-child(10) { animation-delay: 0.45s; }
.loading-message span:nth-child(11) { animation-delay: 0.5s; }
.loading-message span:nth-child(12) { animation-delay: 0.55s; }

.loading-dots {
    display: inline-block;
    margin-left: 0.3rem;
}

.loading-dots span {
    animation: dotPulse 1.5s ease-in-out infinite;
    opacity: 0.4;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

.progress-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    animation: fadeInUp 1.2s ease-out 0.5s both;
}

/* Container for spinner and gem */
.loading-spinner-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Spinner rings (rotating around the gem) */
.loading-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
}

.loading-spinner .spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1.4s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-spinner .spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: #3b82f6;
    border-width: 4px;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.loading-spinner .spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: #8b5cf6;
    border-width: 4px;
    width: 85%;
    height: 85%;
    top: 7.5%;
    left: 7.5%;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.loading-spinner .spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: #06b6d4;
    border-width: 4px;
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
}

/* Gem in the center */
.gem-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 2px 12px rgba(59, 130, 246, 0.6))
            drop-shadow(0 0 20px rgba(96, 165, 250, 0.4));
    z-index: 10;
}

.gem-icon svg {
    width: 100%;
    height: 100%;
}

/* ===== Animations ===== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes logoGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.5))
                drop-shadow(0 0 40px rgba(167, 139, 250, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(96, 165, 250, 0.7))
                drop-shadow(0 0 50px rgba(167, 139, 250, 0.5));
    }
}

@keyframes borderRotate {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

@keyframes letterScale {
    0%, 100% {
        transform: scale(1);
    }
    10% {
        transform: scale(1.4);
    }
    20% {
        transform: scale(1);
    }
}

@keyframes gemPulse {
    0%, 100% {
        opacity: 0.9;
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.6));
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
        filter: drop-shadow(0 0 12px rgba(96, 165, 250, 0.8));
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes gridPulse {
    0% {
        opacity: 0.55;
    }
    50% {
        opacity: 0.85;
    }
    100% {
        opacity: 0.55;
    }
}

@keyframes auroraDrift {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.2) translate(5%, -5%);
    }
}

@keyframes traceFlow {
    0% {
        background-position: 0 0, 0 0;
    }
    50% {
        background-position: 180px 190px, -130px -120px;
    }
    100% {
        background-position: 360px 360px, -260px -220px;
    }
}

@keyframes nodePulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.96);
    }
    40% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        opacity: 0.85;
        transform: scale(1);
    }
}

@keyframes pathSweep {
    0% {
        background-position: -40% 0;
    }
    100% {
        background-position: 140% 0;
    }
}

@keyframes nodeTravel {
    0% {
        left: 0;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .brand-logo-image {
        width: 250px;
    }

    .brand-logo-wrapper {
        padding: 2.5rem 4rem;
    }

    .loading-spinner-container {
        width: 220px;
        height: 220px;
    }

    .gem-icon {
        width: 60px;
        height: 60px;
    }

    .loading-message {
        font-size: 2rem;
    }

    .progress-container {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .brand-logo-image {
        width: 200px;
    }

    .brand-logo-wrapper {
        padding: 2rem 3rem;
    }

    .loading-spinner-container {
        width: 180px;
        height: 180px;
    }

    .gem-icon {
        width: 50px;
        height: 50px;
    }

    .loading-message {
        font-size: 0.85rem;
    }

    .loading-spinner .spinner-ring {
        border-width: 3px;
    }
}

@media (min-width: 1024px) {
    .loading-spinner-container {
        width: 320px;
        height: 320px;
    }

    .gem-icon {
        width: 100px;
        height: 100px;
    }
}

/* ===== Accessibility ===== */

@media (prefers-reduced-motion: reduce) {
    #loading-container::before,
    #loading-container::after,
    .circuits-wallpaper,
    .circuit-scene,
    .circuit-layer,
    .circuit-path,
    .brand-logo-image,
    .brand-logo-wrapper::before,
    .brand-logo-wrapper::after,
    .loading-message,
    .loading-message span,
    .loading-message .logo-gem,
    .loading-dots span,
    .gem-icon,
    .gem-icon svg,
    .loading-spinner,
    .spinner-ring,
    .progress-container {
        animation: none !important;
        transition: none !important;
    }
}

/* ===== EmptyState Component Styles ===== */

.empty-state-centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state-inline-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.empty-state-inline-content .empty-state-inner {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-alert-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    margin-bottom: 1rem;
    max-width: 400px;
}

.empty-state-custom-content {
    margin: 1rem 0;
    max-width: 500px;
}

.empty-state-inner button {
    margin-top: 0.5rem;
}

/* Responsive adjustments for inline variant */
@media (max-width: 768px) {
    .empty-state-inline-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .empty-state-inline-content .empty-state-inner {
        flex-direction: column;
    }

    .empty-state-centered-content {
        min-height: 250px;
        padding: 1.5rem 1rem;
    }

    .empty-state-card-content {
        padding: 1.5rem 1rem;
    }
}

/* ===== NavMenuPanel Component Styles ===== */

.nav-link-enhanced {
    transition: all 0.2s ease-in-out;
}

.nav-link-enhanced:hover {
    transform: translateX(4px);
}

.nav-link-enhanced .mud-nav-link-text {
    color: var(--mud-palette-text-primary);
}

/* Remove extra whitespace at the bottom of nested nav groups */
.mud-nav-group.ml-2 {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove extra padding from nested nav group content */
.mud-nav-group.ml-2 .mud-collapse-container {
    padding-bottom: 0 !important;
}

/* Add vertical line next to nav link icons for better definition */
.mud-navmenu .mud-nav-link {
    position: relative;
    padding-left: 16px;
}

.mud-navmenu .mud-nav-link::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 20px;
    background-color: currentColor;
    opacity: 0.3;
}

.mud-navmenu .mud-nav-link .mud-nav-link-icon-default {
    margin-left: 8px;
}

/* Add vertical line to nav group titles as well */
.mud-navmenu .mud-nav-group > .mud-nav-item {
    position: relative;
    padding-left: 16px;
}

.mud-navmenu .mud-nav-group > .mud-nav-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 24px;
    background-color: currentColor;
    opacity: 0.3;
}

/* Fix scrollbar height - ensure drawer content fills available space */
.mud-drawer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mud-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Only the TOP-LEVEL navmenu should be the scroll container.
   MudNavGroup renders nested .mud-navmenu elements inside each group.
   MudBlazor sets overscroll-behavior-y:contain on ALL .mud-navmenu elements,
   so if nested navmenus also get overflow-y:auto, they become scroll containers
   that capture wheel events and never propagate them to the parent. */
.mud-drawer-content > .mud-navmenu {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 16px;
}

/* Nested navmenus inside nav groups must NOT be scroll containers */
.mud-navmenu .mud-navmenu {
    overflow: visible !important;
    overscroll-behavior-y: auto !important;
}

/* Ensure drawer header does not interfere with nav menu height */
.mud-drawer-header {
    flex-shrink: 0;
}

/* ===== MudTooltip Width Fix ===== */
/* MudBlazor tooltip popover stretches to ~97vw by default due to flex layout.
   Force shrink-wrap to content instead. */

.mud-popover.mud-tooltip {
    width: max-content !important;
    max-width: 350px !important;
    min-width: 0 !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
}

.mud-popover.mud-tooltip.d-flex {
    width: max-content !important;
    max-width: 350px !important;
}

.mud-tooltip .mud-typography,
.mud-tooltip-content,
.mud-popover.mud-tooltip > * {
    max-width: 350px;
    white-space: normal;
    word-wrap: break-word;
}
