:root {
    --accent: #4e73df;
    --accent-hover: #3d5fc4;
    --accent-soft: rgba(78, 115, 223, 0.12);
    --sidebar-bg: #1a2236;
    --sidebar-deep: #12192b;
    --text: #343a40;
    --text-muted: #6c757d;
    --border: #e2e6ea;
    --card-shadow: 0 20px 50px rgba(26, 34, 54, 0.12);
    --radius: 14px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

:lang(ar) body {
    font-family: "Cairo", sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    background: #f0f2f5;
    -webkit-font-smoothing: antialiased;
}

.login-lang-wrap {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
}

[dir="rtl"] .login-lang-wrap {
    right: auto;
    left: 1rem;
}

.login-lang { position: relative; }

.lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.lang-trigger:hover {
    border-color: #ced4da;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.lang-trigger[aria-expanded="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.lang-trigger .chev {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.lang-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }

.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 11rem;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(26, 34, 54, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

[dir="rtl"] .lang-menu { right: auto; left: 0; }

.lang-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-menu button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    text-align: inherit;
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition);
}

.lang-menu button:hover,
.lang-menu button:focus-visible {
    background: #f8f9fa;
    outline: none;
}

.lang-menu button.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.lang-menu .lang-flag {
    font-size: 1.1rem;
    line-height: 1;
}

.login-shell {
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    overflow: hidden;
}

@media (max-width: 960px) {
    .login-shell { grid-template-columns: 1fr; }
}

.login-shell-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.shell-blob {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.shell-blob-a {
    width: min(75vmin, 560px);
    height: min(75vmin, 560px);
    top: -18%;
    left: -12%;
    background: radial-gradient(circle at 35% 35%, rgba(78, 115, 223, 0.35) 0%, rgba(78, 115, 223, 0.08) 45%, transparent 70%);
    animation: shell-blob-drift-a 22s ease-in-out infinite;
}

.shell-blob-b {
    width: min(65vmin, 480px);
    height: min(65vmin, 480px);
    bottom: -15%;
    right: -8%;
    background: radial-gradient(circle at 60% 60%, rgba(36, 51, 82, 0.45) 0%, rgba(78, 115, 223, 0.12) 50%, transparent 68%);
    animation: shell-blob-drift-b 28s ease-in-out infinite;
}

.shell-blob-c {
    width: min(50vmin, 380px);
    height: min(50vmin, 380px);
    top: 35%;
    left: 42%;
    background: radial-gradient(circle, rgba(78, 115, 223, 0.2) 0%, transparent 65%);
    animation: shell-blob-drift-c 18s ease-in-out infinite;
}

.shell-blob-d {
    width: min(40vmin, 320px);
    height: min(40vmin, 320px);
    top: 8%;
    right: 5%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 62%);
    animation: shell-blob-drift-d 26s ease-in-out infinite;
}

[dir="rtl"] .shell-blob-a { left: auto; right: -12%; }
[dir="rtl"] .shell-blob-b { right: auto; left: -8%; }
[dir="rtl"] .shell-blob-d { right: auto; left: 5%; }

.shell-shimmer {
    position: absolute;
    inset: -50%;
    background: linear-gradient(115deg, transparent 0%, transparent 38%, rgba(255, 255, 255, 0.045) 48%, rgba(78, 115, 223, 0.06) 52%, transparent 62%, transparent 100%);
    background-size: 280% 280%;
    animation: shell-shimmer-sweep 14s ease-in-out infinite;
    opacity: 0.9;
}

.shell-mesh {
    position: absolute;
    inset: 0;
    opacity: 0.055;
    background-image: radial-gradient(circle at center, rgba(78, 115, 223, 0.85) 1.2px, transparent 1.2px);
    background-size: 32px 32px;
    animation: shell-mesh-pan 80s linear infinite;
}

[dir="rtl"] .shell-mesh { animation-name: shell-mesh-pan-rtl; }

@keyframes shell-blob-drift-a { 0%,100% { transform: translate(0,0) scale(1);} 40% { transform: translate(6%,10%) scale(1.06);} 70% { transform: translate(-4%,4%) scale(0.96);} }
@keyframes shell-blob-drift-b { 0%,100% { transform: translate(0,0) scale(1);} 45% { transform: translate(-8%,-6%) scale(1.05);} 75% { transform: translate(5%,-3%) scale(0.98);} }
@keyframes shell-blob-drift-c { 0%,100% { transform: translate(0,0) scale(1);} 50% { transform: translate(-10%,-14%) scale(1.1);} }
@keyframes shell-blob-drift-d { 0%,100% { transform: translate(0,0) rotate(0deg);} 50% { transform: translate(-12%,8%) rotate(8deg);} }
@keyframes shell-shimmer-sweep { 0%,100% { background-position: 0% 40%; } 50% { background-position: 100% 60%; } }
@keyframes shell-mesh-pan { 0% { transform: translate(0,0);} 100% { transform: translate(32px,32px);} }
@keyframes shell-mesh-pan-rtl { 0% { transform: translate(0,0);} 100% { transform: translate(-32px,32px);} }

@media (prefers-reduced-motion: reduce) {
    .shell-blob, .shell-shimmer, .shell-mesh, .login-hero::before, .login-hero::after { animation: none !important; }
    .weather-sun, .weather-cloud-a, .weather-cloud-b, .weather-rain { animation: none !important; }
}

.login-hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(1.5rem, 4vw, 3rem);
    overflow: hidden;
    background: linear-gradient(145deg, var(--sidebar-deep) 0%, var(--sidebar-bg) 45%, #243352 100%);
    color: #fff;
}

.login-hero::before {
    content: "";
    position: absolute;
    inset: -40% -20% auto auto;
    width: min(90vw, 520px);
    height: min(90vw, 520px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(78, 115, 223, 0.35) 0%, transparent 65%);
    pointer-events: none;
    will-change: transform, opacity;
    animation: hero-glow-orb-a 19s ease-in-out infinite;
}

[dir="rtl"] .login-hero::before { inset: -40% auto auto -20%; }

.login-hero::after {
    content: "";
    position: absolute;
    inset: auto auto -30% -25%;
    width: min(70vw, 400px);
    height: min(70vw, 400px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
    pointer-events: none;
    will-change: transform, opacity;
    animation: hero-glow-orb-b 23s ease-in-out infinite;
}

[dir="rtl"] .login-hero::after { inset: auto -25% -30% auto; }

@keyframes hero-glow-orb-a { 0%,100% { transform: translate(0,0) scale(1); opacity:1;} 45% { transform: translate(-6%,8%) scale(1.1); opacity:0.88;} 70% { transform: translate(4%,-3%) scale(0.95); opacity:1;} }
@keyframes hero-glow-orb-b { 0%,100% { transform: translate(0,0) scale(1); opacity:1;} 50% { transform: translate(10%,-8%) scale(1.08); opacity:0.75;} 80% { transform: translate(-5%,5%) scale(0.92); opacity:1;} }

.hero-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: inherit; }
.hero-brand-icon { display: flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 12px; background: var(--accent); font-size: 1.25rem; box-shadow: 0 8px 24px rgba(78, 115, 223, 0.45); }
.hero-brand-text { font-weight: 700; font-size: 1.2rem; line-height: 1.25; }
.hero-brand-text small { display: block; margin-top: 0.15rem; font-size: 0.72rem; font-weight: 400; color: #8892a4; letter-spacing: 0.02em; }
.hero-body { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 2rem 0; max-width: 420px; }
.hero-title { margin: 0 0 0.75rem; font-size: clamp(1.75rem, 3.5vw, 2.25rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
:lang(ar) .hero-title { letter-spacing: 0; }
.hero-lead { margin: 0 0 2rem; color: #a8b0c0; font-size: 1rem; line-height: 1.6; }
.hero-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.hero-features li { display: flex; align-items: flex-start; gap: 0.85rem; font-size: 0.9rem; color: #c5cad6; line-height: 1.45; }
.hero-features i { flex-shrink: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: rgba(78, 115, 223, 0.2); color: #9eb7f5; font-size: 0.95rem; }
.hero-foot { position: relative; z-index: 1; font-size: 0.8rem; color: #6b7588; }

@media (max-width: 960px) {
    .login-hero { min-height: auto; padding-bottom: 2rem; }
    .hero-body { padding: 1.25rem 0 0; }
}

.login-panel {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: radial-gradient(ellipse 80% 50% at 100% 0%, rgba(78, 115, 223, 0.08), transparent), #f0f2f5;
}

[dir="rtl"] .login-panel {
    background: radial-gradient(ellipse 80% 50% at 0% 0%, rgba(78, 115, 223, 0.08), transparent), #f0f2f5;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: clamp(1.75rem, 4vw, 2.5rem);
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: card-in 0.55s var(--transition) both;
}

@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }

.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
:lang(ar) .login-card h1 { letter-spacing: 0; }
.login-card .subtitle { margin: 0 0 1.75rem; color: var(--text-muted); font-size: 0.9rem; }
.weather-widget {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: -0.4rem 0 1.25rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, #f7f9fd 0%, #eef3fb 100%);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.weather-widget.weather-loading { opacity: 0.8; }

.weather-scene {
    position: relative;
    width: 74px;
    height: 50px;
    flex-shrink: 0;
    overflow: hidden;
}

.weather-sun {
    position: absolute;
    top: 7px;
    left: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffe27a 0%, #ffbf3f 65%, #ff9f1c 100%);
    box-shadow: 0 0 0 0 rgba(255, 191, 63, 0.4);
    animation: sun-pulse 2.8s ease-in-out infinite;
}

.weather-cloud {
    position: absolute;
    border-radius: 999px;
    background: #d8e0ed;
    opacity: 0.96;
}

.weather-cloud::before,
.weather-cloud::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: #d8e0ed;
}

.weather-cloud-a {
    width: 32px;
    height: 12px;
    top: 14px;
    right: 10px;
    animation: cloud-drift-a 6.6s ease-in-out infinite;
}

.weather-cloud-a::before {
    width: 13px;
    height: 13px;
    top: -8px;
    left: 5px;
}

.weather-cloud-a::after {
    width: 14px;
    height: 14px;
    top: -9px;
    left: 15px;
}

.weather-cloud-b {
    width: 38px;
    height: 13px;
    bottom: 15px;
    left: 8px;
    animation: cloud-drift-b 7.5s ease-in-out infinite;
}

.weather-cloud-b::before {
    width: 14px;
    height: 14px;
    top: -8px;
    left: 8px;
}

.weather-cloud-b::after {
    width: 16px;
    height: 16px;
    top: -10px;
    left: 19px;
}

.weather-rain {
    position: absolute;
    width: 2px;
    height: 10px;
    border-radius: 1px;
    background: linear-gradient(180deg, rgba(105, 175, 255, 0.2) 0%, rgba(61, 142, 237, 0.95) 100%);
    opacity: 0;
}

.weather-rain-a { top: 30px; left: 35px; animation: rain-fall 1s linear infinite; }
.weather-rain-b { top: 28px; left: 46px; animation: rain-fall 1s linear infinite 0.24s; }
.weather-rain-c { top: 32px; left: 56px; animation: rain-fall 1s linear infinite 0.46s; }

.weather-info { min-width: 0; }

.weather-location {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 600;
    color: #52627e;
    line-height: 1.3;
}

.weather-status {
    margin: 0.12rem 0 0;
    font-size: 0.84rem;
    color: #31415f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.weather-widget.weather-sunny {
    background: linear-gradient(180deg, #fff6da 0%, #fff0bf 100%);
    border-color: #f1df9b;
    box-shadow: 0 6px 14px rgba(255, 191, 63, 0.2);
}

.weather-widget.weather-sunny .weather-cloud { opacity: 0.75; }

.weather-widget.weather-rainy {
    background: linear-gradient(180deg, #e8f3ff 0%, #dcecff 100%);
    border-color: #bfd9ff;
    box-shadow: 0 6px 14px rgba(80, 147, 223, 0.15);
}

.weather-widget.weather-rainy .weather-rain { opacity: 1; }

.weather-widget.weather-cloudy {
    background: linear-gradient(180deg, #f1f4f8 0%, #e6ebf2 100%);
    border-color: #d2dbe7;
    box-shadow: 0 6px 14px rgba(67, 87, 117, 0.12);
}

.weather-widget.weather-cloudy .weather-sun {
    transform: scale(0.82);
    opacity: 0.6;
}

@keyframes sun-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 191, 63, 0.4); transform: scale(1); }
    50% { box-shadow: 0 0 0 8px rgba(255, 191, 63, 0); transform: scale(1.06); }
}

@keyframes cloud-drift-a {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

@keyframes cloud-drift-b {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

@keyframes rain-fall {
    0% { transform: translateY(-3px); opacity: 0; }
    25% { opacity: 1; }
    100% { transform: translateY(10px); opacity: 0; }
}
.field { margin-bottom: 1.15rem; }
.field label { display: block; margin-bottom: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.input-wrap { position: relative; }
.input-wrap i.input-icon { position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }
[dir="rtl"] .input-wrap i.input-icon { left: auto; right: 0.95rem; }
.input-wrap input { width: 100%; padding: 0.72rem 0.95rem 0.72rem 2.65rem; font: inherit; font-size: 0.9rem; border: 1px solid var(--border); border-radius: 10px; background: #fafbfc; color: var(--text); transition: border-color var(--transition), box-shadow var(--transition), background var(--transition); }
[dir="rtl"] .input-wrap input { padding: 0.72rem 2.65rem 0.72rem 0.95rem; }
.input-wrap.password-toggle input { padding-right: 2.75rem; }
[dir="rtl"] .input-wrap.password-toggle input { padding-right: 0.95rem; padding-left: 2.75rem; }
.input-wrap input::placeholder { color: #adb5bd; }
.input-wrap input:hover { border-color: #ced4da; }
.input-wrap input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }

.toggle-visibility { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); width: 2.25rem; height: 2.25rem; border: none; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: color var(--transition), background var(--transition); }
[dir="rtl"] .toggle-visibility { right: auto; left: 0.35rem; }
.toggle-visibility:hover { color: var(--accent); background: var(--accent-soft); }

.row-inline { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.35rem; }
.remember { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.remember input { width: 1rem; height: 1rem; accent-color: var(--accent); cursor: pointer; }
.forgot { font-size: 0.85rem; font-weight: 500; color: var(--accent); text-decoration: none; transition: color var(--transition); }
.forgot:hover { color: var(--accent-hover); text-decoration: underline; }

.btn-signin {
    width: 100%;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(180deg, var(--accent) 0%, #4568d4 100%);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(78, 115, 223, 0.35);
    transition: transform 0.15s ease, box-shadow var(--transition), filter var(--transition);
}

.btn-signin:hover { filter: brightness(1.05); box-shadow: 0 10px 28px rgba(78, 115, 223, 0.42); }
.btn-signin:active { transform: translateY(1px); }

.login-divider { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 1.25rem; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
:lang(ar) .login-divider { letter-spacing: 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.back-home { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.back-home:hover { color: var(--accent); }
[dir="rtl"] .back-home i { transform: scaleX(-1); }

.demo-hint { margin-top: 1.25rem; padding: 0.75rem 1rem; font-size: 0.8rem; line-height: 1.45; color: var(--text-muted); background: #f8f9fa; border-radius: 10px; border: 1px dashed var(--border); }
.demo-hint strong { color: var(--text); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
