/* ============================================================================
   BETTERNAMER BLAZOR - MAIN STYLESHEET
   ============================================================================
   This CSS file provides styling for the BetterNamer Blazor application.
   It includes Bootstrap-MudBlazor integration, component-specific styles,
   theme handling, and utility classes.
   
   File Structure:
   1. CSS Variables & Root Styles
   2. Bootstrap Framework Overrides
   3. MudBlazor Framework Customizations
   4. Component-Specific Styles
   5. Theme-Specific Styles
   6. Animation & Transition Utilities
   7. Layout & Grid System Fixes
   8. Utility Classes
   ============================================================================ */

@import 'css/palette.css';

/* ============================================================================
   1. CSS Variables & Root Styles (incl. palette.css)
   ============================================================================ */

:root {
    --mud-typography-default-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-button-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-h1-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-h2-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-h3-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-h4-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-h5-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-h6-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-body1-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-body2-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-subtitle1-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-subtitle2-family: 'Inter', -apple-system, sans-serif !important;
    --mud-typography-caption-family: 'Inter', -apple-system, sans-serif !important;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* FocusOnNavigate in Routes.razor (Selector="h1") programmatically focuses the first h1
   on every page navigation for screen reader accessibility. Suppress the browser focus
   ring since headings are not interactive elements and this focus is never keyboard-initiated.
   Also covers the fallback case where Blazor focuses <main> when no h1 exists. */
h1:focus,
h2:focus,
h3:focus,
main:focus {
    outline: none;
}

/* Override MudBlazor heading colors to Eta --text (#f0f2ff) */
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6 {
    color: #f0f2ff !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
}
.mud-typography-h3 {
    font-size: clamp(28px, 3.5vw, 44px) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    line-height: 1.15 !important;
}
.mud-typography-body1,
.mud-typography-body2,
.mud-typography-subtitle1,
.mud-typography-subtitle2,
.mud-typography-caption {
    font-family: 'Inter', -apple-system, sans-serif !important;
}

/* Custom CSS property for rotating gradient animation */
@property --angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

/* ============================================================================
   2. BOOTSTRAP FRAMEWORK OVERRIDES
   ============================================================================ */

/* Primary button styling - matches MudBlazor color scheme */
.btn-primary {
    text-transform: none;
    --bs-btn-bg: var(--mud-palette-primary) !important;
    --bs-btn-hover-bg: var(--mud-palette-primary-darken) !important;
}

/* Navigation pills styling */
.nav-pills {
    --bs-nav-pills-link-active-bg: var(--mud-palette-primary) !important;
}

/* Navigation link colors */
.nav {
    --bs-nav-link-color: var(--mud-palette-primary) !important;
    --bs-nav-link-hover-color: var(--mud-palette-primary-darken) !important;
}

/* ============================================================================
   3. MUDBLAZOR FRAMEWORK CUSTOMIZATIONS
   ============================================================================ */

/* Button text transformation overrides */
.mud-button-label,
.mud-fab-label {
    text-transform: none !important;
}

/* Compact button icon spacing */
.compact-button .mud-button-icon-start {
    margin-right: 4px !important;
}

/* Chip close button positioning - move to start of flexbox */
.mud-chip-close-button {
    order: -1;
    margin-right: 6px !important;
    margin-left: 0px !important;
}

/* Fix MudBlazor grid overflow issues */
.mud-grid-spacing-xs-6 {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
}

.mud-grid-spacing-xs-6 > .mud-grid-item {
    padding-left: 0 !important;
    padding-top: 24px !important;
}

.mud-grid-spacing-xs-3 {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
}

.mud-grid-spacing-xs-3 > .mud-grid-item {
    padding-left: 0 !important;
    padding-top: 12px !important;
}

/* Remove padding from MudBlazor grid items globally */
.mud-item {
    /* padding: 0 !important; */
}

.mud-grid-item {
    /* padding: 0 !important; */
}

/* Specific spacing overrides for different grid sizes to ensure vertical separation */
.mud-grid-spacing-xs-1 > .mud-grid-item { padding-top: 4px !important; }
.mud-grid-spacing-xs-2 > .mud-grid-item { padding-top: 8px !important; }
.mud-grid-spacing-xs-4 > .mud-grid-item { padding-top: 16px !important; }
.mud-grid-spacing-xs-5 > .mud-grid-item { padding-top: 20px !important; }
.mud-grid-spacing-xs-7 > .mud-grid-item { padding-top: 28px !important; }
.mud-grid-spacing-xs-8 > .mud-grid-item { padding-top: 32px !important; }
.mud-grid-spacing-xs-9 > .mud-grid-item { padding-top: 36px !important; }
.mud-grid-spacing-xs-10 > .mud-grid-item { padding-top: 40px !important; }

/* ============================================================================
   4. COMPONENT-SPECIFIC STYLES
   ============================================================================ */

/* --------------------------------------------------------------------------
   Name Option Rows (Search Results)
   -------------------------------------------------------------------------- */
/* Utility helpers used by SearchView components */
.flex { display: flex !important; }
.align-center { align-items: center !important; }
.justify-start { justify-content: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.position-relative { position: relative !important; }
.m-0 { margin: 0 !important; }
.mt-4 { margin-top: 4px !important; }
.mb-4 { margin-bottom: 4px !important; }
.ml-10 { margin-left: 10px !important; }
.mr-10 { margin-right: 10px !important; }
.ml-15 { margin-left: 15px !important; }
.mr-15 { margin-right: 15px !important; }
.ml-20 { margin-left: 20px !important; }
.mr-20 { margin-right: 20px !important; }
.mt-25 { margin-top: 25px !important; }
.mb-5 { margin-bottom: 5px !important; }
.py-5 { padding-top: 5px !important; padding-bottom: 5px !important; }
.p-5 { padding: 5px !important; }
.pt-2 { padding-top: 2px !important; }
.pb-2 { padding-bottom: 2px !important; }
.no-border { border-width: 0 !important; }
.pill-button { border-radius: 50px !important; }
.align-content-center { align-content: center !important; }
.w-100 { width: 100% !important; }

/* --------------------------------------------------------------------------
   Pricing section
   -------------------------------------------------------------------------- */
.pricing-cta-wrap {
    margin-top: 8px;
    margin-bottom: 20px;
}

/* Make CTAs fully rounded and slightly smaller */
.mud-button.pricing-cta {
    border-radius: 9999px !important;
    padding: 8px 14px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    min-height: 36px;
}

@media (min-width: 600px) {
    .mud-button.pricing-cta { min-height: 40px; }
}

/* NameOptionList specific */
.name-option-list-container { 
    width: 100%; 
}
.name-option-list-top-controls { padding: 4px 16px 12px 16px; }

/* NameOptionRow specific */
.tm-badge { 
    font-weight: bold; 
    font-size: 16px; 
    display: flex; 
    align-items: center; 
    min-width: 24px; 
    justify-content: center; 
    margin-right: 4px;
}
.score-indicator {
    border-radius: 50px;
    color: dodgerblue;
    font-family: Helvetica, serif;
    font-weight: bold;
    font-size: 1.5em;
    font-stretch: extra-condensed;
    margin-left: 5px;
    margin-right: 15px;
    padding: 0px;
    min-width: 32px;
    /*height: 36px;*/
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.name-option-detail-name {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.name-option-row {
    position: relative;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
    border: none;
    margin-top: 6px;
    margin-bottom: 6px;
    padding-inline: 15px;
    padding-bottom: 4px;
    border-radius: 10px;
    background-color: color-mix(in srgb, var(--mud-palette-surface) 60%, transparent);
    max-width: 100%;
    overflow-x: hidden;
}

.name-option-row-selected {
    /*background-color: color-mix(in srgb, var(--mud-palette-primary) 15%, var(--mud-palette-surface)) !important;
    border-color: var(--mud-palette-primary) !important;
    border-color: var(--mud-palette-primary-darken) !important;*/
    border: none !important;
    box-shadow: 0 0 0 1px red inset !important;
}

.name-option-row-header.name-option-row-selected {
    border: none !important;
    box-shadow: none !important;
}


.name-option-row-expanded {
    border-color: var(--mud-palette-primary) !important;
}

.name-option-row-hidden {
    opacity: 0.65;
}

/* Update dot for new or updated name options */
.name-option-update-dot {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: #ff9800; /* Orange color */
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    transition: opacity 100ms ease;
}

/* Hide dot immediately when the row is hovered */
.name-option-row:hover .name-option-update-dot {
    opacity: 0;
}

/* Name option divider styling */
.name-option-divider {
    border-color: color-mix(in srgb, var(--mud-palette-lines-default), transparent 70%) !important;
    max-width: calc(100% - 40px);
    margin-left: 20px !important;
    margin-right: 20px !important;
}

/* Name text size animation for expanded state (use transform scale for smooth, sharp rendering) */
.name-option-name-normal,
.name-option-name-expanded {
    display: inline-block;
    transform-origin: left center;
    transition: transform 120ms ease-in-out;
    will-change: transform;
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
}

.name-option-name-normal {
    transform: scale(1);
    color: rgba(255, 255, 255, 0.8) !important;
}

.name-option-name-expanded {
    transform: scale(1.2);
    color: rgba(255, 255, 255, 1) !important;
}

/* --------------------------------------------------------------------------
   Domain Chips
   -------------------------------------------------------------------------- */
.domain-chip {
    border: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.2));
    border-radius: 16px;
    padding-inline: 6px;
    padding-block: 0px;
    margin-inline: 2px;
    margin-block: 2px;
    height: 24px !important;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.domain-chip.available {
    color: var(--mud-palette-info, #0288D1);
    border-color: var(--mud-palette-info, #0288D1);
}

.domain-chip.unavailable {
    color: var(--mud-palette-text-secondary, rgba(0,0,0,0.54));
    border-color: var(--mud-palette-lines-default, rgba(0,0,0,0.2));
}

.domain-chip.preferred:not(.selected).available {
    border-color: var(--mud-palette-primary, #1976d2);
}

.domain-chip.selected {
    background-color: var(--mud-palette-primary, #1976d2) !important;
    color: var(--mud-palette-primary-text, #fff) !important;
    border-color: var(--mud-palette-primary-darken, #115293) !important;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

/* Domain favorite gold styling */
.domain-chip.favorited .mud-chip-close .mud-icon-root,
.domain-chip.favorited .mud-chip-close-button .mud-icon-root,
.domain-chip.selected.favorited .mud-chip-close .mud-icon-root,
.domain-chip.selected.favorited .mud-chip-close-button .mud-icon-root {
    color: #FFD700 !important;
}

.domain-fav-btn.favorited .mud-icon-root {
    color: #FFD700 !important;
}

/* --------------------------------------------------------------------------
   Back Button (SearchView)
   -------------------------------------------------------------------------- */
/* Back button styling matching public hero secondary button */
.back-button {
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
    color: white !important;
    border-radius: 50px !important;
    text-transform: none !important;
    font-weight: 600 !important;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: white !important;
}

/* Menu activator buttons that don't need a border */
.menu-activator-button {
    border: none !important;
    color: white !important;
    border-radius: 50px !important;
    text-transform: none !important;
    font-weight: 400 !important;
    transition: background-color 160ms ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5), 
                 0 2px 4px rgba(0,0,0,0.4);
}

.menu-activator-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* --------------------------------------------------------------------------
   Search Header Textbox
   -------------------------------------------------------------------------- */

/* Transparent paper background for non-editing state */
.search-header-labelpaper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
    gap: 8px !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 20px !important;
    position: relative; /* raise above overlay */
    z-index: 1101;      /* overlay is 1000 */
}

/* Paper background with styling for editing state */
.search-header-labelpaper-editing {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
    padding: 16px !important;
    gap: 8px !important;
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--mud-elevation-4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    position: relative; /* raise above overlay when editing */
    z-index: 1101;      /* overlay is 1000 */
    color: white !important;
}

/* Search header buttons with fade-in animation */
.search-header-labelpaper-editing {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Custom button class with 20px border radius and increased font size */
.search-header-titlebutton {
    border-radius: 20px !important;
    font-size: 2em !important;
    padding: 12px 20px !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3), 
                 0 2px 4px rgba(0,0,0,0.2);
}

.centered-textfield input {
    text-align: center !important;
    color: white !important;
}

/* --------------------------------------------------------------------------
   Subsearch Components
   -------------------------------------------------------------------------- */
.subsearch-card {
    transition: background-color 140ms ease, box-shadow 140ms ease, border-color 140ms ease, transform 140ms ease;
    border-radius: 10px;
    /* Prevent initial vertical scrollbar flash on expand */
    overflow: hidden;
    /* Keep layout stable if scrollbars would appear */
    scrollbar-gutter: stable both-edges;
}

.subsearch-card:hover {
    background-color: rgba(0, 0, 0, 0.03);
    box-shadow: none !important;
}

/* Subsearch dialog styling */
.subsearch-dialog {
    border-radius: 10px !important;
    border: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.2)) !important;
    overflow: hidden;
    aspect-ratio: 5 / 3;
    max-height: 80vh;
}

.subsearch-dialog .mud-dialog-content {
    max-height: calc(80vh - 32px);
    overflow: auto;
}

/* --------------------------------------------------------------------------
   Navigation Bar
   -------------------------------------------------------------------------- */
/* Base navbar: fully transparent at top of page. Background, blur, and shadow
   fade in via .mudstrap-navbar--shrink-bg when the page is scrolled. Mirrors
   the Eta StyleTest behavior. */
.mud-theme-default .mudstrap-navbar,
.mudstrap-navbar {
    position: sticky !important;
    top: 0;
    z-index: 1100;
    height: 64px;
    min-height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px !important;
    transition: background 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border-bottom: none !important;
}
/* Kill MudAppBar's inner toolbar background so only .mudstrap-navbar shows */
.mudstrap-navbar .mud-appbar-toolbar,
.mudstrap-navbar .navtoolbar {
    background: transparent !important;
    box-shadow: none !important;
    min-height: unset !important;
    padding: 0 !important;
}

/* Scrolled state: fade in dark translucent background, blur, and shadow */
.mud-theme-default .mudstrap-navbar.mudstrap-navbar--shrink-bg,
.mudstrap-navbar.mudstrap-navbar--shrink-bg {
    background: rgba(9, 10, 15, 0.9) !important;
    backdrop-filter: blur(22px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(140%) !important;
    box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0, 0, 0, 0.45) !important;
}

/* MudMainContent reserves padding-top equal to the appbar height by default,
   which leaves a visible empty band below our sticky (in-flow) navbar. Strip
   it: the sticky navbar already occupies its own space. */
.mud-main-content {
    padding-top: 0 !important;
}

/* Navbar toolbar layout — logo + links left, actions right */
.mud-appbar .navtoolbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
}

.mudstrap-navbar.mud-appbar {
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* The inner container for width constraint */
.mudstrap-navbar .d-flex.align-center.justify-space-between {
    gap: 0 !important;
}

/* Scrollspy container left-aligned (directly after logo) */
.nav-scroll-spy-container {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 4px;
    flex: 1;
    margin-left: 8px; /* tight spacing after logo */
    height: 100%;
}

.nav-scroll-spy-button.mud-button-root {
    color: #7a85a8 !important;        /* Eta --text-muted (explicit, beats MudBlazor's ActionDefault) */
    background: transparent !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    text-transform: none !important;
    min-width: unset !important;
    min-height: unset !important;
    height: auto !important;
    line-height: 1.4 !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
    transition: color 0.2s, background 0.2s;
}
.nav-scroll-spy-button.mud-button-root:hover {
    color: #f0f2ff !important;        /* Eta --text on hover */
    background: rgba(255,255,255,0.05) !important;
}
.nav-scroll-spy-button.mud-button-root .mud-button-label,
.nav-scroll-spy-button.mud-button-root .mud-button-label * {
    color: inherit !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
}

/* Active scrollspy button — brighter white text */
.nav-scroll-spy-button.mud-button-root.nav-scroll-spy-button--active,
.nav-scroll-spy-button.mud-button-root.nav-scroll-spy-button--active .mud-button-label,
.nav-scroll-spy-button.mud-button-root.nav-scroll-spy-button--active .mud-button-label * {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.nav-scroll-spy-indicator {
    position: absolute;
    bottom: -1px !important;
    height: 2px !important;
    background: var(--accent) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px 2px 0 0;
    z-index: 10;
    pointer-events: none;
}

/* Navbar Highlight Button (Sign Up) */
.nav-btn-highlight {
    color: white !important;
    border-radius: 6px !important;
    text-transform: none !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s !important;
}
.nav-btn-highlight:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
    opacity: 1 !important;
}

.nav-signin-link {
    text-transform: none !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    border-radius: 6px !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
}
.nav-signin-link:hover {
    color: var(--text) !important;
    background: rgba(255,255,255,0.05) !important;
}

/* Common Effects */
.primary-gradient {
    background: #D63030 !important;
}

.primary-gradient-border {
    position: relative;
    border: none !important;
}

.primary-gradient-border::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: #D63030;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
}

.primary-gradient-border > .mud-card-header,
.primary-gradient-border > .mud-card-content,
.primary-gradient-border > .mud-card-actions,
.primary-gradient-border > .absolute {
    position: relative;
    z-index: 1;
}

/* Navbar Highlight Button */
.nav-btn-highlight {
    color: white !important;
    border-radius: 6px !important;
    text-transform: none !important;
    font-weight: 500 !important;
    padding: 6px 20px !important;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out !important;
}

.nav-btn-highlight:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(214, 48, 48, 0.3);
    opacity: 0.9;
}

.nav-signin-link {
    text-transform: none !important;
    font-weight: 500 !important;
    color: var(--mud-palette-text-primary) !important;
}

/* Authed-user navbar actions: cart icon + (chevron / first name / avatar) menu */
.nav-cart-btn.mud-button-root {
    color: var(--text-muted, #7a85a8) !important;
    border-radius: 6px !important;
}
.nav-cart-btn.mud-button-root:hover {
    color: var(--text, #f0f2ff) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.user-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text, #f0f2ff);
    padding: 6px 6px 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}
.user-menu:hover {
    background: rgba(255, 255, 255, 0.05);
}
.user-menu-chevron.mud-icon-root {
    font-size: 18px !important;
    width: 18px;
    height: 18px;
    color: var(--text-muted, #7a85a8);
}
.user-menu-name {
    color: var(--text, #f0f2ff);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent, #D63030);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    overflow: hidden;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.user-avatar--image {
    object-fit: cover;
}

/* Active (open) state for the cart button — keeps a subtle highlight while the
   mini-cart dropdown is open. */
.nav-cart-btn.mud-button-root.nav-cart-btn--active {
    color: var(--text, #f0f2ff) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

/* --------------------------------------------------------------------------
   Mini-cart dropdown
   Anchored under the cart icon inside the (sticky) navbar, so it stays pinned
   in place as the page scrolls. The wrapper is the positioning context; the
   transparent fixed backdrop captures outside clicks to dismiss.
   -------------------------------------------------------------------------- */
.nav-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cart-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: transparent;
}

.cart-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 1200;
    width: 360px;
    max-width: calc(100vw - 32px);
    display: flex;
    flex-direction: column;
    background: var(--surface, #10131e);
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    transform-origin: top right;
    animation: cart-dropdown-in 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cart-dropdown-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.cart-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}
.cart-dropdown__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #f0f2ff);
}
.cart-dropdown__title-icon.mud-icon-root {
    font-size: 20px !important;
    color: var(--text-muted, #7a85a8);
}
.cart-dropdown__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent, #D63030);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.cart-dropdown__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #7a85a8);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.cart-dropdown__close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text, #f0f2ff);
}
.cart-dropdown__close .mud-icon-root {
    font-size: 18px !important;
}

/* Body */
.cart-dropdown__body {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: min(60vh, 420px);
    padding: 8px;
}

/* Empty state */
.cart-dropdown__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 16px 40px;
    gap: 4px;
}
.cart-dropdown__empty-icon.mud-icon-root {
    font-size: 40px !important;
    color: var(--text-faint, #363e58);
    margin-bottom: 6px;
}
.cart-dropdown__empty-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #f0f2ff);
}
.cart-dropdown__empty-sub {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted, #7a85a8);
}

/* Item rows */
.cart-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.cart-row:hover {
    background: rgba(255, 255, 255, 0.04);
}
.cart-row + .cart-row {
    margin-top: 2px;
}
.cart-row__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cart-row__domain {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #f0f2ff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-row__meta {
    font-size: 12px;
    color: var(--text-muted, #7a85a8);
}
.cart-row__dot {
    margin: 0 4px;
    opacity: 0.6;
}
.cart-row__right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.cart-row__price {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text, #f0f2ff);
    font-variant-numeric: tabular-nums;
}
.cart-row__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #7a85a8);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.cart-row__remove:hover {
    background: var(--accent-dim, rgba(214, 48, 48, 0.1));
    color: var(--accent, #D63030);
}
.cart-row__remove .mud-icon-root {
    font-size: 16px !important;
}

/* Footer */
.cart-dropdown__footer {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}
.cart-dropdown__total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-muted, #7a85a8);
}
.cart-dropdown__total-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text, #f0f2ff);
    font-variant-numeric: tabular-nums;
}
.cart-dropdown__checkout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    border: none;
    border-radius: 8px;
    background: var(--accent, #D63030);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.cart-dropdown__checkout:hover {
    background: var(--accent-hover, #be2525);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow, rgba(214, 48, 48, 0.15));
}
.cart-dropdown__checkout:active {
    transform: translateY(0);
}
.cart-dropdown__checkout-icon.mud-icon-root {
    font-size: 18px !important;
}

/* Narrow viewports: pin the panel to the right gutter and let it use the
   available width so it never runs off-screen. */
@media (max-width: 480px) {
    .cart-dropdown {
        position: fixed;
        top: 64px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
    }
}

/* --------------------------------------------------------------------------
   Back to Top FAB
   -------------------------------------------------------------------------- */
.back-to-top {
    position: fixed;
    right: 40px;
    bottom: 30px;
    z-index: 1200;
    transition: opacity 180ms ease-in-out;
    background-color: rgba(255,255,255,0.14) !important;
    color: rgba(255,255,255,0.92) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25) !important;
    opacity: 0;
    pointer-events: none;
}

.back-to-top.back-to-top--visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   5. THEME-SPECIFIC STYLES
   ============================================================================ */

/* --------------------------------------------------------------------------
   Dark Theme Overrides
   -------------------------------------------------------------------------- */

.mud-theme-dark .subsearch-card:hover {
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: none !important;
}

/* Dark theme navbar inherits the base navbar styles — no overrides needed */

.mud-theme-dark .back-to-top {
    background-color: rgba(0,0,0,0.4) !important;
    color: rgba(255,255,255,0.92) !important;
}

/* --------------------------------------------------------------------------
   Light Theme Hover Effects
   -------------------------------------------------------------------------- */
/* Generic hover fallback */
.name-option-row:hover,
.mud-paper.name-option-row:hover {
    background-color: rgba(100, 100, 255, 0.2) !important;
    box-shadow: none !important;
}

/* Explicit light theme hover */
.mud-theme-default .name-option-row:hover,
.mud-theme-light .name-option-row:hover,
.mud-theme-default .mud-paper.name-option-row:hover,
.mud-theme-light .mud-paper.name-option-row:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
    box-shadow: none !important;
}

/* --------------------------------------------------------------------------
   Dark Theme Hover Effects
   -------------------------------------------------------------------------- */
.mud-theme-dark .name-option-row:hover,
.mud-theme-dark .mud-paper.name-option-row:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
    box-shadow: none !important;
}

/* Ensure selected rows keep their border on hover (overrides generic hover rules) */
.name-option-row-selected:hover,
.mud-paper.name-option-row-selected:hover {
    /* Re-apply the selected border via inset shadow */
    box-shadow: 0 0 0 1px red inset !important;
}

.name-option-row-header.name-option-row-selected:hover {
    border: none !important;
    box-shadow: none !important;
}

/* --------------------------------------------------------------------------
   SearchView Background Gradients
   -------------------------------------------------------------------------- */
/* Default/Light theme gradient background */
.mud-layout {
    background-color: var(--bg, #090a0f) !important;
    background-image:
            radial-gradient(ellipse 120% 80% at 50% -10%, rgba(214, 48, 48, 0.15) 0%, transparent 60%),
            radial-gradient(ellipse 60% 60% at 10% 100%, rgba(214, 48, 48, 0.06) 0%, transparent 50%),
            radial-gradient(ellipse 60% 60% at 90% 100%, rgba(214, 48, 48, 0.04) 0%, transparent 50%) !important;
    background-attachment: fixed;
}

.search-view-page {
    --search-hero-core: rgba(255, 116, 44, 0.34);
    --search-hero-core-soft: rgba(214, 48, 48, 0.24);
    --search-hero-side: rgba(255, 151, 84, 0.14);
    --search-hero-side-strong: rgba(255, 128, 52, 0.18);
    --search-hero-highlight: rgba(255, 214, 168, 0.11);
    position: relative;
    z-index: 0;
    isolation: isolate;
    margin-top: -64px;
    padding-top: 64px;
    overflow-x: clip;
    overflow-y: visible;
}

.search-view-page:not(.search-view-page--eta19)::before {
    content: "";
    position: absolute;
    left: -160px;
    right: -160px;
    top: -120px;
    height: min(980px, calc(100vh + 220px));
    pointer-events: none;
    z-index: -2;
    background:
        radial-gradient(ellipse at center, var(--search-hero-core) 0%, var(--search-hero-core-soft) 34%, rgba(214, 48, 48, 0.08) 52%, transparent 74%),
        radial-gradient(ellipse at center, var(--search-hero-side) 0%, transparent 72%),
        radial-gradient(ellipse at center, var(--search-hero-side-strong) 0%, transparent 74%),
        radial-gradient(ellipse at center, var(--search-hero-highlight) 0%, transparent 78%);
    background-repeat: no-repeat;
    background-size: 118% 82%, 42% 38%, 40% 36%, 22% 18%;
    background-position: 50% 10%, 15% 62%, 85% 58%, 50% 34%;
    filter: saturate(115%);
    opacity: 0.92;
    will-change: background-position, opacity;
    animation: searchview-hero-ambient 18s ease-in-out infinite alternate;
}

.search-view-page:not(.search-view-page--eta19)::after {
    content: "";
    position: absolute;
    left: -120px;
    right: -120px;
    top: -32px;
    height: min(840px, calc(100vh + 120px));
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle, rgba(255, 122, 44, 0.12) 0%, transparent 26%),
        radial-gradient(circle, rgba(255, 170, 104, 0.08) 0%, transparent 24%),
        radial-gradient(circle, rgba(255, 216, 176, 0.10) 0%, transparent 21%);
    background-repeat: no-repeat;
    background-size: 28% 28%, 24% 24%, 20% 20%;
    background-position: 24% 44%, 76% 40%, 50% 22%;
    filter: blur(28px);
    opacity: 0.9;
    will-change: background-position, opacity;
    animation: searchview-hero-drift 26s ease-in-out infinite alternate;
}

.searchview-hero {
    position: relative;
    width: 100%;
    padding-top: 18px;
    padding-bottom: 32px;
    overflow-x: visible;
    overflow-y: visible;
    z-index: 1;
}

.searchview-hero__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.search-view-layout {
    position: relative;
    z-index: 1;
    width: min(100%, 1644px);
    max-width: calc(100vw - 32px);
    display: grid;
    grid-template-columns: minmax(300px, 720px) minmax(360px, 900px);
    gap: 24px;
    justify-content: center;
    align-items: start;
    margin-top: 16px;
    box-sizing: border-box;
}

.search-view-list-column {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
}

.search-view-detail-column {
    z-index: 1;
    position: sticky;
    top: 24px;
    height: calc(100vh - 120px);
    min-height: 600px;
    min-width: 0;
}

@media (max-width: 1180px) {
    .search-view-layout {
        grid-template-columns: minmax(0, 1fr);
        max-width: calc(100vw - 24px);
    }

    .search-view-detail-column {
        position: static;
        height: auto;
        min-height: 0;
    }
}

@keyframes searchview-hero-ambient {
    0% {
        background-position: 49% 9%, 14% 61%, 86% 57%, 50% 33%;
        opacity: 0.82;
    }
    50% {
        background-position: 51% 11%, 17% 63%, 83% 59%, 51% 35%;
        opacity: 0.94;
    }
    100% {
        background-position: 50% 10%, 15% 60%, 85% 60%, 49% 32%;
        opacity: 0.86;
    }
}

@keyframes searchview-hero-drift {
    0% {
        background-position: 23% 43%, 77% 39%, 49% 21%;
        opacity: 0.52;
    }
    50% {
        background-position: 26% 46%, 74% 42%, 51% 24%;
        opacity: 0.78;
    }
    100% {
        background-position: 25% 44%, 76% 41%, 50% 22%;
        opacity: 0.62;
    }
}

@media (max-width: 900px) {
    .search-view-page::before {
        left: -100px;
        right: -100px;
        height: 640px;
    }

    .search-view-page::after {
        left: -72px;
        right: -72px;
        height: 560px;
        filter: blur(24px);
    }

    .searchview-hero {
        padding-bottom: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-view-page::before,
    .search-view-page::after {
        animation: none;
    }
}

.colorful-bg { display: none !important; }

.mud-popover .mud-paper,
.mud-popover.mud-paper,
.mud-menu .mud-paper {
    background: var(--surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid var(--border-strong) !important;
}
.mud-paper:not(.mud-popover):not(.mud-dialog):not(.mud-menu-list):not(.search-header-labelpaper):not(.search-header-labelpaper-editing):not(.favorites-list-paper):not(.others-list-paper):not(.pricing-card) {
    background: var(--surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* --------------------------------------------------------------------------
   Dropdown menus (MudMenu) & select/autocomplete popovers
   The popover surface + border are themed above; these rules give the list
   items a consistent, branded look so the profile, sort, filter, TLD, and
   select dropdowns all match the Eta palette (brand-red accent on hover and
   for the selected option).
   -------------------------------------------------------------------------- */
.mud-popover .mud-list {
    padding: 6px !important;
}
.mud-popover .mud-list-item-clickable {
    border-radius: 8px !important;
    transition: background-color 0.12s ease, color 0.12s ease !important;
}
.mud-popover .mud-list-item-clickable:hover {
    background-color: var(--accent-dim, rgba(214, 48, 48, 0.1)) !important;
}
.mud-popover .mud-selected-item {
    background-color: var(--accent-dim, rgba(214, 48, 48, 0.1)) !important;
    color: var(--accent, #d63030) !important;
}
.mud-popover .mud-divider {
    border-color: var(--border-strong, rgba(255, 255, 255, 0.1)) !important;
    margin: 6px 8px !important;
}

/* ============================================================================
   6. ANIMATION & TRANSITION UTILITIES
   ============================================================================ */

/* --------------------------------------------------------------------------
   Fade Animations
   -------------------------------------------------------------------------- */
.fade-in {
    opacity: 1;
    transition: opacity 0.15s ease-in-out !important;
}

.fade-out {
    opacity: 0;
    transition: opacity 0.15s ease-in-out !important;
}

/* --------------------------------------------------------------------------
   Sideways Collapse Animation
   -------------------------------------------------------------------------- */
.sideways-collapse {
    display: inline-block;
    vertical-align: top;
}

.sideways-collapse-wrapper {
    overflow: hidden;
    width: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
}

.sideways-collapse-wrapper.expanded {
    width: auto;
}

.sideways-collapse-content {
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition:
            opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
            transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
    will-change: opacity, transform;
}

.sideways-collapse-wrapper.expanded .sideways-collapse-content {
    opacity: 1;
    transform: translateX(0);
    transition:
            opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.2s,
            transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

/* Left direction variant */
.sideways-collapse.sideways-collapse-direction-left .sideways-collapse-content {
    transform: translateX(10px);
}

/* Disabled animation */
.sideways-collapse.sideways-collapse-no-animation .sideways-collapse-wrapper,
.sideways-collapse.sideways-collapse-no-animation .sideways-collapse-content {
    transition: none !important;
}

/* --------------------------------------------------------------------------
   Keyframe Animations
   -------------------------------------------------------------------------- */

/* ============================================================================
   7. LAYOUT & RESPONSIVE DESIGN
   ============================================================================ */

/* Main content scroll compensation for sticky navbar */
body .mud-main-content, .mud-layout .mud-main-content {
    scroll-margin-top: 72px;
}

/* Responsive navbar behavior */
@media (max-width: 599.98px) {
    .mud-appbar .navtoolbar { 
        display: none; 
    }
}

/* ============================================================================
   8. FOOTER STYLES
   Footer styling is handled in Footer.razor component <style> block.
   ============================================================================ */

/* ============================================================================
   9. UTILITY CLASSES
   ============================================================================ */

/* Additional utility classes can be added here as needed */

/* End of stylesheet */


/* ============================================================================
   9. Blazor Reconnecting & Error UI — MudBlazor Themed
   ============================================================================ */
/* Notes:
   - Styles the built-in Blazor Server reconnect modal and Blazor error banner to
     visually match MudBlazor theming.
   - Uses MudBlazor CSS variables so it adapts to light/dark themes automatically.
*/

/* Base overlay for reconnect modal */
#components-reconnect-modal {
    position: fixed;
    inset: 0;
    display: none; /* Shown via state classes below */
    align-items: center;
    justify-content: center;
    background: transparent !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10000; /* Above app bar, drawers, dialogs */
    padding: 16px;
    /* Delay visibility slightly to avoid flicker on brief interruptions */
    opacity: 0;
    visibility: hidden;
    transition: visibility 0s linear 0.5s, opacity 0.5s linear;
}

/* Show/Hide states controlled by Blazor */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
    /* Become visible after a short delay; fade in smoothly */
    visibility: visible;
    opacity: 1;
    transition: opacity 0.2s ease-in;
}

/* Reconnect content container styled like a MudBlazor dialog */
#components-reconnect-modal > .reconnect-content,
#components-reconnect-modal > .components-reconnect-show,
#components-reconnect-modal > .components-reconnect-failed,
#components-reconnect-modal > .components-reconnect-rejected {
    font-family: var(--mud-typography-button-family, inherit);
    color: var(--mud-palette-primary-text, #fff);
    background-color: #1e1e1e !important; /* Force dark dialog background in all themes */
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
    padding: 18px 20px;
    max-width: 520px;
    width: min(520px, 92vw);
    text-align: center;
}

/* State-specific accent bar (top border) */
#components-reconnect-modal > .components-reconnect-show {
    border-top: 4px solid var(--mud-palette-primary, #1976d2);
}
#components-reconnect-modal > .components-reconnect-failed {
    border-top: 4px solid var(--mud-palette-warning, #FFA000);
}
#components-reconnect-modal > .components-reconnect-rejected {
    border-top: 4px solid var(--mud-palette-error, #F44336);
}

/* Text nuances */
#components-reconnect-modal .title {
    font-weight: 600;
    margin-bottom: 4px;
}
#components-reconnect-modal .message {
    opacity: 0.9;
}

/* Provide a subtle pulse while attempting to reconnect */
#components-reconnect-modal.components-reconnect-show > .components-reconnect-show {
    animation: bn-reconnect-pulse 1.2s ease-in-out infinite;
}
@keyframes bn-reconnect-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}
