/* DAY.TV Custom Authelia Styling - Complete & Clean */

/* Background gradient matching day.tv */
body {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%) !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#root {
    background: transparent !important;
    width: 100% !important;
}

.MuiGrid-root {
    background: transparent !important;
}

/* ONLY hide header when there's a login form present */
body:has(input[name="username"]) .MuiAppBar-root,
body:has(input[name="username"]) header.MuiPaper-root {
    display: none !important;
}

/* Show header on all other pages */
.MuiAppBar-root,
header.MuiPaper-root.MuiAppBar-root {
    display: flex !important;
    background: rgba(15, 32, 39, 0.85) !important;
    backdrop-filter: blur(10px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Override hide for pages without login form */
body:not(:has(input[name="username"])) .MuiAppBar-root,
body:not(:has(input[name="username"])) header.MuiPaper-root {
    display: flex !important;
}

/* FIX: Align language selector and avatar in header */
.MuiToolbar-root {
    align-items: center !important;
    color: white !important;
}

.MuiToolbar-root > * {
    display: flex !important;
    align-items: center !important;
}

/* Ensure language button aligns with avatar */
.MuiToolbar-root .MuiButtonBase-root,
.MuiToolbar-root button {
    display: flex !important;
    align-items: center !important;
}

/* Hide default card header */
.MuiCardHeader-root {
    display: none !important;
}

/* ============================================== */
/* LOGO STYLING - ORIGINAL APPROACH THAT WORKED  */
/* ============================================== */

/* The logo image itself - using your original transform method */
img[alt="Logo"] {
    content: url('/custom-logo.svg') !important;
    width: auto !important;
    height: 80px !important;
    max-width: 320px !important;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4)) !important;
    
    /* Original centering method that worked on desktop */
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* ============================================== */
/* LOGIN PAGE - CENTER THE ENTIRE FORM           */
/* ============================================== */

/* The MuiContainer needs margin auto to center */
.MuiContainer-root,
.MuiContainer-maxWidthXs,
div.MuiContainer-root.MuiContainer-maxWidthXs {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Target the first-factor-stage container */
#first-factor-stage {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
}

#first-factor-stage > .MuiContainer-root {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* The inner grid container should also center */
#first-factor-stage .MuiGrid-container {
    justify-content: center !important;
}

/* User Avatar - Keep small (normal size) */
.MuiAvatar-root {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
}

/* Headings styling */
.MuiTypography-h5 {
    color: white !important;
    font-size: 32px !important;
    font-weight: 700 !important;
    text-align: center !important;
    margin-bottom: 20px !important;
}

/* Add "DayTV " prefix ONLY to "Sign in" heading on login page */
body:has(input[name="username"]) .MuiTypography-h5:first-of-type::before {
    content: "DayTV " !important;
}

/* All other headings */
.MuiTypography-h1, .MuiTypography-h6, .MuiTypography-h4 {
    color: white !important;
    font-weight: 600 !important;
    text-align: center !important;
}

/* Body text */
.MuiTypography-body1, .MuiTypography-body2 {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Reduce spacing between input fields */
.MuiTextField-root {
    margin: 8px 0 !important;
}

.MuiFormControl-root {
    margin: 8px 0 !important;
}

/* Input fields */
.MuiOutlinedInput-root {
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 10px !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.3s ease !important;
}

.MuiOutlinedInput-root:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

.MuiOutlinedInput-root.Mui-focused {
    background: rgba(255, 255, 255, 0.35) !important;
}

.MuiOutlinedInput-root fieldset {
    border-color: rgba(255, 255, 255, 0.4) !important;
    border-width: 2px !important;
}

.MuiOutlinedInput-root:hover fieldset {
    border-color: rgba(255, 255, 255, 0.6) !important;
}

.MuiOutlinedInput-root.Mui-focused fieldset {
    border-color: white !important;
    border-width: 2px !important;
}

.MuiOutlinedInput-input {
    color: white !important;
    font-size: 15px !important;
    padding: 14px 16px !important;
}

/* Input labels */
.MuiInputLabel-root {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
}

.MuiInputLabel-root.Mui-focused {
    color: white !important;
}

/* Remember me checkbox */
.MuiFormControlLabel-root {
    margin: 12px 0 20px 0 !important;
}

.MuiCheckbox-root {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 8px !important;
}

.MuiCheckbox-root.Mui-checked {
    color: white !important;
}

.MuiFormControlLabel-label {
    color: white !important;
    font-size: 15px !important;
}

/* Primary buttons - White buttons */
.MuiButton-containedPrimary, .MuiButton-root.MuiButton-contained {
    background: white !important;
    color: #4A9FD8 !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    padding: 14px 48px !important;
    border-radius: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
    transition: all 0.3s ease !important;
    margin: 8px !important;
}

.MuiButton-containedPrimary:hover, .MuiButton-root.MuiButton-contained:hover {
    background: #f5f5f5 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}

/* Text buttons */
.MuiButton-text,
.MuiButtonBase-root.MuiButton-root.MuiButton-text {
    color: white !important;
    text-transform: none !important;
    font-size: 15px !important;
    padding: 8px 16px !important;
}

.MuiButton-text:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Outlined buttons */
.MuiButton-outlined {
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.MuiButton-outlined:hover {
    border-color: white !important;
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Links */
a, .MuiLink-root {
    color: white !important;
    text-decoration: none !important;
    font-weight: 500 !important;
}

a:hover, .MuiLink-root:hover {
    text-decoration: underline !important;
}

/* HIDE "Powered by Authelia" */
a[href="https://www.authelia.com"],
a[href*="authelia.com"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
}

.MuiLink-root[href*="authelia.com"] {
    display: none !important;
}

.tss-1ioowdv-links {
    display: none !important;
}

/* Authenticated card - glass effect */
.MuiPaper-root:not(.MuiAppBar-root):not(.MuiDrawer-paper):not(.MuiDialog-paper):not(.MuiMenu-paper):not(.MuiPopover-paper) {
    background: rgba(74, 159, 216, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
    backdrop-filter: blur(15px) !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

/* ============================================== */
/* MODAL/DIALOG - BASED ON ACTUAL DOM STRUCTURE  */
/* ============================================== */

/* Target the exact structure from the screenshots:
   .MuiDialog-paper > .MuiDialogContent-root > .MuiGrid-root
*/

/* The main dialog paper - from screenshot class list */
.MuiDialog-paper.MuiPaper-root.MuiPaper-elevation.MuiPaper-rounded,
.MuiDialog-paper.MuiDialog-paperScrollPaper,
.MuiDialog-paper {
    background: #0f1921 !important;
    background-color: #0f1921 !important;
}

/* More specific - target MuiDialog-paper with all its classes */
.MuiPaper-root.MuiPaper-elevation.MuiDialog-paper {
    background: #0f1921 !important;
    background-color: #0f1921 !important;
}

/* Target MuiDialogContent-root from the structure */
.MuiDialogContent-root.mui-1nbx5hx {
    background: transparent !important;
}

/* The Grid container inside dialog content */
.MuiDialogContent-root > .MuiGrid-root,
.MuiDialogContent-root .MuiGrid-container {
    background: transparent !important;
}

/* Method option containers - the white boxes we see */
.MuiDialogContent-root .MuiGrid-root .MuiGrid-item {
    background: transparent !important;
}

/* The actual method buttons */
.MuiDialogContent-root .MuiButtonBase-root,
.MuiDialogContent-root button.MuiButton-root {
    background: rgba(255, 255, 255, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.3s ease !important;
}

/* Hover state for method buttons - keep dark with better visibility */
.MuiDialogContent-root .MuiButtonBase-root:hover,
.MuiDialogContent-root button.MuiButton-root:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2) !important;
}

/* Active/pressed state */
.MuiDialogContent-root .MuiButtonBase-root:active,
.MuiDialogContent-root button.MuiButton-root:active {
    background: rgba(255, 255, 255, 0.3) !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(0) !important;
}

/* Ensure ripple effect is visible but not white */
.MuiDialogContent-root .MuiTouchRipple-root {
    color: rgba(255, 255, 255, 0.3) !important;
}

.MuiDialogContent-root .MuiTouchRipple-child {
    background-color: rgba(255, 255, 255, 0.3) !important;
}

/* Typography inside buttons - from screenshot */
.MuiDialogContent-root .MuiTypography-root.MuiTypography-body1,
.MuiDialogContent-root p.MuiTypography-body1 {
    color: white !important;
}

/* The icon containers - tss-11qfc0m-icon class from screenshot */
.MuiDialogContent-root .tss-11qfc0m-icon,
.MuiDialogContent-root [class*="icon"] {
    background: transparent !important;
}

/* SVG icons must be white - BUT exclude QR codes */
/* QR codes are typically inside a specific container or are larger SVGs */
.MuiDialogContent-root .MuiSvgIcon-root,
.MuiDialogContent-root button svg,
.MuiDialogContent-root .MuiIconButton-root svg,
.MuiDialog-paper .MuiSvgIcon-root,
.MuiDialog-paper button svg,
.MuiDialog-paper .MuiIconButton-root svg {
    fill: white !important;
    color: white !important;
}

/* Stepper icons should be white */
.MuiStepIcon-root,
.MuiStepIcon-root svg,
.MuiStepper-root svg {
    color: white !important;
    fill: white !important;
}

/* ============================================== */
/* QR CODE - MUST BE VISIBLE (BLACK ON WHITE)    */
/* ============================================== */

/* Target the specific QR code class from Authelia */
svg.tss-6dhvs3-qrcode,
svg.tss-6dhvs3-qrcode path,
svg[class*="qrcode"],
svg[class*="qrcode"] path,
.tss-138uzwp-qrcodeContainer svg,
.tss-138uzwp-qrcodeContainer svg path,
[class*="qrcodeContainer"] svg,
[class*="qrcodeContainer"] svg path {
    fill: revert !important;
    color: revert !important;
}

/* Ensure the white background path stays white and black stays black */
svg.tss-6dhvs3-qrcode path[fill="#FFFFFF"],
svg[class*="qrcode"] path[fill="#FFFFFF"] {
    fill: #FFFFFF !important;
}

svg.tss-6dhvs3-qrcode path[fill="#000000"],
svg[class*="qrcode"] path[fill="#000000"] {
    fill: #000000 !important;
}

/* QR Code container - ensure it displays properly */
/* QR codes are usually in a Box or div, not a button */
.MuiDialogContent-root > .MuiBox-root > svg:not(.MuiSvgIcon-root),
.MuiDialogContent-root canvas,
.MuiDialog-paper canvas,
svg[viewBox][width][height]:not(.MuiSvgIcon-root) {
    fill: initial !important;
    color: initial !important;
}

/* Ensure QR code paths use their original colors (black) */
.MuiDialogContent-root > .MuiBox-root > svg path,
.MuiDialogContent-root > div > svg:not(.MuiSvgIcon-root) path {
    fill: initial !important;
}

/* The MuiBox-root containers */
.MuiDialogContent-root .MuiBox-root {
    background: transparent !important;
    color: white !important;
}

/* MuiTouchRipple - the ripple effect root */
.MuiDialogContent-root .MuiTouchRipple-root {
    color: rgba(255, 255, 255, 0.3) !important;
}

/* ALL Typography in dialog must be white */
.MuiDialog-paper .MuiTypography-root,
.MuiDialogContent-root .MuiTypography-root,
.MuiDialogContent-root p,
.MuiDialogContent-root span,
.MuiDialogContent-root div {
    color: white !important;
}

/* Dialog actions (Close button area) */
.MuiDialogActions-root {
    background: transparent !important;
    padding: 16px 24px !important;
    justify-content: center !important;
    display: flex !important;
    gap: 16px !important;
}

/* Close button styling */
.MuiDialogActions-root .MuiButton-text {
    color: white !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Dialog action buttons - CANCEL and VERIFY */
.MuiDialogActions-root .MuiButton-root {
    min-width: 120px !important;
}

/* WebAuthn Info Modal - KID and PUBLIC KEY buttons */
.MuiDialogActions-root .MuiButton-containedPrimary,
.MuiDialogActions-root .MuiButton-contained {
    background: white !important;
    color: #4A9FD8 !important;
    font-weight: 700 !important;
}

.MuiDialogActions-root .MuiButton-containedPrimary:hover,
.MuiDialogActions-root .MuiButton-contained:hover {
    background: #f5f5f5 !important;
}

/* Copy icon inside buttons - make it visible */
.MuiDialogActions-root .MuiButton-root .MuiButton-startIcon,
.MuiDialogActions-root .MuiButton-root .MuiButton-endIcon,
.MuiDialogActions-root .MuiButton-root svg,
.MuiDialogActions-root .MuiButton-root svg path,
.MuiDialogActions-root .MuiButton-contained svg,
.MuiDialogActions-root .MuiButton-contained svg path,
.MuiDialogActions-root .MuiButton-containedPrimary svg,
.MuiDialogActions-root .MuiButton-containedPrimary svg path {
    color: #4A9FD8 !important;
    fill: #4A9FD8 !important;
}

/* Ensure icon spans also get the color */
.MuiDialogActions-root .MuiButton-root .MuiButton-startIcon *,
.MuiDialogActions-root .MuiButton-root .MuiButton-endIcon * {
    color: #4A9FD8 !important;
    fill: #4A9FD8 !important;
}

/* Ensure button text doesn't wrap */
.MuiDialogActions-root .MuiButton-root {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* Backdrop */
.MuiBackdrop-root {
    background-color: rgba(0, 0, 0, 0.85) !important;
}

/* ============================================== */
/* SETTINGS PAGE CARDS                            */
/* ============================================== */

/* Settings cards with darker background */
.MuiGrid-root .MuiPaper-root,
main .MuiPaper-root {
    background: rgba(30, 50, 65, 0.9) !important;
    border: 2px solid rgba(255, 255, 255, 0.25) !important;
}

/* ============================================== */
/* HIDE WEBAUTHN CREDENTIALS CARD (SETTINGS ONLY) */
/* ============================================== */

/* 
   Only target settings page - look for the MuiPaper-outlined cards
   that appear in the settings area, NOT on login page
*/

/* Hide the second outlined paper card in settings (WebAuthn) */
/* Settings page has MuiPaper-outlined cards, login page doesn't */
main .MuiGrid-spacing-xs-2 > .MuiGrid-root:nth-child(2) > .MuiPaper-outlined {
    display: none !important;
}

/* Also hide the grid item itself to remove empty space */
main .MuiGrid-spacing-xs-2 > .MuiGrid-root:nth-child(2):has(.MuiPaper-outlined) {
    display: none !important;
}

/* ============================================== */
/* ONE-TIME PASSWORD CARD - CENTERED & POLISHED  */
/* ============================================== */

/* Center content within the OTP settings card */
.MuiPaper-outlined .MuiGrid-container,
.MuiPaper-outlined .MuiGrid-root.MuiGrid-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

/* Center the ADD button */
.MuiPaper-outlined .MuiButton-outlined,
.MuiPaper-root.MuiPaper-outlined .MuiButton-root {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Center the descriptive text */
.MuiPaper-outlined .MuiTypography-body1,
.MuiPaper-outlined .MuiTypography-body2,
.MuiPaper-outlined p {
    text-align: center !important;
    width: 100% !important;
}

/* Center card titles */
.MuiPaper-outlined .MuiTypography-h5,
.MuiPaper-outlined .MuiTypography-h6 {
    text-align: center !important;
    width: 100% !important;
}

/* All card content must be white */
.MuiCardContent-root,
.MuiCardContent-root *,
.MuiCard-root,
.MuiCard-root * {
    color: white !important;
}

/* Card titles */
.MuiCardContent-root h1,
.MuiCardContent-root h2,
.MuiCardContent-root h3,
.MuiCardContent-root h4,
.MuiCardContent-root h5,
.MuiCardContent-root h6 {
    color: white !important;
    font-weight: 700 !important;
}

/* Descriptive text in cards */
.MuiCardContent-root p,
.MuiCardContent-root span:not(.MuiButton-label) {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Form labels in settings (like "Default Method") */
.MuiFormLabel-root,
.MuiFormLabel-colorPrimary,
label.MuiFormLabel-root,
.MuiFormControl-root label,
.MuiFormGroup-root label {
    color: white !important;
}

/* Radio button labels and form control labels */
.MuiFormControlLabel-root .MuiFormControlLabel-label,
.MuiRadioGroup-root label {
    color: white !important;
}

/* ADD buttons in cards */
.MuiCardContent-root .MuiButton-outlined,
.MuiCard-root .MuiButton-outlined,
button.MuiButton-outlined {
    color: white !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    font-weight: 600 !important;
}

.MuiCardContent-root .MuiButton-outlined:hover,
.MuiCard-root .MuiButton-outlined:hover {
    border-color: white !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

/* ============================================== */
/* MENU/POPOVER/DROPDOWN                          */
/* ============================================== */

.MuiPopover-paper,
.MuiMenu-paper,
.MuiMenu-list,
ul[role="menu"] {
    background: rgba(20, 35, 45, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
}

.MuiMenuItem-root,
li[role="menuitem"] {
    color: white !important;
    padding: 12px 24px !important;
    font-size: 15px !important;
}

.MuiMenuItem-root:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.MuiMenuItem-root *,
.MuiMenuItem-root .MuiListItemText-primary,
.MuiMenuItem-root .MuiListItemText-secondary {
    color: white !important;
}

.MuiMenuItem-root .MuiSvgIcon-root {
    color: rgba(255, 255, 255, 0.9) !important;
    margin-right: 12px !important;
}

/* ============================================== */
/* SETTINGS SIDEBAR                               */
/* ============================================== */

.MuiDrawer-paper {
    background: rgba(15, 32, 39, 0.95) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.MuiListItem-root {
    color: white !important;
}

.MuiListItemButton-root:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.MuiListItemText-primary {
    color: white !important;
}

.MuiListItemText-secondary {
    color: rgba(255, 255, 255, 0.7) !important;
}

.MuiListItemIcon-root {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ============================================== */
/* ICONS AND SPECIAL ELEMENTS                     */
/* ============================================== */

/* Success icon */
svg[data-testid*="CheckCircle"],
.MuiSvgIcon-root[data-testid*="CheckCircle"] {
    color: #4caf50 !important;
    filter: drop-shadow(0 4px 8px rgba(76, 175, 80, 0.4)) !important;
    width: 64px !important;
    height: 64px !important;
}

/* Error/Alert styling */
.MuiAlert-root {
    background: rgba(244, 67, 54, 0.25) !important;
    color: white !important;
    border: 2px solid rgba(244, 67, 54, 0.6) !important;
    border-radius: 10px !important;
    margin: 12px 0 !important;
}

.MuiAlert-standardSuccess {
    background: rgba(76, 175, 80, 0.25) !important;
    border-color: rgba(76, 175, 80, 0.6) !important;
}

/* Icon buttons */
.MuiIconButton-root {
    color: rgba(255, 255, 255, 0.8) !important;
}

.MuiIconButton-root:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* 2FA screens */
.MuiToggleButton-root {
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    text-transform: none !important;
}

.MuiToggleButton-root.Mui-selected {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: white !important;
}

/* Dividers */
.MuiDivider-root {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Loading spinner */
.MuiCircularProgress-root {
    color: white !important;
}

/* ============================================== */
/* GLOBAL TEXT ENFORCEMENT                        */
/* ============================================== */

.MuiTypography-root {
    color: white !important;
}

body, #root {
    color: white !important;
}

/* ============================================== */
/* RESPONSIVE - ENHANCED FOR MOBILE              */
/* ============================================== */

@media (max-width: 600px) {
    /* Ensure body takes full viewport on mobile */
    body {
        padding: 16px !important;
        min-height: 100dvh !important;
    }
    
    /* Card/form container adjustments */
    .MuiPaper-root:not(.MuiAppBar-root):not(.MuiDrawer-paper):not(.MuiDialog-paper):not(.MuiMenu-paper):not(.MuiPopover-paper) {
        margin: 16px !important;
        padding: 20px 16px !important;
        width: calc(100% - 32px) !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Logo mobile - keep same centering method but smaller */
    img[alt="Logo"] {
        height: 60px !important;
        max-width: 220px !important;
        /* Keep the transform centering on mobile too */
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    /* Ensure the logo's parent container doesn't clip it */
    .MuiGrid-root:has(> img[alt="Logo"]),
    div.MuiGrid-direction-xs-row:has(img[alt="Logo"]) {
        overflow: visible !important;
    }
    
    /* Ensure containers are full width on mobile */
    #first-factor-stage,
    #first-factor-stage .MuiContainer-root,
    #first-factor-stage .MuiGrid-container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box !important;
    }
    
    /* Form elements full width on mobile */
    #first-factor-stage .MuiTextField-root,
    #first-factor-stage .MuiFormControl-root,
    #first-factor-stage .MuiButton-root,
    #first-factor-stage .MuiFormControlLabel-root {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Heading adjustments */
    .MuiTypography-h5 {
        font-size: 24px !important;
        margin-bottom: 16px !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    /* Input field adjustments */
    .MuiOutlinedInput-input {
        padding: 12px 14px !important;
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
    
    /* Button adjustments */
    .MuiButton-containedPrimary, 
    .MuiButton-root.MuiButton-contained {
        padding: 12px 32px !important;
        font-size: 15px !important;
        width: 100% !important;
        margin: 8px 0 !important;
    }
    
    /* Text buttons full width on mobile */
    .MuiButton-text {
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* Reduce form spacing on mobile */
    .MuiTextField-root,
    .MuiFormControl-root {
        margin: 6px 0 !important;
    }
    
    /* Remember me checkbox */
    .MuiFormControlLabel-root {
        margin: 8px 0 16px 0 !important;
    }
    
    /* Dialog adjustments for mobile */
    .MuiDialog-paper {
        margin: 16px !important;
        max-width: calc(100% - 32px) !important;
        max-height: calc(100vh - 32px) !important;
    }
    
    .MuiDialogActions-root {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 16px !important;
    }
    
    .MuiDialogActions-root .MuiButton-root {
        width: 100% !important;
        min-width: unset !important;
    }
}

/* Extra small devices */
@media (max-width: 380px) {
    img[alt="Logo"] {
        height: 50px !important;
        max-width: 180px !important;
    }
    
    .MuiTypography-h5 {
        font-size: 20px !important;
    }
    
    .MuiPaper-root:not(.MuiAppBar-root):not(.MuiDrawer-paper):not(.MuiDialog-paper):not(.MuiMenu-paper):not(.MuiPopover-paper) {
        padding: 16px 12px !important;
        margin: 12px !important;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    img[alt="Logo"] {
        height: 50px !important;
        margin-bottom: 12px !important;
    }
    
    .MuiTypography-h5 {
        font-size: 22px !important;
        margin-bottom: 12px !important;
    }
    
    .MuiTextField-root,
    .MuiFormControl-root {
        margin: 4px 0 !important;
    }
}
