/**
 * ============================================
 * BOTBUSTER VIDEO - Clerk Component Customization
 * Custom styling for Clerk authentication components
 * ============================================
 */

/* ========== CLERK USER BUTTON DROPDOWN ========== */

/* Override Clerk's default styles */
.cl-userButtonPopoverCard,
.cl-card,
[data-clerk-element="card"] {
    background: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(30px) saturate(150%) !important;
    border: 1px solid rgba(189, 0, 27, 0.3) !important;
    border-radius: 16px !important;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(189, 0, 27, 0.1) inset,
        0 8px 32px rgba(189, 0, 27, 0.2) !important;
    padding: 0 !important;
    min-width: 280px !important;
}

/* Ensure sign in/up cards expand to full width */
.cl-signIn-root .cl-card,
.cl-signUp-root .cl-card {
    max-width: 100% !important;
    width: 100% !important;
}

/* User info section */
.cl-userButtonPopoverActionButton__user,
.cl-userPreview,
[data-clerk-element="userPreview"] {
    background: linear-gradient(135deg,
        rgba(189, 0, 27, 0.1) 0%,
        rgba(189, 0, 27, 0.05) 100%) !important;
    border: none !important;
    border-bottom: 1px solid rgba(189, 0, 27, 0.2) !important;
    padding: 1.25rem 1rem !important;
    margin: 0 !important;
}

/* User name */
.cl-userPreviewMainIdentifier,
.cl-userButtonPopoverActionButton__user__identifier,
[data-clerk-element="userPreviewMainIdentifier"] {
    color: #FFFFFF !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    letter-spacing: 0.02em !important;
}

/* User email */
.cl-userPreviewSecondaryIdentifier,
[data-clerk-element="userPreviewSecondaryIdentifier"] {
    color: #CCCCCC !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
}

/* User avatar */
.cl-avatarBox,
.cl-userPreviewAvatarBox,
[data-clerk-element="avatarBox"] {
    border: 2px solid rgba(189, 0, 27, 0.25) !important;
    box-shadow: 0 0 12px rgba(189, 0, 27, 0.3) !important;
}

/* Plan badge (FREE/PRO) */
.cl-badge,
.cl-userButtonPopoverActionButton__badge,
[data-clerk-element="badge"] {
    background: linear-gradient(135deg, #bd001b 0%, #9a0016 100%) !important;
    color: #FFFFFF !important;
    border: none !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 20px !important;
    font-size: 0.75rem !important;
    box-shadow: 0 4px 12px rgba(189, 0, 27, 0.25) !important;
}

/* Credits badge */
.cl-userButtonPopoverActionButton__badge[data-localization-key*="credit"],
.cl-badge[data-localization-key*="credit"] {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #FFFFFF !important;
}

/* Action buttons (Manage Account, Sign Out) */
.cl-userButtonPopoverActionButton,
.cl-profileSectionPrimaryButton,
[data-clerk-element="actionButton"] {
    background: rgba(255, 255, 255, 0.03) !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #E5E5E5 !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    padding: 1rem 1.25rem !important;
    transition: all 0.2s ease !important;
    text-align: left !important;
}

.cl-userButtonPopoverActionButton:last-child,
[data-clerk-element="actionButton"]:last-child {
    border-bottom: none !important;
    border-radius: 0 0 16px 16px !important;
}

/* Hover states for buttons */
.cl-userButtonPopoverActionButton:hover,
.cl-profileSectionPrimaryButton:hover,
[data-clerk-element="actionButton"]:hover {
    background: rgba(189, 0, 27, 0.1) !important;
    color: #FFFFFF !important;
    transform: translateX(4px) !important;
}

/* MANAGE ACCOUNT button - make it stand out */
.cl-userButtonPopoverActionButton[data-clerk-element*="manageAccount"],
.cl-userButtonPopoverActionButton:first-of-type {
    background: rgba(189, 0, 27, 0.08) !important;
    border-bottom: 1px solid rgba(189, 0, 27, 0.2) !important;
}

.cl-userButtonPopoverActionButton[data-clerk-element*="manageAccount"]:hover {
    background: rgba(189, 0, 27, 0.15) !important;
}

/* SIGN OUT button - red accent */
.cl-userButtonPopoverActionButton[data-clerk-element*="signOut"],
.cl-userButtonPopoverActionButton:last-of-type {
    color: #bd001b !important;
    font-weight: 700 !important;
}

.cl-userButtonPopoverActionButton[data-clerk-element*="signOut"]:hover {
    background: rgba(189, 0, 27, 0.15) !important;
    color: #d40020 !important;
}

/* Icons within buttons */
.cl-userButtonPopoverActionButtonIcon,
.cl-icon,
[data-clerk-element="icon"] {
    color: #bd001b !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
}

/* Button text */
.cl-userButtonPopoverActionButtonText,
[data-clerk-element="buttonText"] {
    color: inherit !important;
    font-weight: inherit !important;
}

/* Footer text (Secured by Clerk) */
.cl-userButtonPopoverFooter,
.cl-footer,
[data-clerk-element="footer"] {
    background: rgba(0, 0, 0, 0.3) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 0.75rem 1rem !important;
    margin: 0 !important;
}

.cl-footerText,
[data-clerk-element="footerText"] {
    color: #999999 !important;
    font-size: 0.75rem !important;
    font-weight: 400 !important;
}

/* Clerk logo in footer */
.cl-footerActionLink,
.cl-internal-b3fm6y {
    opacity: 0.5 !important;
    filter: brightness(0) invert(1) !important;
}

/* Development mode badge */
.cl-badge[data-localization-key*="development"],
[data-clerk-element*="developmentMode"] {
    background: rgba(255, 193, 7, 0.2) !important;
    color: #FFC107 !important;
    border: 1px solid rgba(255, 193, 7, 0.3) !important;
}

/* ========== USER BUTTON TRIGGER ========== */

/* The button that opens the dropdown */
.cl-userButtonTrigger,
[data-clerk-element="userButtonTrigger"] {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(189, 0, 27, 0.3) !important;
    border-radius: 12px !important;
    padding: 0.5rem !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

.cl-userButtonTrigger:hover {
    background: rgba(189, 0, 27, 0.1) !important;
    border-color: rgba(189, 0, 27, 0.3) !important;
    box-shadow: 0 0 16px rgba(189, 0, 27, 0.3) !important;
    transform: translateY(-2px) !important;
}

.cl-userButtonTrigger:active {
    transform: translateY(0) !important;
}

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

.cl-userButtonPopoverCard {
    animation: slideIn 0.2s ease-out !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .cl-userButtonPopoverCard {
        min-width: 260px !important;
    }

    .cl-userButtonPopoverActionButton {
        padding: 0.875rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* ========== SCROLLBAR (if content overflows) ========== */

.cl-scrollBox::-webkit-scrollbar,
.cl-userButtonPopoverCard::-webkit-scrollbar {
    width: 8px;
}

.cl-scrollBox::-webkit-scrollbar-track,
.cl-userButtonPopoverCard::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.cl-scrollBox::-webkit-scrollbar-thumb,
.cl-userButtonPopoverCard::-webkit-scrollbar-thumb {
    background: rgba(189, 0, 27, 0.3);
    border-radius: 4px;
}

.cl-scrollBox::-webkit-scrollbar-thumb:hover,
.cl-userButtonPopoverCard::-webkit-scrollbar-thumb:hover {
    background: rgba(189, 0, 27, 0.7);
}

/* ========== ENHANCED PREMIUM EFFECTS ========== */

/* Subtle glow on hover */
.cl-userButtonPopoverCard:hover {
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(189, 0, 27, 0.2) inset,
        0 8px 32px rgba(189, 0, 27, 0.25) !important;
}

/* Add subtle gradient overlay */
.cl-userButtonPopoverCard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(189, 0, 27, 0.05) 0%,
        transparent 30%,
        transparent 100%
    );
    pointer-events: none;
    border-radius: 16px;
}

/* ========== DIVIDERS ========== */

.cl-divider,
[data-clerk-element="divider"] {
    background: rgba(189, 0, 27, 0.2) !important;
    height: 1px !important;
    margin: 0 !important;
}

/* ========== SIGN IN / SIGN UP HEADER ========== */

/* Hide the default "Sign in to BOTBUSTER VIDEO" text */
.cl-headerTitle,
.cl-card__header__title,
[data-localization-key="signIn.start.title"],
[data-localization-key="signUp.start.title"] {
    display: none !important;
}

/* Style the header to accommodate the logo */
.cl-header,
.cl-card__header {
    padding: 2rem 1.5rem 1rem !important;
    text-align: center !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(189, 0, 27, 0.1) !important;
    overflow: visible !important;
}

/* Add logo via ::before pseudo-element */
.cl-header::before,
.cl-card__header::before {
    content: '';
    display: block;
    width: 140%;
    max-width: 600px;
    height: 200px;
    background-image: url('/assets/images/botbust_logo.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin: -3rem auto 0.5rem;
    filter: drop-shadow(0 6px 20px rgba(189, 0, 27, 0.4));
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Subtitle text below logo */
.cl-headerSubtitle,
.cl-card__header__subtitle {
    color: #CCCCCC !important;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
    margin-top: 0.5rem !important;
}

/* ========== ACCESSIBILITY ========== */

.cl-userButtonPopoverActionButton:focus-visible,
.cl-userButtonTrigger:focus-visible {
    outline: 2px solid #bd001b !important;
    outline-offset: 2px !important;
}
