/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */
:root {
    /* Border utilities */
    --border-primary: 2px solid rgba(var(--mud-palette-primary-rgb));
    --border-primary-30: 2px solid rgba(var(--mud-palette-primary-rgb), 0.3);
    --border-1px-primary-30: 1px solid rgba(var(--mud-palette-primary-rgb), 0.3);
    --border-1px-warning-30: 1px solid rgba(var(--mud-palette-warning-rgb), 0.3);
    --border-primary-20: 2px solid rgba(var(--mud-palette-primary-rgb), 0.2);

    /* Background colors with opacity */
    --bg-primary-5: rgba(var(--mud-palette-primary-rgb), 0.05);
    --bg-primary-10: rgba(var(--mud-palette-primary-rgb), 0.1);
    --bg-primary-20: rgba(var(--mud-palette-primary-rgb), 0.2);
    --bg-primary-50: rgba(var(--mud-palette-primary-rgb), 0.5);
    --bg-secondary-20: rgba(var(--mud-palette-secondary-rgb), 0.2);
    --bg-secondary-50: rgba(var(--mud-palette-secondary-rgb), 0.5);
    --bg-tertiary-20: rgba(var(--mud-palette-tertiary-rgb), 0.2);
    --bg-tertiary-50: rgba(var(--mud-palette-tertiary-rgb), 0.5);

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;

    /* Transitions */
    --transition-all: all 0.2s ease;
    --transition-color: color 0.2s ease;
    --transition-width: width 0.2s ease;
    --transition-opacity: opacity 0.2s ease;

    /* Shadows */
    --shadow-elevated: 0 12px 24px rgba(0, 0, 0, 0.3);

    /* Backdrop filter */
    --backdrop-blur: blur(8px);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
html,
body {
    overflow-x: hidden;
}

/* Remove focus outline from non-interactive typography elements */
.mud-typography:focus,
.mud-typography:focus-visible {
    outline: none;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
.text-secondary {
    color: var(--mud-palette-text-secondary) !important;
}

/* ==========================================================================
   HERO / LAYOUT
   ========================================================================== */

/* Sticky footer layout - ensures footer stays at bottom */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-content {
    flex: 1 0 auto;
}

/* Hero gradient - smooth radial blends using MudBlazor theme colors */
.hero-gradient {
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(var(--mud-palette-primary-rgb), 0.15), transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(var(--mud-palette-tertiary-rgb), 0.12), transparent 50%);
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 4rem 1rem;
}

/* Hero text gradient */
.hero-landing-gradient {
    background: linear-gradient(90deg, var(--mud-palette-primary) 0%, var(--mud-palette-tertiary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   CARDS
   ========================================================================== */

/* Base card styling (no animations) */
.avyra-card {
    background-color: var(--bg-primary-10);
    border: var(--border-1px-primary-30);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: left;
}

/* Dialog variant with solid background (no transparency) */
.avyra-dialog {
    background-color: var(--mud-palette-surface);
    border: var(--border-1px-primary-30);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Loadout card styling for MAUI Studio */
.loadout-grid {
    align-items: stretch !important;
}

.loadout-grid > .mud-grid-item {
    display: flex;
}

.loadout-card {
    position: relative;
    overflow: visible;
    background-color: var(--mud-palette-surface);
    border: var(--border-1px-primary-30);
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.loadout-card-active {
    box-shadow: 0 0 20px rgba(var(--mud-palette-primary-rgb), 0.3);
}

/* Animated card variant */
.avyra-card-animated {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avyra-card-animated:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-elevated) !important;
}

.avyra-card-animated:hover .feature-icon {
    background-color: var(--bg-primary-50) !important;
}

.avyra-card-animated:hover .feature-icon.icon-secondary {
    background-color: var(--bg-secondary-50) !important;
}

.avyra-card-animated:hover .feature-icon.icon-accent {
    background-color: var(--bg-tertiary-50) !important;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

/* Base AvyraButton styling */
.avyra-button {
    transition: var(--transition-all);
}

/* Gradient variant for AvyraButton */
.avyra-button-gradient,
.mud-button-gradient {
    background: linear-gradient(135deg,
        rgba(var(--mud-palette-primary-rgb), 1) 0%,
        rgba(var(--mud-palette-tertiary-rgb), 1) 100%) !important;
    color: white !important;
    border: none !important;
    transition: var(--transition-all);
}

.avyra-button-gradient:hover,
.mud-button-gradient:hover {
    background: linear-gradient(135deg,
        rgba(var(--mud-palette-primary-rgb), 0.9) 0%,
        rgba(var(--mud-palette-tertiary-rgb), 0.9) 100%) !important;
    box-shadow: 0 4px 12px rgba(var(--mud-palette-primary-rgb), 0.3) !important;
}

.avyra-button-gradient:active,
.mud-button-gradient:active {
    background: linear-gradient(135deg,
        rgba(var(--mud-palette-primary-rgb), 0.8) 0%,
        rgba(var(--mud-palette-tertiary-rgb), 0.8) 100%) !important;
}

/* ==========================================================================
   NAVIGATION / HEADER
   ========================================================================== */

/* App bar styles */
.avyra-app-bar {
    background-color: var(--mud-palette-appbar-background);
    color: var(--mud-palette-appbar-text);
    max-width: 1300px;
}

.avyra-app-bar-og {
    background-color: var(--mud-palette-appbar-background);
    color: var(--mud-palette-appbar-text);
    max-width: 1300px;
    border-radius: 0px 0px 16px 16px;
    box-shadow: 0px 0px 48px rgba(var(--mud-palette-background-rgb));
    border: var(--border-primary);
}

/* Header navigation links */
.header-nav-link {
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: var(--transition-opacity);
    cursor: pointer;
}

.header-nav-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* ==========================================================================
   FEATURE ELEMENTS
   ========================================================================== */

/* Icon container hover effect */
.feature-icon {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 3.2rem;
    padding: 0.75rem;
    background: var(--bg-primary-20);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Step number badge */
.feature-step-badge {
    background-color: var(--bg-primary-20);
    border-radius: var(--radius-md);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.feature-step-badge.feature-step-badge-primary {
    background-color: var(--bg-primary-20);
}

.feature-step-badge.feature-step-badge-secondary {
    background-color: var(--bg-secondary-20);
}

.feature-step-badge.feature-step-badge-tertiary {
    background-color: var(--bg-tertiary-20);
}

/* ==========================================================================
   USER MENU
   ========================================================================== */

/* User menu activator button with border */
.avyra-user-menu-activator {
    cursor: pointer;
    border: var(--border-1px-primary-30);
    border-radius: var(--radius-pill);
    padding: 4px 12px 4px 4px;
    transition: var(--transition-all);
}

.avyra-user-menu-activator:hover {
    opacity: 0.8;
}

/* Style the MudMenu popover for user menu */
.avyra-user-menu-popover {
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    box-shadow: var(--shadow-elevated) !important;
    border: var(--border-1px-primary-30) !important;
    background-color: rgba(var(--mud-palette-surface-rgb), 0.98) !important;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    margin-top: 4px !important;
}

/* User menu items styling */
.avyra-user-menu-popover .mud-list-item {
    border-radius: var(--radius-sm);
    margin: 4px 8px;
    transition: var(--transition-all);
}

.avyra-user-menu-popover .mud-list-item:hover {
    background-color: var(--bg-primary-10) !important;
}

/* Adjust padding for user menu */
.avyra-user-menu-popover .mud-list {
    padding: 8px 0;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

/* Footer gradient overlay - bottom to top */
.footer-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--bg-primary-5) 50%,
        var(--bg-primary-10) 100%
    );
    pointer-events: none;
}

/* Footer container with backdrop blur */
.footer-container {
    position: relative;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    background-color: rgba(var(--mud-palette-background-rgb), 0.95);
    border-top: var(--border-primary-20);
}

/* Link hover effect - animated dot indicator */
.footer-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-color);
}

.footer-link:hover {
    color: var(--mud-palette-primary);
}

.footer-link-dot {
    width: 0;
    height: 6px;
    background-color: var(--mud-palette-primary);
    border-radius: var(--radius-pill);
    transition: var(--transition-width);
}

.footer-link:hover .footer-link-dot {
    width: 6px;
}

/* Legal link with underline animation */
.legal-link {
    position: relative;
    transition: var(--transition-color);
}

.legal-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--mud-palette-primary);
    transition: var(--transition-width);
}

.legal-link:hover {
    color: var(--mud-palette-text-primary);
}

.legal-link:hover::after {
    width: 100%;
}

/* External link icon animation */
.external-icon {
    opacity: 0;
    transition: var(--transition-opacity);
}

.footer-link:hover .external-icon {
    opacity: 1;
}

/* ==========================================================================
   TERMS PAGE - TABLE OF CONTENTS
   ========================================================================== */

/* Hide TOC on mobile/tablet */
@media (max-width: 1279px) {
    .toc-sidebar {
        display: none;
    }
}

/* TOC navigation link styling */
.mud-nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-all);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
}

.mud-nav-link:hover {
    background-color: var(--bg-primary-10);
}

.mud-nav-link-active {
    color: var(--mud-palette-primary);
    background-color: var(--bg-primary-10);
}

/* Terms page bullet list styling */
.terms-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.terms-list li {
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

/* Fade-in animation keyframes */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll-triggered fade-in sections */
.fade-in-section {
    animation: fade-in-up 0.6s ease-out;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
}

/* Fallback for browsers that don't support animation-timeline */
@supports not (animation-timeline: view()) {
    .fade-in-section {
        animation: fade-in-up 0.6s ease-out;
    }
}

/* Pulse animation for LIVE badges */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */

/* Center MudAlert icon vertically - applies to all MudAlerts */
.mud-alert .mud-alert-icon {
    align-self: center;
}

/* AvyraAlert base styling */
.avyra-alert {
    /* Additional custom styling can be added here if needed */
}

/* ==========================================================================
   OBS OVERLAY STYLES
   ========================================================================== */

/* OBS Overlay Transparency - aggressive overrides for complete transparency */
html.overlay-page,
html.overlay-page body,
body.overlay-page,
.overlay-page,
.overlay-page *:not(.overlay-action-item):not(.overlay-badge):not(.overlay-test-panel):not(.mud-button-root):not(.mud-button-filled):not([class*="mud-button"]) {
    background: transparent !important;
    background-color: transparent !important;
}

/* Override MudBlazor theme backgrounds for overlay */
html.overlay-page {
    --mud-palette-background: transparent !important;
    --mud-palette-background-rgb: 0, 0, 0 !important;
    --mud-palette-surface: transparent !important;
}

/* Ensure body and all layout elements are transparent */
html.overlay-page body,
html.overlay-page .mud-layout,
html.overlay-page .mud-main-content,
html.overlay-page #app,
html.overlay-page #blazor-error-ui {
    background: transparent !important;
    background-color: transparent !important;
}

/* Overlay container styling - stacked layout for overlapping effect */
.overlay-container {
    padding: 46px;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
}

/* Wrapper for each action item to enable stacking with progressive scaling */
.overlay-action-item-wrapper {
    margin-top: -18px; /* Negative margin creates overlap - show ~60% of previous card */
    transform-origin: top center;
}

.overlay-action-item-wrapper:first-child {
    margin-top: 0; /* First item has no overlap */
    transform: scale(1); /* Full size */
    z-index: 50; /* Highest z-index - on top */
    position: relative;
    animation: overlay-slide-in-layer-1 0.3s ease-out;
}

.overlay-action-item-wrapper:nth-child(2) {
    transform: scale(0.98); /* 2% smaller */
    z-index: 40; /* Behind first */
    position: relative;
    animation: overlay-slide-in-layer-2 0.3s ease-out;
}

.overlay-action-item-wrapper:nth-child(3) {
    transform: scale(0.96); /* 4% smaller */
    z-index: 30; /* Behind second */
    position: relative;
    animation: overlay-slide-in-layer-3 0.3s ease-out;
}

.overlay-action-item-wrapper:nth-child(4) {
    transform: scale(0.94); /* 6% smaller */
    z-index: 20; /* Behind third */
    position: relative;
    animation: overlay-slide-in-layer-4 0.3s ease-out;
}

.overlay-action-item-wrapper:nth-child(5) {
    transform: scale(0.92); /* 8% smaller */
    z-index: 10; /* Behind fourth */
    position: relative;
    animation: overlay-slide-in-layer-5 0.3s ease-out;
}

/* Stack3d-style overlay action item */
.overlay-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 1); /* Solid black background, no opacity */
    border: 2px solid;
    transition: all 0.2s ease;
    min-height: 44px;
    position: relative;
    z-index: 1;
}

.overlay-action-item.executing {
    background: rgba(0, 0, 0, 1); /* Solid black background for running */
    transform: scale(1.02);
}

/* State badge/pill */
.overlay-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Action name */
.overlay-action-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status indicator */
.overlay-status-indicator {
    width: 16px;
    display: flex;
    justify-content: center;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.pulse {
    animation: overlay-pulse 1.5s ease-in-out infinite;
}

@keyframes overlay-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* Overlay Test Panel - Only visible when ?test=true */
.overlay-test-panel {
    position: fixed;
    bottom: 16px;
    left: 16px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    min-width: 140px;
}

.test-panel-header {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Avyra logo inside action item - left of badge */
.overlay-item-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* Slide-in animation keyframes - layer-specific to maintain scale during animation */
@keyframes overlay-slide-in-layer-1 {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(1);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes overlay-slide-in-layer-2 {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(0.98);
    }
}

@keyframes overlay-slide-in-layer-3 {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(0.96);
    }
}

@keyframes overlay-slide-in-layer-4 {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(0.94);
    }
}

@keyframes overlay-slide-in-layer-5 {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(0.92);
    }
}

/* Action content area with donor support */
.overlay-action-content {
    flex: 1;
    min-width: 0; /* Allow text truncation */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Ensure action name truncates properly */
.overlay-action-name {
    flex: none;
    font-size: 14px;
    font-weight: 500;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Donor name styling */
.overlay-donor-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* FAQ code blocks */
.faq-code-block {
    background: rgba(var(--mud-palette-text-primary-rgb), 0.05);
    border: 1px solid rgba(var(--mud-palette-text-primary-rgb), 0.1);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre;
    color: var(--mud-palette-text-primary);
}

.faq-code-block code {
    font-family: inherit;
    font-size: inherit;
    background: none;
    padding: 0;
    color: inherit;
}
