/* الخط الأساسي Cairo مُعرّف في css/admin/cairo.css (مستضاف محليًا) */

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

/* دوران زاوية الإطار المتوهّج */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

:root {
    --bg:      #030d1c;
    --bg-2:    #020a16;
    --teal:    #46c1c1;
    --teal-2:  #8fe3e3;
    --deep:    #0b4265;
    --ink:     #e2f0f7;
    --muted:   #4a6788;
    --line:    #0e2240;
}

html, body { height: 100%; }

body {
    font-family: 'Cairo', sans-serif;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--bg);
    overflow: hidden;
    position: relative;
    padding: 1.5rem;
}

/* ═══════════════════════════════════════
   ANIMATED BACKGROUND
═══════════════════════════════════════ */
#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 55% at 22% 25%, rgba(70, 193, 193, .16) 0%, transparent 60%),
        radial-gradient(ellipse 55% 55% at 80% 75%, rgba(11, 66, 101, .28) 0%, transparent 60%),
        radial-gradient(ellipse 45% 45% at 65% 12%, rgba(20, 110, 110, .12) 0%, transparent 55%),
        radial-gradient(ellipse 40% 40% at 12% 85%, rgba(8, 40, 70, .25) 0%, transparent 55%);
    animation: meshDrift 18s ease-in-out infinite alternate;
}

@keyframes meshDrift {
    0%   { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(-2%, 1.5%); }
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(70, 193, 193, .05) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 30%, transparent 80%);
}

.bg-vignette {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 90% 90% at 50% 50%, transparent 55%, rgba(2, 7, 16, .85) 100%);
}

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}

.orb-a {
    width: 380px;
    height: 380px;
    background: rgba(70, 193, 193, .16);
    top: -120px;
    right: -80px;
    animation: orbFloat 9s ease-in-out infinite;
}

.orb-b {
    width: 300px;
    height: 300px;
    background: rgba(11, 66, 101, .30);
    bottom: -90px;
    left: -60px;
    animation: orbFloat 11s 1.5s ease-in-out infinite;
}

.orb-c {
    width: 220px;
    height: 220px;
    background: rgba(20, 110, 110, .16);
    top: 55%;
    left: 55%;
    animation: orbFloat 8s 1s ease-in-out infinite;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(18px, -22px) scale(1.06); }
    66%      { transform: translate(-14px, 14px) scale(.96); }
}

/* توهّج يتبع المؤشّر */
.bg-glow {
    position: fixed;
    z-index: 0;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(70, 193, 193, .10) 0%, rgba(11, 66, 101, .05) 45%, transparent 70%);
    opacity: 0;
    transition: opacity .4s ease;
    left: 50%;
    top: 50%;
}

/* ═══════════════════════════════════════
   LOGIN CARD
═══════════════════════════════════════ */
.auth-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 420px;
}

.auth-card {
    position: relative;
    width: 100%;
    padding: 2.6rem 2.5rem 2.4rem;
    border-radius: 26px;
    background: linear-gradient(165deg, rgba(14, 34, 64, .55), rgba(3, 13, 28, .65));
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    border: 1px solid rgba(70, 193, 193, .12);
    box-shadow:
        0 30px 80px -20px rgba(0, 0, 0, .7),
        0 0 0 1px rgba(255, 255, 255, .02) inset,
        0 1px 0 rgba(255, 255, 255, .05) inset;
    text-align: center;
    animation: cardIn 1s cubic-bezier(.16, 1, .3, 1) both;
}

/* إطار متوهّج دوّار حول البطاقة */
.auth-card::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: 27px;
    padding: 1.5px;
    background: conic-gradient(from var(--angle),
        transparent 0%,
        rgba(70, 193, 193, .55) 12%,
        transparent 32%,
        transparent 62%,
        rgba(11, 66, 101, .55) 82%,
        transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    animation: borderSpin 7s linear infinite;
    pointer-events: none;
}

@keyframes borderSpin {
    to { --angle: 360deg; }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(34px) scale(.97); filter: blur(6px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.auth-card > * {
    animation: riseIn .7s cubic-bezier(.16, 1, .3, 1) both;
}
.auth-card > .al-logo   { animation-delay: .12s; }
.auth-card > .al-badge  { animation-delay: .2s; }
.auth-card > .al-title  { animation-delay: .27s; }
.auth-card > .al-sub    { animation-delay: .33s; }
.auth-card > .al-error  { animation-delay: .36s; }
.auth-card > .al-form   { animation-delay: .4s; }

@keyframes riseIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.al-logo {
    width: 88px;
    height: 88px;
    margin: 0 auto 1.4rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(70, 193, 193, .28);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 8px rgba(70, 193, 193, .05),
        0 18px 40px -12px rgba(70, 193, 193, .35);
    animation: logoFloat 5s ease-in-out infinite;
}

.al-logo img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(70, 193, 193, .4));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.al-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(70, 193, 193, .08);
    border: 1px solid rgba(70, 193, 193, .22);
    color: var(--teal);
    font-size: .72rem;
    font-weight: 600;
    padding: .3rem .8rem;
    border-radius: 99px;
    letter-spacing: .04em;
    margin-bottom: 1rem;
}

.al-title {
    font-size: 1.85rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -.01em;
    line-height: 1.15;
    margin-bottom: .4rem;
}

.al-accent {
    background: linear-gradient(90deg, var(--teal), var(--teal-2), #2e9999);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3.5s linear infinite;
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

.al-sub {
    font-size: .84rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

.al-error {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: start;
    background: rgba(239, 68, 68, .09);
    border: 1px solid rgba(239, 68, 68, .2);
    border-radius: 12px;
    padding: .65rem .9rem;
    color: #fca5a5;
    font-size: .8rem;
    margin-bottom: 1.3rem;
}
.al-error i { color: #f87171; flex-shrink: 0; }

/* Form */
.al-form { text-align: start; }

.al-field { margin-bottom: 1.1rem; }

.al-label {
    display: block;
    font-size: .74rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .5rem;
    letter-spacing: .04em;
}

.al-input-wrap { position: relative; }

.al-input {
    width: 100%;
    background: rgba(7, 21, 38, .7);
    border: 1.5px solid var(--line);
    border-radius: 13px;
    color: var(--ink);
    font-family: inherit;
    font-size: .9rem;
    padding: .82rem 2.9rem .82rem 1rem;
    outline: none;
    transition: border-color .22s, box-shadow .22s, background .22s;
}

.al-input:focus {
    border-color: var(--teal);
    background: rgba(9, 26, 46, .9);
    box-shadow: 0 0 0 4px rgba(70, 193, 193, .12);
}

.al-input::placeholder { color: #1c3350; }

/* منع خلفية المتصفّح البيضاء عند الملء التلقائي (autofill) — يبقى الحقل داكناً كبقية الحقول */
.al-input:-webkit-autofill,
.al-input:-webkit-autofill:hover,
.al-input:-webkit-autofill:focus,
.al-input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px rgba(7, 21, 38, .7) inset;
    box-shadow: 0 0 0 1000px rgba(7, 21, 38, .7) inset;
    border: 1.5px solid var(--line);
    transition: background-color 99999s ease-in-out 0s, border-color .22s, box-shadow .22s;
}

.al-input:-webkit-autofill:focus {
    border-color: var(--teal);
    -webkit-box-shadow: 0 0 0 1000px rgba(9, 26, 46, .9) inset, 0 0 0 4px rgba(70, 193, 193, .12);
    box-shadow: 0 0 0 1000px rgba(9, 26, 46, .9) inset, 0 0 0 4px rgba(70, 193, 193, .12);
}

.al-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    font-size: .82rem;
    color: #234a72;
    pointer-events: none;
    transition: color .22s;
}

.al-input-wrap:focus-within .al-icon { color: var(--teal); }

.al-pw-btn {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #234a72;
    cursor: pointer;
    font-size: .82rem;
    padding: 4px 6px;
    line-height: 1;
    transition: color .22s;
}
.al-pw-btn:hover { color: var(--teal); }

.al-row {
    display: flex;
    align-items: center;
    margin: .3rem 0 1.6rem;
}

.al-check {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--muted);
    user-select: none;
}

.al-check input[type="checkbox"] {
    accent-color: var(--teal);
    width: 15px;
    height: 15px;
}

.al-submit {
    width: 100%;
    padding: .88rem;
    border: none;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--teal) 0%, #2e9999 55%, var(--deep) 100%);
    background-size: 200% auto;
    color: #021018;
    font-family: inherit;
    font-size: .96rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 28px -6px rgba(70, 193, 193, .5);
    transition: transform .2s, box-shadow .2s, background-position .45s;
}

.al-submit i { transition: transform .25s; }

.al-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 60%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: skewX(-20deg);
    transition: left .6s ease;
}

.al-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px -8px rgba(70, 193, 193, .6);
    background-position: right center;
}
.al-submit:hover::before { left: 130%; }
.al-submit:hover i { transform: translateX(-4px); }
.al-submit:active { transform: translateY(0); }

.al-copyright {
    font-size: .74rem;
    color: #1c3350;
    animation: riseIn .7s .5s cubic-bezier(.16, 1, .3, 1) both;
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 480px) {
    .auth-card { padding: 2.2rem 1.6rem 2rem; }
    .al-title  { font-size: 1.6rem; }
    .orb { filter: blur(70px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; }
}
