/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ LOGIN PAGE STYLING ============ */
/* Login page background - use wallpaper with dark overlay */
.mx_AuthPage {
    background-image: url('/wallpaper.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    position: relative !important;
}

/* Dark overlay for better contrast */
.mx_AuthPage::before {
    content: '' !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

/* Logo in top left corner */
.mx_AuthHeader_logo,
.mx_AuthHeaderLogo img,
img[src*="element-logo"] {
    content: url('/logo_round.png') !important;
    position: fixed !important;
    top: 30px !important;
    left: 30px !important;
    width: 60px !important;
    height: 60px !important;
    z-index: 100 !important;
    animation: fadeInDown 0.8s ease !important;
}

/* Main login container - SUPER DARK */
.mx_AuthPage_modal {
    background: #0a0a0a !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    padding: 40px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9) !important;
    animation: fadeInUp 0.8s ease 0.2s both !important;
    position: relative !important;
    z-index: 10 !important;
}

/* Auth Header - BLACK with FLOATING PARTICLES */
.mx_AuthHeader {
    background: #000000 !important;
    padding: 12px 20px !important;
    border-radius: 12px 12px 0 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Floating particles animation */
.mx_AuthHeader::before,
.mx_AuthHeader::after {
    content: '' !important;
    position: absolute !important;
    width: 4px !important;
    height: 4px !important;
    background: rgba(255, 255, 255, 0.6) !important;
    border-radius: 50% !important;
    animation: float 8s infinite ease-in-out !important;
}

.mx_AuthHeader::before {
    top: 20% !important;
    left: 30% !important;
    animation-delay: 0s !important;
}

.mx_AuthHeader::after {
    top: 60% !important;
    left: 70% !important;
    animation-delay: 3s !important;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(20px, -15px) scale(1.2);
        opacity: 0.6;
    }
    50% {
        transform: translate(-10px, -25px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(15px, -10px) scale(1.1);
        opacity: 0.5;
    }
}

/* Language dropdown - DARK */
.mx_LanguageDropdown,
.mx_Dropdown,
.mx_Dropdown_input,
.mx_AuthBody_language {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
    color: #ffffff !important;
}

.mx_Dropdown_option {
    color: #ffffff !important;
}

.mx_Dropdown_arrow {
    filter: invert(1) !important;
}

/* Auth Body - SUPER DARK */
.mx_AuthBody {
    background: #0a0a0a !important;
}

/* All containers dark */
.mx_ServerPicker,
.mx_Login_type_container,
.mx_AuthBody > div,
.mx_AuthBody form {
    background: transparent !important;
}

/* Titles styling - DARK BACKGROUND */
.mx_AuthBody h1,
.mx_AuthHeader h1 {
    font-size: 32px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    text-align: center !important;
    margin-bottom: 12px !important;
    background: transparent !important;
}

.mx_AuthBody h2,
.mx_AuthHeader h2,
.mx_ServerPicker h2 {
    font-size: 15px !important;
    color: rgba(255, 255, 255, 0.8) !important;
    text-align: left !important;
    margin-bottom: 8px !important;
    font-weight: 500 !important;
    background: transparent !important;
}

/* Server picker dark */
.mx_ServerPicker_server,
.mx_Login_underlinedServerName {
    background: transparent !important;
    color: #ffffff !important;
}

/* ============ FORM STYLING - SUPER DARK MODE ============ */
/* Form fields stack vertically with spacing */
.mx_AuthBody form {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}

.mx_Field {
    width: 100% !important;
    margin-bottom: 0 !important;
}

/* Input fields - NO BORDERS, DARK with BRIGHT WHITE TEXT */
.mx_Field input,
.mx_Field_input,
input[type="text"],
input[type="password"],
input[type="email"] {
    background: #1a1a1a !important;
    border: none !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    padding: 14px 16px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: none !important;
}

.mx_Field input:focus,
.mx_Field_input:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none !important;
    border: none !important;
    background: #222222 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.mx_Field input::placeholder,
input::placeholder {
    color: #888888 !important;
    -webkit-text-fill-color: #888888 !important;
}

/* Labels - HIDE THE FLOATING LABELS */
.mx_Field label,
.mx_Field_label {
    display: none !important;
}

/* Static labels above fields */
.mx_AuthBody label {
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* All text in auth body - BRIGHT WHITE */
.mx_AuthBody,
.mx_AuthBody p,
.mx_AuthBody span,
.mx_AuthBody div {
    color: #ffffff !important;
}

/* Remove label animation transitions */
.mx_Field {
    position: relative !important;
}

.mx_Field input:focus + label,
.mx_Field input:not(:placeholder-shown) + label {
    display: none !important;
}

/* ============ BUTTON STYLING ============ */
/* Primary buttons (Sign In, Create Account) - EXTRA PADDING TO PREVENT CUTOFF */
.mx_Login_submit,
.mx_AuthBody_primaryButton,
button[type="submit"],
.mx_AccessibleButton_kind_primary {
    background: white !important;
    color: black !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 18px 14px 22px 14px !important;
    min-height: 52px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mx_Login_submit:hover,
.mx_AuthBody_primaryButton:hover,
button[type="submit"]:hover,
.mx_AccessibleButton_kind_primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3) !important;
}

.mx_Login_submit:active,
.mx_AuthBody_primaryButton:active,
button[type="submit"]:active,
.mx_AccessibleButton_kind_primary:active {
    transform: translateY(0) !important;
}

/* Secondary buttons */
.mx_AccessibleButton_kind_secondary,
.mx_AuthBody_secondaryButton {
    background: transparent !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 18px 14px 22px 14px !important;
    min-height: 52px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mx_AccessibleButton_kind_secondary:hover,
.mx_AuthBody_secondaryButton:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Links */
.mx_AuthBody a {
    color: white !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: opacity 0.3s ease !important;
}

.mx_AuthBody a:hover {
    opacity: 0.8 !important;
}

/* Hide homeserver edit button */
.mx_ServerPicker_change,
.mx_ServerPicker_edit {
    display: none !important;
}

/* Hide "Sign in with" options and text */
.mx_AuthBody_fieldRow button:not([type="submit"]),
.mx_SSOButtons,
.mx_AuthBody_phoneNumberField,
.mx_AuthBody_emailField,
.mx_AuthBody_typeContainer,
.mx_Login_type_label,
.mx_Login_type_dropdown,
select#mx_Field_1,
label[for="mx_Field_1"],
.mx_Dropdown,
.mx_Dropdown_arrow,
.mx_Field select,
.mx_Field select::after,
.mx_Field_select::after {
    display: none !important;
}

/* Hide any remaining dropdown arrows */
.mx_Field:has(select)::after,
.mx_Field_postfix {
    display: none !important;
}

/* Hide footer links (blog, twitter, github, powered by matrix) */
.mx_AuthFooter,
.mx_AuthFooter a,
a[href*="blog"],
a[href*="twitter"],
a[href*="github"],
a[href*="matrix.org"] {
    display: none !important;
}

/* ============ CHAT BACKGROUND ============ */
/* Add chat wallpaper to the timeline at 20% opacity */
.mx_RoomView_timeline::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-image: url('/chat_wallpaper.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    opacity: 0.2 !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

/* Ensure timeline content is above the background */
.mx_RoomView_timeline {
    position: relative !important;
}

.mx_RoomView_messagePanel {
    position: relative !important;
    z-index: 1 !important;
}

/* ============ DARKER SIDEBARS ============ */
/* Make left sidebars darker/more black */
.mx_LeftPanel,
.mx_LeftPanel_roomListContainer,
.mx_RoomList,
.mx_LeftPanel_wrapper {
    background-color: #0d0d0d !important;
}

/* Space panel (far left) */
.mx_SpacePanel {
    background-color: #050505 !important;
}

/* ============ WELCOME PAGE ============ */
/* Simple black background */
.mx_Welcome {
    background-color: #000000 !important;
}

/* Hide Element text and branding */
.mx_Welcome h1,
.mx_Welcome h2,
.mx_Welcome p,
.mx_Header_subtitle {
    display: none !important;
}

/* ============ HIDE MOBILE GUIDE ONLY ============ */
/* Hide mobile guide but keep encryption dialogs */
[class*="mx_MobileGuide"] {
    display: none !important;
}

/* ============ HIDE WELCOME CHECKLISTS ONLY ============ */
/* Hide onboarding checklist and welcome screens (NOT encryption) */
.mx_Welcome,
.mx_WelcomePage,
.mx_HomePage,
.mx_HomePage_header,
.mx_UserOnboardingPage,
.mx_UserOnboardingHeader,
.mx_UserOnboardingTask,
.mx_UserOnboardingList,
.mx_UserOnboardingFeedback,
.mx_UserOnboardingButton,
[class*="mx_UserOnboarding"],
[data-testid*="onboarding"],
.mx_GenericDropdownMenu_button[aria-label*="Help & About"],
[aria-label*="Download apps"],
[aria-label*="Get the app"],
.mx_AccessibleButton[aria-label*="Download"],
.mx_InfoDialog[aria-label*="Welcome"] {
    display: none !important;
}

/* Hide any banners suggesting Element downloads */
.mx_RoomView_MessageList div[class*="banner"]:has(a[href*="element.io"]),
.mx_EventTile[data-layout="group"] div:has(a[href*="element.io/get-started"]) {
    display: none !important;
}
