/* UNIDA Gateway top presentation controls: language + Tanzania theme + light/dark */

html, body {
    min-height: 100%;
}

body {
    position: relative;
}

/* Tanzania flag layer */
html.tz-theme-on body::before{
    content:"" !important;
    position:fixed !important;
    inset:0 !important;
    z-index:-2 !important;
    pointer-events:none !important;
    opacity:.13 !important;
    background:
        linear-gradient(145deg,
            #1eb53a 0 38%,
            #fcd116 38% 42%,
            #000000 42% 58%,
            #fcd116 58% 62%,
            #00a3dd 62% 100%) !important;
    background-size:240% 240% !important;
    animation:tzThemeWave 11s ease-in-out infinite !important;
}

html.tz-theme-on body::after{
    content:"" !important;
    position:fixed !important;
    inset:0 !important;
    z-index:-1 !important;
    pointer-events:none !important;
    background:
        radial-gradient(circle at 86% 12%, rgba(20,181,176,.20), transparent 30%),
        linear-gradient(135deg, rgba(255,255,255,.93), rgba(240,250,255,.92), rgba(247,255,251,.93)) !important;
}

html.ui-dark.tz-theme-on body::after{
    background:
        radial-gradient(circle at 86% 12%, rgba(20,181,176,.20), transparent 30%),
        linear-gradient(135deg, rgba(4,18,40,.93), rgba(6,38,74,.91), rgba(4,45,46,.92)) !important;
}

html.ui-dark.tz-theme-on body::before{
    opacity:.18 !important;
}

html.tz-theme-off body::before,
html.tz-theme-off body::after{
    display:none !important;
}

html.ui-dark body{
    background:#061a35 !important;
    color:#eaf6ff !important;
}

html.ui-light body{
    background:#f7fbff !important;
    color:#0b2342 !important;
}

@keyframes tzThemeWave{
    0%{background-position:0% 45%;transform:scale(1) skewY(0deg)}
    25%{background-position:45% 52%;transform:scale(1.018) skewY(-.55deg)}
    50%{background-position:100% 56%;transform:scale(1.012) skewY(.55deg)}
    75%{background-position:45% 50%;transform:scale(1.018) skewY(-.45deg)}
    100%{background-position:0% 45%;transform:scale(1) skewY(0deg)}
}

/* Dark mode readable surfaces */
html.ui-dark .card,
html.ui-dark .panel,
html.ui-dark .stat,
html.ui-dark .stat-card,
html.ui-dark .module,
html.ui-dark .quick-card,
html.ui-dark .hero-card,
html.ui-dark .form-card,
html.ui-dark .auth-card,
html.ui-dark .login-card,
html.ui-dark .register-card,
html.ui-dark .modal-content,
html.ui-dark .dropdown-menu,
html.ui-dark table,
html.ui-dark .table,
html.ui-dark .white-card,
html.ui-dark [class*="card"],
html.ui-dark [class*="panel"]{
    background-color:rgba(8,30,58,.88) !important;
    border-color:rgba(91,185,220,.25) !important;
    color:#eaf6ff !important;
    backdrop-filter:blur(8px);
}

html.ui-dark h1,
html.ui-dark h2,
html.ui-dark h3,
html.ui-dark h4,
html.ui-dark h5,
html.ui-dark h6{
    color:#eaf6ff !important;
}

html.ui-dark p,
html.ui-dark span,
html.ui-dark small,
html.ui-dark .route p,
html.ui-dark .module p,
html.ui-dark .quick-card p{
    color:#b9d4e8 !important;
}

html.ui-dark .nav,
html.ui-dark header,
html.ui-dark .site-header,
html.ui-dark .navbar{
    background:rgba(6,26,53,.92) !important;
    border-color:rgba(91,185,220,.25) !important;
    backdrop-filter:blur(14px);
}

html.ui-dark .btn.light,
html.ui-dark .btn.outline{
    background:rgba(255,255,255,.08) !important;
    color:#eaf6ff !important;
    border-color:rgba(185,212,232,.35) !important;
}

html.ui-dark input,
html.ui-dark select,
html.ui-dark textarea{
    background:rgba(255,255,255,.08) !important;
    color:#eaf6ff !important;
    border-color:rgba(185,212,232,.32) !important;
}

/* Top controls, not floating bottom */
.unida-theme-controls{
    display:flex;
    align-items:center;
    gap:8px;
    margin-left:10px;
    z-index:9999;
}

.unida-theme-control{
    width:38px;
    height:38px;
    border-radius:999px;
    border:1px solid rgba(199,232,245,.95);
    background:rgba(255,255,255,.92);
    color:#083b86;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    font-size:15px;
    font-weight:900;
    box-shadow:0 10px 24px rgba(8,59,134,.10);
    transition:.2s ease;
    position:relative;
}

.unida-theme-control:hover{
    transform:translateY(-2px);
}

html.ui-dark .unida-theme-control{
    background:rgba(8,30,58,.92);
    color:#eaf6ff;
    border-color:rgba(91,185,220,.28);
}

html.tz-theme-on .control-tz{
    background:linear-gradient(135deg,#1eb53a,#00a3dd);
    color:#fff;
}

html.ui-dark .control-mode{
    background:linear-gradient(135deg,#061a35,#14b5b0);
    color:#fff;
}

.unida-lang-menu{
    position:absolute;
    top:45px;
    right:0;
    background:#fff;
    border:1px solid rgba(215,235,245,.95);
    border-radius:16px;
    box-shadow:0 18px 45px rgba(8,59,134,.16);
    padding:8px;
    display:none;
    min-width:150px;
}

html.ui-dark .unida-lang-menu{
    background:rgba(8,30,58,.98);
    border-color:rgba(91,185,220,.28);
}

.unida-lang-menu button{
    width:100%;
    border:0;
    background:transparent;
    padding:10px 12px;
    text-align:left;
    cursor:pointer;
    border-radius:10px;
    color:#083b86;
    font-weight:800;
}

html.ui-dark .unida-lang-menu button{
    color:#eaf6ff;
}

.unida-lang-menu button:hover{
    background:#eaf8ff;
}

html.ui-dark .unida-lang-menu button:hover{
    background:rgba(255,255,255,.08);
}

.unida-lang-wrapper{
    position:relative;
}

.unida-lang-wrapper.open .unida-lang-menu{
    display:block;
}

/* Reserve bottom-right for future AI assistant */
.unida-theme-controls.bottom-old,
.tz-theme-toggle{
    display:none !important;
}

@media(max-width:900px){
    .unida-theme-controls{
        width:100%;
        justify-content:flex-start;
        margin-left:0;
        margin-top:10px;
        flex-wrap:wrap;
    }
}

/* Final compact auth header fix */
body:has(.auth-card),
body:has(.login-card),
body:has(.register-card) {
    padding-top: 0 !important;
}

.site-header,
.auth-header,
header {
    z-index: 50 !important;
}

.site-header .brand img,
.auth-header .brand img,
header .brand img,
.site-header .demo-brand-logo,
.auth-header .demo-brand-logo {
    width: 58px !important;
    height: 58px !important;
    max-width: 58px !important;
    max-height: 58px !important;
    border-radius: 18px !important;
}

.site-header .brand,
.auth-header .brand,
header .brand {
    gap: 12px !important;
}

.site-header .brand h1,
.auth-header .brand h1,
header .brand h1,
.site-header .brand strong,
.auth-header .brand strong {
    font-size: 20px !important;
    line-height: 1.05 !important;
}

.site-header .brand p,
.auth-header .brand p,
.site-header .brand small,
.auth-header .brand small {
    font-size: 12px !important;
}

.auth-shell,
.auth-main,
.login-shell,
.register-shell,
main {
    padding-top: 56px !important;
}

@media(max-width:900px){
    .site-header,
    .auth-header,
    header {
        position: relative !important;
    }

    .auth-shell,
    .auth-main,
    .login-shell,
    .register-shell,
    main {
        padding-top: 24px !important;
    }
}
