/* ============================================
   KERBERUS - Custom Chainlit Theme
   Swiss Legal Intelligence
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for KERBERUS Brand */
:root {
    --kerberus-red: #8B1E3F;
    --kerberus-red-light: #C73E5C;
    --kerberus-red-lighter: #E05A7A;
    --kerberus-gray: #4A5568;
    --kerberus-dark: #1A202C;
    --kerberus-blue: #2C5282;
    --kerberus-blue-light: #4299E1;
    --kerberus-blue-lighter: #63B3ED;
    --kerberus-bg: #F7FAFC;
    --kerberus-card: rgba(255, 255, 255, 0.85);
}

/* Apply Font Globally */
body,
.MuiTypography-root,
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* Premium Background - Override Chainlit's dynamic styles */
body,
html,
#root,
#root>div,
#root>div>div,
.MuiBox-root,
[class*="main"],
[class*="Main"],
[class*="container"],
[class*="Container"],
[class*="layout"],
[class*="Layout"],
[class*="chat"],
[class*="Chat"],
[data-testid],
main,
.css-1v1s3p1,
.css-0 {
    background-color: #F7FAFC !important;
    background-image:
        radial-gradient(at 100% 0%, rgba(139, 30, 63, 0.25) 0px, transparent 55%),
        radial-gradient(at 0% 100%, rgba(44, 82, 130, 0.25) 0px, transparent 55%) !important;
    background-attachment: fixed !important;
}

/* Force override any white backgrounds */
div[style*="background: rgb(255, 255, 255)"],
div[style*="background-color: rgb(255, 255, 255)"],
div[style*="background: white"],
div[style*="background-color: white"],
div[style*="background:#fff"],
div[style*="background-color:#fff"] {
    background-color: #F7FAFC !important;
    background-image:
        radial-gradient(at 100% 0%, rgba(139, 30, 63, 0.25) 0px, transparent 55%),
        radial-gradient(at 0% 100%, rgba(44, 82, 130, 0.25) 0px, transparent 55%) !important;
}

/* Pseudo-element overlay - Premium WOW effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        /* Top right - Bold red glow - MORE VISIBLE */
        radial-gradient(ellipse 85% 65% at 100% 0%, rgba(199, 62, 92, 0.35) 0%, rgba(139, 30, 63, 0.15) 45%, transparent 75%),
        /* Bottom left - Bold blue glow - MORE VISIBLE */
        radial-gradient(ellipse 85% 65% at 0% 100%, rgba(66, 153, 225, 0.35) 0%, rgba(44, 82, 130, 0.15) 45%, transparent 75%),
        /* Center subtle warmth */
        radial-gradient(ellipse 100% 100% at 50% 50%, rgba(255, 255, 255, 0.7) 0%, transparent 70%),
        /* Base gradient */
        linear-gradient(135deg, #F8FAFC 0%, #EDF2F7 50%, #E2E8F0 100%);
    z-index: -1;
    pointer-events: none;
}

/* Additional accent line at top of page */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
            var(--kerberus-red) 0%,
            var(--kerberus-red-light) 30%,
            var(--kerberus-blue) 70%,
            #4299E1 100%);
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(139, 30, 63, 0.3);
}

/* ============================================
   HEADER - Premium Glass Effect
   ============================================ */
header {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(248, 250, 252, 0.9) 100%) !important;
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(139, 30, 63, 0.15) !important;
    box-shadow:
        0 4px 30px rgba(139, 30, 63, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05) !important;
    min-height: 80px !important;
    padding: 0.5rem 1.5rem !important;
}

/* Header Container - Flex to push logo right */
header>div {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

/* Logo in Header - Big and Right-aligned */
header img,
header svg {
    max-height: 70px !important;
    width: auto !important;
    object-fit: contain !important;
}

/* Header Title Styling */
header h1,
header .MuiTypography-h6 {
    font-weight: 600 !important;
    color: var(--kerberus-dark) !important;
    font-size: 1.5rem !important;
}

/* ============================================
   WELCOME SCREEN - Premium Branding with WOW
   ============================================ */
.welcome-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3rem 3.5rem;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(248, 250, 252, 0.95) 50%,
            rgba(237, 242, 247, 0.9) 100%);
    border-radius: 24px;
    box-shadow:
        0 25px 80px -20px rgba(139, 30, 63, 0.25),
        0 10px 30px -10px rgba(44, 82, 130, 0.15),
        0 0 0 1px rgba(139, 30, 63, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Decorative accent line - Animated gradient */
.welcome-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg,
            var(--kerberus-red) 0%,
            var(--kerberus-red-light) 25%,
            var(--kerberus-blue) 75%,
            #4299E1 100%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

/* Subtle corner accents */
.welcome-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle at 100% 100%,
            rgba(139, 30, 63, 0.08) 0%,
            transparent 70%);
    pointer-events: none;
}

@keyframes shimmer {

    0%,
    100% {
        background-position: 0% 50%;
    }

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

.welcome-text h1 {
    font-size: 3rem !important;
    font-weight: 700;
    background: linear-gradient(135deg, var(--kerberus-dark) 0%, var(--kerberus-gray) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.welcome-text p {
    font-size: 1.1rem;
    color: var(--kerberus-gray);
    line-height: 1.6;
}

.welcome-text b {
    color: var(--kerberus-red);
    font-weight: 600;
}

/* Welcome Logo - Big and Prominent */
.welcome-logo {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(139, 30, 63, 0.2));
    transition: transform 0.3s ease;
}

.welcome-logo:hover {
    transform: scale(1.05);
}

/* ============================================
   CHAT MESSAGES - Premium Glass Cards
   ============================================ */
.cl-message,
[class*="message"] {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px !important;
    box-shadow:
        0 8px 32px -8px rgba(139, 30, 63, 0.12),
        0 4px 16px -4px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    margin: 1rem 0 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cl-message:hover,
[class*="message"]:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px -8px rgba(139, 30, 63, 0.18),
        0 6px 20px -4px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* User Messages - Bold gradient */
[class*="user-message"],
.user-message {
    background: linear-gradient(135deg,
            var(--kerberus-red) 0%,
            var(--kerberus-red-light) 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow:
        0 8px 32px -8px rgba(139, 30, 63, 0.4),
        0 4px 16px -4px rgba(139, 30, 63, 0.2);
}

/* Assistant Messages - Subtle accent */
[class*="assistant-message"],
.assistant-message {
    background: rgba(255, 255, 255, 0.9) !important;
    border-left: 4px solid var(--kerberus-red) !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
}

/* ============================================
   INPUT AREA - Premium Glass
   ============================================ */
textarea,
[class*="input"],
.MuiInputBase-root {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid rgba(139, 30, 63, 0.12) !important;
    border-radius: 16px !important;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease !important;
    box-shadow:
        0 4px 20px -5px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea:focus,
[class*="input"]:focus,
.MuiInputBase-root.Mui-focused {
    border-color: var(--kerberus-red) !important;
    box-shadow:
        0 0 0 4px rgba(139, 30, 63, 0.12),
        0 8px 30px -5px rgba(139, 30, 63, 0.15) !important;
    outline: none !important;
}

/* Send Button - Bold and Premium */
button[type="submit"],
.MuiIconButton-root[aria-label*="send" i],
[class*="send-button"] {
    background: linear-gradient(135deg,
            var(--kerberus-red) 0%,
            var(--kerberus-red-light) 100%) !important;
    color: white !important;
    border-radius: 14px !important;
    border: none !important;
    transition: all 0.3s ease !important;
    box-shadow:
        0 4px 15px rgba(139, 30, 63, 0.3),
        0 2px 5px rgba(139, 30, 63, 0.2);
}

button[type="submit"]:hover,
.MuiIconButton-root[aria-label*="send" i]:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 8px 25px rgba(139, 30, 63, 0.4),
        0 4px 10px rgba(139, 30, 63, 0.3) !important;
}

button[type="submit"]:active,
.MuiIconButton-root[aria-label*="send" i]:active {
    transform: translateY(0) scale(0.98);
}

/* ============================================
   SIDEBAR / SETTINGS
   ============================================ */
[class*="sidebar"],
[class*="drawer"],
.MuiDrawer-paper {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
}

/* Switches and Sliders */
.MuiSwitch-switchBase.Mui-checked {
    color: var(--kerberus-red) !important;
}

.MuiSwitch-switchBase.Mui-checked+.MuiSwitch-track {
    background-color: var(--kerberus-red) !important;
}

.MuiSlider-thumb {
    background-color: var(--kerberus-red) !important;
}

.MuiSlider-track {
    background-color: var(--kerberus-red) !important;
}

/* ============================================
   TYPOGRAPHY ENHANCEMENTS
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600 !important;
    color: var(--kerberus-dark) !important;
}

/* Code blocks */
code,
pre {
    background: rgba(26, 32, 44, 0.05) !important;
    border-radius: 6px !important;
    font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
}

/* Links */
a {
    color: var(--kerberus-red) !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

a:hover {
    color: var(--kerberus-red-light) !important;
    text-decoration: underline !important;
}

/* Blockquotes (for search result previews) */
blockquote {
    border-left: 3px solid var(--kerberus-red) !important;
    background: rgba(139, 30, 63, 0.03) !important;
    padding: 1rem 1.5rem !important;
    border-radius: 0 8px 8px 0 !important;
    margin: 1rem 0 !important;
    font-style: italic;
    color: var(--kerberus-gray);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .welcome-container {
        flex-direction: column-reverse;
        text-align: center;
        padding: 2rem 1.5rem;
    }

    .welcome-logo {
        width: 150px;
        margin-bottom: 1.5rem;
    }

    .welcome-text h1 {
        font-size: 2rem !important;
    }

    header img {
        max-height: 50px !important;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cl-message,
[class*="message"] {
    animation: fadeIn 0.3s ease-out;
}

/* Loading indicator */
[class*="loading"],
[class*="spinner"] {
    color: var(--kerberus-red) !important;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 30, 63, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 30, 63, 0.5);
}

/* ============================================
   ACTION BUTTONS - Mode Switchers
   ============================================ */
/* ============================================
   ACTION BUTTONS - Mode Switchers
   ============================================ */
/* Target buttons within ai-message - these are Chainlit action buttons */
.ai-message button,
div.flex.items-center.flex-wrap button {
    min-width: 240px !important;
    min-height: 65px !important;
    height: auto !important;
    padding: 20px 36px !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    border-radius: 16px !important;
    margin: 10px 8px !important;
    background: linear-gradient(135deg,
            var(--kerberus-red-light) 0%,
            var(--kerberus-red-lighter) 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow:
        0 8px 25px rgba(199, 62, 92, 0.3),
        0 4px 15px rgba(224, 90, 122, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    text-transform: none !important;
    letter-spacing: 0.02em !important;
}

/* DRAMATIC hover effect for red button */
.ai-message button:hover,
div.flex.items-center.flex-wrap button:hover {
    transform: translateY(-8px) scale(1.05) !important;
    /* Much brighter on hover - almost white-pink glow */
    background: linear-gradient(135deg,
            #F472B6 0%,
            #EC4899 100%) !important;
    box-shadow:
        0 20px 50px rgba(236, 72, 153, 0.5),
        0 15px 35px rgba(244, 114, 182, 0.4),
        0 0 30px rgba(244, 114, 182, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

.ai-message button:active,
div.flex.items-center.flex-wrap button:active {
    transform: translateY(-2px) scale(0.98) !important;
    background: linear-gradient(135deg,
            var(--kerberus-red) 0%,
            var(--kerberus-red-light) 100%) !important;
}

/* Second button - Blue variant (lighter) */
.ai-message button:nth-of-type(2),
div.flex.items-center.flex-wrap button:nth-child(2) {
    background: linear-gradient(135deg,
            var(--kerberus-blue-light) 0%,
            var(--kerberus-blue-lighter) 100%) !important;
    box-shadow:
        0 8px 25px rgba(66, 153, 225, 0.3),
        0 4px 15px rgba(99, 179, 237, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

/* DRAMATIC hover effect for blue button */
.ai-message button:nth-of-type(2):hover,
div.flex.items-center.flex-wrap button:nth-child(2):hover {
    /* Much brighter on hover - almost cyan glow */
    background: linear-gradient(135deg,
            #7DD3FC 0%,
            #38BDF8 100%) !important;
    box-shadow:
        0 20px 50px rgba(56, 189, 248, 0.5),
        0 15px 35px rgba(125, 211, 252, 0.4),
        0 0 30px rgba(125, 211, 252, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

.ai-message button:nth-of-type(2):active,
div.flex.items-center.flex-wrap button:nth-child(2):active {
    background: linear-gradient(135deg,
            var(--kerberus-blue) 0%,
            var(--kerberus-blue-light) 100%) !important;
}

/* Button container - center them nicely */
.ai-message div.flex.items-center.flex-wrap {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 16px !important;
    margin: 24px 0 !important;
    padding: 10px !important;
}