/*Changing primary button color*/
:root {
    --rz-primary: #3e5b87;

    /* ============================================
       CYBERPUNK SYSTEM HEALTH THEME - CSS Variables
       These must be global to work with scoped CSS
       ============================================ */
    --neon-cyan: #00f5ff;
    --neon-magenta: #ff00ff;
    --neon-purple: #a855f7;
    --neon-green: #00ff88;
    --neon-orange: #ff6b35;
    --neon-blue: #3b82f6;
    --dark-bg: #0a0a0f;
    --dark-surface: #12121a;
    --dark-card: #1a1a25;
    --dark-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(20, 20, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* ============================================
       CHAT COMPONENT THEME - CSS Variables
       Refined, professional palette with cyan accents
       ============================================ */
    --chat-accent: #00d4ff;
    /* Cyan - primary accent */
    --chat-accent-dim: rgba(0, 212, 255, 0.6);
    --chat-user-gradient-start: #3b82f6;
    /* Blue for user messages */
    --chat-user-gradient-end: #1d4ed8;
    --chat-glow: rgba(0, 212, 255, 0.4);
    --chat-glow-soft: rgba(0, 212, 255, 0.15);
    --chat-surface: rgba(30, 30, 40, 0.6);
    --chat-surface-solid: #1e1e28;
    --chat-card-bg: rgba(40, 40, 55, 0.8);
    --chat-border: rgba(255, 255, 255, 0.08);
    --chat-border-glow: rgba(0, 212, 255, 0.3);
    --chat-text-primary: #e8eaed;
    --chat-text-secondary: rgba(232, 234, 237, 0.7);
    --chat-text-muted: rgba(232, 234, 237, 0.4);
}


/* Default style for a link */
/*a {
    color: var(--rz-text-color);*/
/* Normal link color */
/*text-decoration: none;*/
/* Remove underline */
/*}*/

/* Style for visited links */
/*a:visited {
        color: var(--rz-text-secondary-color);*/
/* Visited link color */
/*}*/


.custom-image {
    max-width: 100vw;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 8px;
    /*opacity: 0;*/
}



.lobby-image {
    max-width: 100vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
}

body.page-loaded .custom-image {
    opacity: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    opacity: 0;
    /* Start hidden */
    animation: fadeIn 2s ease-in-out forwards;
    /* Animate to full opacity */
}

/* ============================================
   "WOW FACTOR" POLISH - Shimmer & Hover Effects
   ============================================ */

/* Shimmer animation for headings */
@keyframes shimmer {
    0% {
        background-position: 200% center;
    }

    100% {
        background-position: -200% center;
    }
}

.shimmer-text {
    background: linear-gradient(90deg,
            var(--chat-text-primary) 0%,
            var(--chat-text-primary) 40%,
            var(--chat-accent) 50%,
            var(--chat-text-primary) 60%,
            var(--chat-text-primary) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 6s linear infinite;
}

/* Always-on glow effect for images - subtle */
.image-glow {
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.4));
}

/* ============================================
   ANIMATED BORDER EFFECTS - Global CSS
   
   WHY GLOBAL: Scoped CSS in Blazor cannot use 
   pseudo-elements (::before, ::after) that penetrate
   into child components like RadzenCard. The scoped
   attribute is only added to elements directly 
   rendered by the component, not to internal elements
   of child components or pseudo-elements.
   ============================================ */

@keyframes fadeInBorder {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}


@keyframes borderFlowGlobal {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}



/* Keyframe for glowing accent bar - only animates box-shadow, NOT opacity
   Opacity is controlled separately via transitions for fade in/out */
@keyframes accentBarGlowGlobal {

    0%,
    100% {
        box-shadow: 0 0 8px var(--chat-accent);
    }

    50% {
        box-shadow: 0 0 15px var(--chat-accent);
    }
}

/* ============================================
   CHAT MESSAGE BORDER STYLES
   Applied to .assistant-message-card via class
   
   WHY GLOBAL: RadzenCard renders its own internal
   structure. Scoped CSS pseudo-elements cannot
   attach to RadzenCard's rendered output.
   ============================================ */

/* ============================================
   CHAT MESSAGE CARD STYLING
   Must be global because RadzenCard doesn't 
   receive scoped CSS attributes
   ============================================ */

/* ============================================ 
   NUCLEAR FIX: Chat Message Card Spacing
   ============================================ */

/* Target the RadzenCard by combining multiple classes for maximum specificity */
div.rz-card.message-card.assistant-message-card,
div.rz-card.message-card.user-message-card {
    padding: 0.75rem 1rem !important;
    /* Fixed: Reduced for more compact looks */
    border-radius: 18px !important;
    position: relative !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Force spacing on the direct children to double-ensure no touching edges */
.assistant-message-card>div,
.user-message-card>div {
    margin-bottom: 0.5rem !important;
}

.assistant-message-card>.message-card-footer,
.user-message-card>.message-card-footer {
    margin-bottom: 0 !important;
    margin-top: 0.5rem !important;
    /* Reduced for better balance */
}

/* Ensure the Assistant Card is visible for the glow */
div.rz-card.assistant-message-card {
    overflow: visible !important;
    background: var(--chat-card-bg) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* User Message Card - Compact, distinct shade, no lines */
div.rz-card.user-message-card {
    background: rgba(45, 45, 60, 0.9) !important;
    /* Slightly lighter/different than assistant */
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    /* Subtle border like assistant */
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    color: var(--chat-text-primary) !important;
}

/* 
   BORDER STYLES - CSS Transitions on same DOM element
   Both pseudo-elements ALWAYS exist, opacity transitions handle fade in/out
   - Left bar (::before): opacity 1 when border-style-c, else 0
   - Gradient (::after): opacity 1 when border-style-a, else 0
*/

/* CSS transitions for border and accent bar animations */

/* LEFT BAR (::before) - Always present, fades via opacity transition */
.assistant-message-card::before {
    content: '';
    position: absolute;
    top: 10%;
    left: -4px;
    width: 4px;
    height: 80%;
    background: linear-gradient(180deg,
            transparent 0%,
            var(--chat-accent) 20%,
            var(--chat-accent) 80%,
            transparent 100%);
    border-radius: 2px;
    animation: accentBarGlowGlobal 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease-out;
}

/* When border-style-c active, fade IN the left bar */
.assistant-message-card.border-style-c::before {
    opacity: 1;
}

/* GRADIENT BORDER (::after) - The Hollow Mask */
.assistant-message-card::after {
    content: '';
    position: absolute;
    /* Reduced to 1px to match the Chat Input's delicate glow */
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    padding: 1px;
    border-radius: 19px;
    /* card radius (18) + inset (1) */

    background: linear-gradient(90deg,
            rgba(0, 212, 255, 0.4) 0%,
            rgba(0, 212, 255, 0.9) 50%,
            rgba(0, 212, 255, 0.4) 100%);
    background-size: 200% 100%;

    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;

    z-index: 10;
    pointer-events: none;
    animation: borderFlowGlobal 2s linear infinite;
    opacity: 0;
    transition: opacity 1s ease-in;
}

/* When border-style-a active, fade IN the gradient */
.assistant-message-card.border-style-a::after {
    opacity: 1;
}

/* ============================================
   ANIMATED BORDER CARD COMPONENT
   Used on Home page for card/image borders
   
   WHY GLOBAL: The AnimatedBorderCard component
   uses scoped CSS, but ::before pseudo-elements
   don't inherit the scoped attribute properly
   when the component is used across different
   parent components.
   ============================================ */

.animated-border-card {
    position: relative;
    display: inline-block;
    /* Wrap content tightly by default (for images) */
}

/* Full width variant for page cards */
.animated-border-card.full-width {
    display: block;
    width: 100%;
}

.animated-border-card .animated-border-inner {
    position: relative;
    z-index: 1;
}

/* Flowing gradient border - enabled state (thin and subtle) */
.animated-border-card.enabled {
    padding: 1px;
}

.animated-border-card.enabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    background: linear-gradient(90deg,
            rgba(0, 212, 255, 0.2) 0%,
            rgba(0, 212, 255, 0.5) 50%,
            rgba(0, 212, 255, 0.2) 100%);
    background-size: 200% 100%;
    z-index: 0;
    animation: borderFlowGlobal 3s ease-in-out infinite alternate;
    pointer-events: none;
}

/* Inner content - transparent background for images */
.animated-border-card.enabled .animated-border-inner {
    position: relative;
    z-index: 1;
    border-radius: 8px;
    overflow: hidden;
    /* Clip image to border radius */
}


/* ============================================
   EDIT FORM LAYOUT - Multi-column Polish
   ============================================ */

.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
}

.edit-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.edit-field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color);
    margin-bottom: 0px;
}

.extra-view-card {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rz-divider-color) !important;
}

.extra-view-title {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--rz-text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.extra-view-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1rem;
    background: var(--rz-primary);
    border-radius: 1px;
}

/* Fix for button gap */
.edit-actions-stack {
    margin-top: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--rz-divider-color);
}

/* ============================================
   TAB STYLING - Blue underline for selected
   Same background for all tabs

   Radzen uses --rz-base-200 for unselected tabs
   We override to transparent with blue underline
   ============================================ */

/* All tabs: transparent background */
.rz-tabview-nav li {
    background: transparent !important;
    background-color: transparent !important;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.rz-tabview-nav li a,
.rz-tabview-nav li a:not([href]):not([class]) {
    background: transparent !important;
    background-color: transparent !important;
}

.rz-tabview-nav li:hover {
    background: transparent !important;
    background-color: transparent !important;
}

/* Selected tab: blue underline */
.rz-tabview-nav li.rz-tabview-selected {
    background: transparent !important;
    background-color: transparent !important;
    border-bottom-color: var(--rz-primary);
}

.rz-tabview-nav li.rz-tabview-selected a,
.rz-tabview-nav li.rz-tabview-selected a:not([href]):not([class]) {
    background: transparent !important;
    background-color: transparent !important;
}

/* Ensure RadzenTabs has proper height containment */
.rz-tabview {
    display: flex;
    flex-direction: column;
    position: relative;
}

.rz-tabview-panels {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Prevent tab panel content from overflowing and causing duplicate tabs */
.rz-tabview-panel {
    position: relative;
    overflow: hidden;
}

/* ============================================
   SCROLLBAR STYLING - Global consistency
   ============================================ */

.rz-dialog ::-webkit-scrollbar,
.rz-card ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.rz-dialog ::-webkit-scrollbar-track,
.rz-card ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.rz-dialog ::-webkit-scrollbar-thumb,
.rz-card ::-webkit-scrollbar-thumb {
    background: var(--rz-primary);
    border-radius: 3px;
}

/* ============================================
   CHAT PAGE - Kill the RadzenBody scrollbar
   The chat page manages its own scrolling via
   .message-list-container inside .chat-atmosphere.
   ============================================ */
.rz-body:has(.chat-atmosphere) {
    overflow: hidden !important;
    padding: 0 !important;
}

.rz-body:has(.chat-atmosphere)>.rz-row {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    height: 100%;
}

.rz-body:has(.chat-atmosphere)>.rz-row>* {
    padding: 0 !important;
    margin: 0 !important;
}