/*
    UniWeb · بوابة دخول الإدارة («البوابة»)
    الفكرة: جدار من الآجر المزجّج بلون اللازورد (بوابة عشتار، بابل) تُفتح فيه قنطرة كبيرة
    نرى من خلالها الحرم الجامعي، يحيط بها شريط من الورود الذهبية، وشعار الجامعة حجر العقد في أعلاها.
    النموذج يجلس على الجدار نفسه بجانب القنطرة.
*/
:root{
    --lapis:#0e2d61;
    --lapis-deep:#091d42;
    --lapis-glaze:#1d4f99;
    --gold:#e4b450;
    --gold-deep:#b9862a;
    --ivory:#f3eee2;
    --ivory-dim:rgba(243,238,226,.72);
    --line:rgba(243,238,226,.16);
    --danger:#ff8a8a;
    --font-body:"IBM Plex Sans Arabic",system-ui,sans-serif;
    --font-display:"Reem Kufi","IBM Plex Sans Arabic",sans-serif;
    --arch-w:min(46vw,620px);
}

*,*::before,*::after{box-sizing:border-box}
html,body{height:100%;margin:0}
body.gate-body{
    font-family:var(--font-body);
    color:var(--ivory);
    background-color:var(--lapis);
    /* الآجر المزجّج: صفوف متناوبة بخطوط ملاط خفيفة جداً */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='44'%3E%3Cpath d='M0 .5H88M0 22.5H88M.5 0V22M44.5 22V44' stroke='%23000' stroke-opacity='.2' fill='none'/%3E%3Cpath d='M0 1.5H88M0 23.5H88' stroke='%23fff' stroke-opacity='.045' fill='none'/%3E%3C/svg%3E"),
        radial-gradient(120% 90% at 85% 10%,var(--lapis-glaze) 0%,transparent 60%),
        radial-gradient(90% 80% at 0% 100%,var(--lapis-deep) 0%,transparent 70%);
    background-size:88px 44px,100% 100%,100% 100%;
    background-attachment:fixed;
    -webkit-font-smoothing:antialiased;
}
.gate{
    min-height:100vh;
    display:grid;
    grid-template-columns:var(--arch-w) minmax(0,460px);
    justify-content:center;
    align-items:center;
    gap:clamp(40px,7vw,120px);
    padding:clamp(56px,8vh,90px) clamp(20px,5vw,72px) 0;
}

/* ───────── القنطرة ───────── */
.gate-arch{
    position:relative;
    margin:0;
    width:var(--arch-w);
    height:min(calc(100vh - clamp(56px,8vh,90px)),820px);
    min-height:520px;
    align-self:end;
}
/* عتبة البوابة: القنطرة واقفة على الأرض */
.gate-arch::after{
    content:"";
    position:absolute;
    inset-inline:-34px;
    bottom:0;
    height:12px;
    border-radius:6px 6px 0 0;
    background:linear-gradient(180deg,var(--gold) 0 3px,var(--gold-deep) 3px 100%);
    box-shadow:0 -10px 30px -12px color-mix(in srgb,var(--gold) 55%,transparent);
    z-index:3;
}
.gate-panel{align-self:center;padding-bottom:clamp(28px,6vh,64px)}
.gate-arch-band,
.gate-arch-window{
    position:absolute;
    border-radius:999px 999px 0 0 / 46% 46% 0 0;
}
/* شريط الورود الذهبية حول القنطرة */
.gate-arch-band{
    inset:0;
    background:
        radial-gradient(circle,var(--gold) 0 2.6px,transparent 3.4px) 0 0/22px 22px,
        radial-gradient(circle,color-mix(in srgb,var(--gold) 35%,transparent) 0 1.2px,transparent 1.8px) 11px 11px/22px 22px,
        var(--lapis-deep);
    box-shadow:
        inset 0 0 0 2px var(--gold),
        0 40px 80px -30px rgba(0,0,0,.6);
}
.gate-arch-window{
    inset:22px 22px 0;
    overflow:hidden;
    box-shadow:0 0 0 2px var(--gold);
    background:var(--lapis-deep);
}
.gate-arch-photo{
    position:absolute;inset:0;
    background:var(--gate-photo) center 60%/cover no-repeat;
    transform-origin:50% 80%;
}
.gate-arch-shade{
    position:absolute;inset:0;
    background:linear-gradient(180deg,color-mix(in srgb,var(--lapis-deep) 0%,transparent) 45%,color-mix(in srgb,var(--lapis-deep) 55%,transparent) 72%,color-mix(in srgb,var(--lapis-deep) 92%,transparent) 100%);
}
/* حجر العقد: شعار الجامعة */
.gate-keystone{
    position:absolute;
    top:-34px;left:50%;
    width:104px;height:104px;
    margin-left:-52px;
    display:grid;place-items:center;
    border-radius:50%;
    background:#fff;
    box-shadow:0 0 0 5px var(--lapis),0 0 0 7px var(--gold),0 18px 34px -10px rgba(0,0,0,.55);
    z-index:2;
}
.gate-keystone img{width:78%;height:78%;object-fit:contain}
.gate-keystone i{font-size:2.4rem;color:var(--lapis)}

.gate-arch-caption{
    position:absolute;
    inset-inline:44px;
    bottom:34px;
    z-index:1;
    display:grid;gap:6px;
}
.gate-uni{
    font-family:var(--font-display);
    font-weight:700;
    font-size:clamp(2.4rem,4.6vw,4.4rem);
    line-height:1.05;
    color:var(--ivory);
    text-wrap:balance;
}
.gate-place{
    font-size:.98rem;
    color:var(--gold);
    font-weight:600;
}

/* ───────── لوحة الدخول ───────── */
.gate-panel{position:relative}
.gate-panel-inner{max-width:420px}
.gate-title{
    margin:0 0 10px;
    font-family:var(--font-display);
    font-weight:700;
    font-size:clamp(2rem,3vw,2.7rem);
    line-height:1.15;
    color:var(--ivory);
}
.gate-lede{
    margin:0 0 30px;
    color:var(--ivory-dim);
    font-size:1rem;
    line-height:1.8;
}

.gate-alert{
    margin:0 0 20px;
    padding:12px 16px;
    border-radius:12px;
    background:rgba(255,138,138,.12);
    border:1px solid rgba(255,138,138,.45);
    color:#ffd6d6;
    font-size:.92rem;
    line-height:1.7;
}
.gate-alert ul{margin:0;padding-inline-start:18px}
.gate-alert.validation-summary-valid{display:none}

.gate-form{display:grid;grid-template-columns:minmax(0,1fr);gap:20px}
.gate-field{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;min-width:0}
.gate-field > label{font-size:.9rem;font-weight:600;color:var(--ivory)}

.gate-control{
    position:relative;
    display:flex;align-items:center;
    height:56px;
    border-radius:14px;
    background:var(--lapis-deep);
    border:1px solid var(--line);
    transition:border-color .18s ease, box-shadow .18s ease;
}
.gate-control:focus-within{
    border-color:var(--gold);
    box-shadow:0 0 0 4px color-mix(in srgb,var(--gold) 22%,transparent);
}
.gate-control > i{
    flex:0 0 52px;
    text-align:center;
    font-size:1.1rem;
    color:var(--gold);
}
.gate-control input{
    flex:1;min-width:0;height:100%;
    border:0;outline:0;background:transparent;
    color:var(--ivory);
    font:500 1rem/1 var(--font-body);
    padding-inline-end:16px;
    text-align:start;
}
[dir=rtl] .gate-control input{text-align:right}
.gate-control input::placeholder{color:rgba(243,238,226,.38)}
.gate-control input:-webkit-autofill{
    -webkit-text-fill-color:var(--ivory);
    -webkit-box-shadow:0 0 0 100px var(--lapis-deep) inset;
    caret-color:var(--ivory);
}
.gate-reveal{
    flex:0 0 auto;
    width:40px;height:40px;
    margin-inline-end:8px;
    display:grid;place-items:center;
    border:0;border-radius:10px;
    background:rgba(243,238,226,.08);
    color:var(--ivory);
    cursor:pointer;
}
.gate-reveal:hover{background:rgba(243,238,226,.16)}
.gate-reveal:focus-visible,
.gate-submit:focus-visible,
.gate-back:focus-visible,
.gate-remember input:focus-visible + .gate-remember-box{outline:3px solid var(--gold);outline-offset:2px}

.gate-error{font-size:.85rem;color:var(--danger)}
.gate-error:empty{display:none}
.gate-control:has(input.input-validation-error){border-color:var(--danger)}
.gate-caps{margin:0;font-size:.82rem;color:var(--gold)}

.gate-remember{
    display:inline-flex;align-items:center;gap:10px;
    font-size:.92rem;color:var(--ivory-dim);
    cursor:pointer;user-select:none;
    width:fit-content;
}
.gate-remember input{position:absolute;opacity:0;width:1px;height:1px}
.gate-remember-box{
    width:22px;height:22px;flex:0 0 22px;
    display:grid;place-items:center;
    border-radius:7px;
    border:1.5px solid rgba(243,238,226,.4);
    color:transparent;
    transition:background .15s ease,border-color .15s ease;
}
.gate-remember input:checked + .gate-remember-box{background:var(--gold);border-color:var(--gold);color:var(--lapis-deep)}

.gate-submit{
    position:relative;
    height:58px;
    margin-top:4px;
    border:0;border-radius:14px;
    background:var(--gold);
    color:var(--lapis-deep);
    font:700 1.08rem/1 var(--font-body);
    cursor:pointer;
    box-shadow:0 1px 0 rgba(255,255,255,.45) inset,0 -3px 0 var(--gold-deep) inset,0 16px 30px -16px color-mix(in srgb,var(--gold) 80%,transparent);
    transition:transform .12s ease,filter .15s ease;
}
.gate-submit:hover{filter:brightness(1.06)}
.gate-submit:active{transform:translateY(1px)}
.gate-submit-busy{display:none}
.gate-submit.is-busy{cursor:progress;filter:saturate(.7)}
.gate-submit.is-busy .gate-submit-text{display:none}
.gate-submit.is-busy .gate-submit-busy{display:inline}

.gate-back{
    display:inline-flex;align-items:center;gap:8px;
    margin-top:26px;
    color:var(--ivory-dim);
    text-decoration:none;
    font-size:.92rem;
    border-radius:8px;
}
.gate-back:hover{color:var(--gold)}

/* ───────── الحركة الوحيدة: انفتاح القنطرة عند التحميل ───────── */
@media (prefers-reduced-motion:no-preference){
    .gate-arch-window{animation:gateOpen 1.15s cubic-bezier(.2,.75,.15,1) both}
    .gate-arch-photo{animation:gatePhoto 2.4s cubic-bezier(.2,.7,.2,1) both}
    .gate-keystone{animation:gateKey .7s .75s cubic-bezier(.3,1.4,.5,1) both}
    .gate-arch-caption{animation:gateRise .7s .9s ease both}
    .gate-panel-inner{animation:gateRise .7s .35s ease both}
}
@keyframes gateOpen{from{clip-path:inset(100% 0 0 0)}to{clip-path:inset(0 0 0 0)}}
@keyframes gatePhoto{from{transform:scale(1.18)}to{transform:scale(1)}}
@keyframes gateKey{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes gateRise{from{transform:translateY(14px);opacity:0}to{transform:none;opacity:1}}

/* ───────── تابلت وموبايل: القنطرة شريط علوي والنموذج تحتها ───────── */
@media (max-width:991.98px){
    .gate{
        grid-template-columns:minmax(0,520px);
        align-content:center;
        gap:28px;
        padding-top:44px;
    }
    .gate-panel{padding-bottom:40px}
    .gate-arch::after{inset-inline:-12px;height:9px}
    .gate-arch{
        width:100%;
        height:clamp(240px,42vh,360px);
        min-height:0;
        align-self:auto;
    }
    .gate-arch-band{border-radius:999px 999px 0 0 / 60% 60% 0 0}
    .gate-arch-window{inset:16px 16px 0;border-radius:999px 999px 0 0 / 60% 60% 0 0}
    .gate-keystone{width:84px;height:84px;margin-left:-42px;top:-30px}
    .gate-arch-caption{inset-inline:30px;bottom:20px}
    .gate-uni{font-size:clamp(1.9rem,8vw,2.6rem)}
    .gate-panel-inner{max-width:none}
}
@media (max-width:420px){
    .gate{padding-inline:16px}
    .gate-arch-band{background-size:18px 18px,18px 18px,auto}
}

/* ───────── بوابات أخرى بنفس الفكرة وتزجيج مختلف ───────── */
/* الخريجون: آجر فيروزي مزجّج + ذهب */
.gate--alumni{
    --lapis:#0b4f5c; --lapis-deep:#063740; --lapis-glaze:#14808f;
}
/* التدريسيون: آجر لازوردي + فيروزي بدل الذهب */
.gate--faculty{
    --gold:#46c6cd; --gold-deep:#1f8f97;
}
.gate--faculty .gate-submit{color:#062c33}

.gate-alert.is-success{background:rgba(70,198,205,.14);border-color:rgba(70,198,205,.5);color:#d8f6f7}
.gate-secondary{
    display:flex;align-items:center;justify-content:center;gap:8px;
    margin-top:14px;height:52px;border-radius:14px;
    border:1px solid var(--line);color:var(--ivory);text-decoration:none;font-weight:600;font-size:.95rem;
    transition:border-color .15s ease,background .15s ease;
}
.gate-secondary:hover{border-color:var(--gold);background:rgba(243,238,226,.05);color:var(--ivory)}
.gate-secondary i{color:var(--gold)}
.gate-secondary:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.gate-note{display:flex;gap:8px;margin:18px 0 0;font-size:.88rem;line-height:1.7;color:var(--ivory-dim)}
.gate-note i{color:var(--gold);margin-top:3px}
