/* ================================================
   AASS GPS Tracker - Premium Redesign FINAL
   Traccar 6.x Override
   ================================================ */

/* ---- BASE APP LAYOUT FIX (Restores Dashboard Map) ---- */
html, body {
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

#root {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* ---- ENTIRE PAGE BACKGROUND ---- */
#root > main {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100vh !important;
    background: url('/background.webp') no-repeat center center / cover !important;
    position: relative !important;
}

/* Dark gradient overlay matching the #root > main website aesthetic */
#root > main::before {
    content: "" !important;
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(10, 20, 40, 0.75) 0%, rgba(8, 145, 178, 0.4) 100%) !important;
    z-index: 0 !important;
}

#root > main>* {
    position: relative !important;
    z-index: 1 !important;
}

/* ---- HIDE SIDEBAR ---- */
#root > main>div:first-child {
    display: none !important;
}

/* ---- LOGIN CARD (Glassmorphism) ---- */
#root > main>.MuiPaper-root {
    position: relative !important;
    background: rgba(15, 27, 45, 0.85) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(8, 145, 178, 0.3) !important;
    border-top: 4px solid #0891b2 !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(8, 145, 178, 0.15) !important;
    padding: 110px 45px 50px 45px !important; 
    width: 450px !important;
    max-width: 92vw !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

/* 1. Logo Position (Absolute) */
#root > main>.MuiPaper-root::before {
    content: "" !important;
    position: absolute !important;
    top: -45px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90px !important;
    height: 90px !important;
    background: #0f1b2d url('/logo.webp') center/cover no-repeat !important;
    border: 4px solid #0891b2 !important;
    border-radius: 50% !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0,0,0,0.5) !important;
    z-index: 20 !important;
}

/* 2. Text Branding (SVG data URI for perfect typography) */
#root > main>.MuiPaper-root::after {
    content: "" !important;
    position: absolute !important;
    top: 60px !important;
    left: 0 !important;
    width: 100% !important;
    height: 55px !important;
    background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22450%22%20height%3D%2255%22%20viewBox%3D%220%200%20450%2055%22%3E%3Ctext%20x%3D%22225%22%20y%3D%2224%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-weight%3D%22900%22%20font-size%3D%2221%22%20fill%3D%22%23ffffff%22%20letter-spacing%3D%221.5%22%3EASANTE%20AUTOMATION%3C%2Ftext%3E%3Ctext%20x%3D%22225%22%20y%3D%2248%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-weight%3D%22700%22%20font-size%3D%2213%22%20fill%3D%22%2338bdf8%22%20letter-spacing%3D%222.5%22%3E%26amp%3B%20SECURITY%20SOLUTIONS%3C%2Ftext%3E%3C%2Fsvg%3E') no-repeat center center !important;
    z-index: 10 !important;
}

/* Hide Traccar's native titles and redundant images */
#root > main .MuiPaper-root .MuiTypography-root,
#root > main .MuiPaper-root img[src*="logo"],
#root > main .MuiPaper-root img[alt=""],
#root > main .MuiPaper-root [class*="container"] img:not([class*="flag"]) {
    display: none !important;
}

/* Restore Typography color for inputs/labels */
#root > main .MuiPaper-root *, .MuiTypography-root {
    color: white !important;
}

/* Ensure centering */
#root > main .MuiPaper-root > div, #root > main .muiltr-4148z2-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    visibility: visible !important;
}

/* ---- TOP RIGHT ICONS FIX (Perfect fit) ---- */
#root > main .MuiToolbar-root {
    position: absolute !important;
    top: 20px !important;
    right: 30px !important;
    z-index: 100 !important;
    display: flex !important;
    gap: 12px !important;
    padding: 0 !important;
    background: transparent !important;
    justify-content: flex-end !important;
}

/* Restore Language Flags */
#root > main .MuiSelect-select img, #root > main img[class*="flag"] {
    display: inline-block !important;
    content: normal !important; 
    width: 24px !important;
    height: auto !important;
    border-radius: 4px !important;
    margin-right: 8px !important;
    filter: none !important;
}

/* Fix QR Code Button */
#root > main button.MuiIconButton-root:has(svg[data-testid="QrCodeIcon"]),
#root > main [aria-label="QR Code"],
#root > main .muiltr-15jgqyf {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    aspect-ratio: 1/1 !important;
    border-radius: 50% !important;
    background: rgba(15, 27, 45, 0.6) !important;
    backdrop-filter: blur(5px) !important;
    border: 1px solid rgba(8, 145, 178, 0.4) !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ---- FORM STYLING (Perfect Center) ---- */
#root > main form {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    margin-top: 40px !important; /* Space for the bigger title */
}

/* Premium "Location & Map" Subtitle */
#root > main form::before {
    content: "GPS FLEET TRACKING SYSTEM" !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #38bdf8 !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    letter-spacing: 2px !important;
    margin-bottom: 30px !important;
    padding-left: 24px !important;
    /* Map Marker SVG */
    background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22%2338bdf8%22%3E%3Cpath%20d%3D%22M12%202C8.13%202%205%205.13%205%209c0%205.25%207%2013%207%2013s7-7.75%207-13c0-3.87-3.13-7-7-7zm0%209.5c-1.38%200-2.5-1.12-2.5-2.5s1.12-2.5%202.5-2.5%202.5%201.12%202.5%202.5-1.12%202.5-2.5%202.5z%22%2F%3E%3C%2Fsvg%3E') no-repeat left center !important;
    background-size: 18px 18px !important;
    width: fit-content !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Clear pseudo elements */
#root > main form::after {
    content: none !important;
}

/* Make inputs perfectly center and 100% width */
#root > main .MuiFormControl-root {
    width: 100% !important;
    margin-bottom: 20px !important;
}

#root > main .MuiOutlinedInput-root {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 12px !important;
    width: 100% !important;
}

#root > main .MuiOutlinedInput-notchedOutline {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

#root > main .Mui-focused .MuiOutlinedInput-notchedOutline {
    border-color: #0891b2 !important;
}

/* Form Buttons */
#root > main .MuiButtonBase-root[type="submit"] {
    background: linear-gradient(135deg, #0891b2, #0369a1) !important;
    border-radius: 12px !important;
    padding: 14px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    margin-top: 15px !important;
    width: 100% !important;
    box-shadow: 0 10px 20px rgba(8, 145, 178, 0.3) !important;
    transition: all 0.3s ease !important;
}

/* Register Links etc */
#root > main .MuiTypography-root[href] {
    align-self: center !important;
    margin-top: 20px !important;
}

/* ---- MOBILE RESPONSIVENESS ---- */
@media (max-width: 600px) {
    #root > main>.MuiPaper-root {
        width: 90vw !important;
        padding: 95px 25px 35px 25px !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6) !important;
    }
    
    /* Shrink logo and titles for mobile fitting completely */
    #root > main>.MuiPaper-root::before {
        width: 75px !important;
        height: 75px !important;
        top: -38px !important;
    }
    
    #root > main>.MuiPaper-root::after {
        top: 50px !important;
        background: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22300%22%20height%3D%2250%22%20viewBox%3D%220%200%20300%2050%22%3E%3Ctext%20x%3D%22150%22%20y%3D%2222%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-weight%3D%22900%22%20font-size%3D%2216%22%20fill%3D%22%23ffffff%22%20letter-spacing%3D%221%22%3EASANTE%20AUTOMATION%3C%2Ftext%3E%3Ctext%20x%3D%22150%22%20y%3D%2244%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-weight%3D%22700%22%20font-size%3D%2210%22%20fill%3D%22%2338bdf8%22%20letter-spacing%3D%221.5%22%3E%26amp%3B%20SECURITY%20SOLUTIONS%3C%2Ftext%3E%3C%2Fsvg%3E') no-repeat center center !important;
    }
    
#root > main form {
        margin-top: 30px !important;
    }

    /* Mobile Header Layout */
#root > main div[class*="options"] {
        padding: 0 15px !important;
    }
}

/* 1. Header Symmetry Logic - CARD BOUNDARY VERSION */

/* 
   Since backdrop-filter traps fixed positioning, we use absolute 
   positioning relative to the login card (.MuiPaper-root).
*/

#root > main div[class*="options"] {
    position: absolute !important;
    top: 20px !important;
    left: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 24px !important;
    box-sizing: border-box !important;
    z-index: 5000 !important;
    background: transparent !important;
}

/* QR Code Button Styling & Order */
#root > main button.MuiIconButton-colorPrimary {
    order: -1 !important;
    margin: 0 !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: rgba(15, 27, 45, 0.6) !important;
    border: 1px solid rgba(8, 145, 178, 0.4) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #38bdf8 !important;
}

#root > main button.MuiIconButton-colorPrimary:hover {
    background: rgba(8, 145, 178, 0.2) !important;
    border-color: #38bdf8 !important;
}

/* Language Selector Styling (User suggestion: Reduced size) */
#root > main div[class*="options"] div.MuiFormControl-root {
    order: 1 !important;
    margin: 0 !important;
    min-width: 100px !important;
    max-width: 140px !important;
}

/* Ensure the selector doesn't have excess margins or alignment issues */
#root > main div[class*="options"] .MuiSelect-select {
    padding: 8px 32px 8px 12px !important;
    font-size: 0.9rem !important;
}

/* Remove default MUI toolbar absolute positioning */
#root > main .MuiToolbar-root {
    display: none !important;
}

#root > main button.MuiIconButton-colorPrimary:hover {
    background: rgba(8, 145, 178, 0.2) !important;
    border-color: #38bdf8 !important;
}

/* ---- LANGUAGE SELECTOR MENU THEMING ---- */
.MuiPopover-paper.MuiMenu-paper {
    background: rgba(15, 27, 45, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(8, 145, 178, 0.4) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
    border-radius: 12px !important;
}

.MuiMenuItem-root {
    color: white !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease !important;
    padding: 10px 24px !important;
}

.MuiMenuItem-root:hover {
    background: rgba(8, 145, 178, 0.2) !important;
    color: #38bdf8 !important;
}

/* Fix specific selected state */
.MuiMenuItem-root.Mui-selected {
    background: rgba(8, 145, 178, 0.3) !important;
}

.MuiMenuItem-root.Mui-selected:hover {
    background: rgba(8, 145, 178, 0.4) !important;
}
