﻿@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ========= ضبط عام ليكون المحتوى فيت بدون سكرول ========= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

html, body {
    height: 100%;
}

body {
    font-family: 'Tajawal', sans-serif;
    min-height: 100dvh; /* بدل 100vh */
    position: relative;
    overflow: hidden; /* منع السكرول في الصفحة */
    background: linear-gradient(135deg,#f8fafc 0%,#dbeafe 50%,#e0e7ff 100%);
}

/* خلفيات متحركة */
.bg-elements {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0
}

.bg-circle-1 {
    position: absolute;
    top: -10rem;
    right: -10rem;
    width: 20rem;
    height: 20rem;
    background: linear-gradient(135deg,rgba(59,130,246,.3),rgba(99,102,241,.3));
    border-radius: 50%;
    filter: blur(3rem);
    animation: pulse-slow 4s ease-in-out infinite
}

.bg-circle-2 {
    position: absolute;
    bottom: -10rem;
    left: -10rem;
    width: 24rem;
    height: 24rem;
    background: linear-gradient(135deg,rgba(20,184,166,.3),rgba(59,130,246,.3));
    border-radius: 50%;
    filter: blur(3rem);
    animation: pulse-slow 4s ease-in-out infinite 1s
}

.bg-circle-3 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 16rem;
    height: 16rem;
    background: linear-gradient(45deg,rgba(168,85,247,.2),rgba(236,72,153,.2));
    border-radius: 50%;
    filter: blur(2rem);
    animation: ping 3s cubic-bezier(0,0,.2,1) infinite
}

/* أيقونات عائمة */
.floating-icons {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1
}

.floating-icon {
    position: absolute;
    animation: float 6s ease-in-out infinite
}

    .floating-icon:nth-child(1) {
        top: 5rem;
        right: 5rem;
        color: rgba(59,130,246,.3);
        font-size: 3rem;
        animation-delay: .3s
    }

    .floating-icon:nth-child(2) {
        top: 10rem;
        left: 5rem;
        color: rgba(20,184,166,.3);
        font-size: 2.5rem;
        animation-delay: .7s
    }

    .floating-icon:nth-child(3) {
        bottom: 8rem;
        right: 8rem;
        color: rgba(99,102,241,.3);
        font-size: 2.8rem;
        animation-delay: 1s
    }

    .floating-icon:nth-child(4) {
        bottom: 5rem;
        left: 10rem;
        color: rgba(168,85,247,.3);
        font-size: 2rem;
        animation-delay: .5s
    }

/* الحاوية الرئيسية */
.main-container {
    position: relative;
    z-index: 10;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(.5rem, 1.5vw, 1rem);
}

/* الكارد: أقصى ارتفاع = ارتفاع الشاشة ناقص هوامش بسيطة */
.login-card {
    width: 100%;
    max-width: 70rem; /* كان 75rem */
    margin: 0 auto;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.1);
    overflow: hidden; /* لا نظهر سكرول داخل الكارد */
    animation: slideUp 1s ease-out;
    max-height: calc(100dvh - clamp(1rem, 3vh, 2rem));
}

/* شبكة العمودين تأخذ كل ارتفاع الكارد بدون حد أدنى كبير */
.login-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    min-height: clamp(34rem, 74vh, 42rem); /* بدل 45rem الثابت */
}

/* القسم الأيسر - الهوية */
.branding-section {
    position: relative;
    background: linear-gradient(135deg,#2563eb 0%,#3b82f6 30%,#4f46e5 70%,#6366f1 100%);
    padding: clamp(1.5rem, 2vw + 1rem, 2.5rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    overflow: hidden;
}

.branding-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: .1;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.6'%3E%3Ccircle cx='40' cy='40' r='1.5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
    animation: pulse-slow 3s ease-in-out infinite
}

.branding-content {
    position: relative;
    z-index: 2;
    animation: slideInRight 1s ease-out
}

.archive-logo {
    position: relative;
    margin-bottom: clamp(1.2rem, 2vh, 2rem)
}

.logo-circle {
    width: clamp(6rem, 9vw, 9rem);
    height: clamp(6rem, 9vw, 9rem);
    margin: 0 auto clamp(1rem, 1.5vh, 1.5rem);
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,.3);
    backdrop-filter: blur(15px);
    font-size: clamp(2.2rem, 3.5vw, 3.5rem);
    animation: zoomIn 1s ease-out .3s both;
    box-shadow: 0 20px 40px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.3)
}

    .logo-circle i {
        animation: pulse-slow 2s ease-in-out infinite;
        filter: drop-shadow(0 2px 4px rgba(0,0,0,.3))
    }

.check-badge {
    position: absolute;
    top: -.5rem;
    right: 1rem;
    width: 2.2rem;
    height: 2.2rem;
    background: linear-gradient(135deg,#10b981,#059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .95rem;
    animation: bounce 2s infinite 1s;
    box-shadow: 0 4px 12px rgba(16,185,129,.4)
}

.branding-title {
    font-size: clamp(2rem, 2.6vw + .5rem, 3.2rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: clamp(.6rem, 1vh, 1.2rem);
    animation: slideInBottom 1s ease-out .5s both;
    text-shadow: 0 2px 10px rgba(0,0,0,.2)
}

.branding-subtitle {
    color: #bfdbfe;
    font-weight: 500
}

.branding-quote {
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    color: #dbeafe;
    max-width: 22rem;
    margin: 0 auto clamp(1rem, 1.5vh, 1.5rem);
    line-height: 1.6;
    font-weight: 400;
    animation: slideInBottom 1s ease-out .7s both
}

.feature-icons {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 1.5vw, 2rem);
    margin-top: clamp(.8rem, 1.5vh, 1.5rem);
    animation: slideInBottom 1s ease-out .9s both
}

.feature-icon {
    width: 3.2rem;
    height: 3.2rem;
    background: rgba(255,255,255,.1);
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: all .3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.2)
}

    .feature-icon:hover {
        transform: translateY(-3px) scale(1.05);
        background: rgba(255,255,255,.2);
        box-shadow: 0 10px 20px rgba(0,0,0,.2)
    }

/* القسم الأيمن - النموذج */
.form-section {
    padding: clamp(1.25rem, 2vw + .75rem, 2.25rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255,255,255,.85);
}

.form-container {
    max-width: 28rem;
    margin: 0 auto;
    width: 100%
}

.form-header {
    text-align: center;
    margin-bottom: clamp(1.2rem, 2vh, 2rem);
    animation: slideInLeft 1s ease-out
}

.form-title {
    font-size: clamp(1.6rem, 2.2vw, 2.4rem);
    font-weight: 700;
    color: #1f2937;
    margin-bottom: .6rem;
    background: linear-gradient(135deg,#1f2937,#3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent
}

.form-subtitle {
    color: #6b7280;
    font-size: .98rem;
    font-weight: 400
}

.login-form {
    animation: slideInLeft 1s ease-out .2s both
}

.form-group {
    margin-bottom: clamp(1rem, 2vh, 1.6rem);
    position: relative
}

.form-label {
    display: block;
    color: #374151;
    font-weight: 600;
    margin-bottom: .6rem;
    font-size: .92rem
}

.input-container {
    position: relative
}

.form-input {
    width: 100%;
    height: clamp(2.8rem, 5.5vh, 3.2rem);
    padding: 0 3.2rem 0 1rem;
    border: 2px solid #e5e7eb;
    border-radius: .875rem;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(249,250,251,.85);
    color: #1f2937;
    transition: all .3s ease;
    backdrop-filter: blur(10px)
}

    .form-input:focus {
        outline: none;
        border-color: #3b82f6;
        background: rgba(255,255,255,.95);
        box-shadow: 0 0 0 3px rgba(59,130,246,.1), 0 4px 12px rgba(59,130,246,.15);
        transform: translateY(-1px)
    }

    .form-input:hover {
        border-color: #d1d5db;
        background: rgba(255,255,255,.9)
    }

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.1rem;
    z-index: 5;
    transition: all .3s ease
}

.form-input:focus + .input-icon {
    color: #3b82f6;
    transform: translateY(-50%) scale(1.1)
}

.password-toggle {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: all .3s ease;
    font-size: 1rem;
    padding: .45rem;
    border-radius: .5rem
}

    .password-toggle:hover {
        color: #6b7280;
        background: rgba(107,114,128,.1)
    }

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: clamp(1rem, 2vh, 1.6rem);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: .6rem
}

.form-checkbox {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #3b82f6;
    cursor: pointer
}

.checkbox-label {
    color: #374151;
    cursor: pointer;
    font-size: .92rem;
    font-weight: 500
}

.forgot-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: .92rem;
    font-weight: 600;
    transition: all .3s ease;
    padding: .2rem .45rem;
    border-radius: .5rem
}

    .forgot-link:hover {
        color: #1d4ed8;
        background: rgba(59,130,246,.1)
    }

.login-button {
    width: 100%;
    height: clamp(2.9rem, 6vh, 3.4rem);
    background: linear-gradient(135deg,#3b82f6 0%,#4f46e5 50%,#6366f1 100%);
    color: #fff;
    border: none;
    border-radius: .875rem;
    font-size: 1.08rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    transition: all .3s ease;
    margin-bottom: clamp(.9rem, 1.6vh, 1.6rem);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(59,130,246,.3)
}

    .login-button::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg,transparent,rgba(255,255,255,.3),transparent);
        transition: left .5s ease
    }

    .login-button:hover {
        background: linear-gradient(135deg,#1d4ed8 0%,#3730a3 50%,#4338ca 100%);
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(59,130,246,.4)
    }

        .login-button:hover::before {
            left: 100%
        }

    .login-button:active {
        transform: translateY(0)
    }

    .login-button i {
        font-size: 1.06rem
    }

.register-link {
    text-align: center;
    color: #6b7280;
    font-size: .93rem;
    margin-bottom: clamp(.8rem, 1.2vh, 1.2rem)
}

    .register-link a {
        color: #3b82f6;
        text-decoration: none;
        font-weight: 600;
        transition: color .3s ease
    }

        .register-link a:hover {
            color: #1d4ed8
        }

/* تذييل النظام */
.system-footer {
    border-top: 1px solid rgba(209,213,219,.5);
    padding: clamp(.9rem, 1.2vh, 1.2rem) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.footer-info {
    text-align: right;
    font-size: .85rem;
    color: #6b7280
}

.footer-version {
    font-size: .74rem;
    color: #9ca3af
}

.footer-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all .3s ease;
    padding: .45rem;
    border-radius: .5rem
}

    .footer-link:hover {
        color: #3b82f6;
        background: rgba(59,130,246,.1);
        transform: scale(1.05)
    }

/* الرسائل التوضيحية */
.status-message {
    text-align: center;
    margin: .8rem 0;
    padding: .8rem 1.1rem;
    border-radius: .7rem;
    font-size: .93rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all .3s ease
}

    .status-message.show {
        opacity: 1;
        transform: translateY(0)
    }

    .status-message.success {
        background: rgba(16,185,129,.15);
        color: #059669;
        border: 1px solid rgba(16,185,129,.3)
    }

    .status-message.error {
        background: rgba(239,68,68,.15);
        color: #dc2626;
        border: 1px solid rgba(239,68,68,.3)
    }

/* الرسوم المتحركة */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(2rem)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(2rem)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-2rem)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(1rem)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(.5)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

@keyframes float {
    0%,100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-20px)
    }
}

@keyframes pulse-slow {
    0%,100% {
        opacity: .5;
        transform: scale(1)
    }

    50% {
        opacity: .8;
        transform: scale(1.02)
    }
}

@keyframes ping {
    75%,100% {
        transform: translate(-50%,-50%) scale(2);
        opacity: 0
    }
}

@keyframes bounce {
    0%,20%,53%,80%,100% {
        transform: translate3d(0,0,0)
    }

    40%,43% {
        transform: translate3d(0,-30px,0)
    }

    70% {
        transform: translate3d(0,-15px,0)
    }

    90% {
        transform: translate3d(0,-4px,0)
    }
}

/* إيموشنات عائمة */
.emoji-float {
    position: fixed;
    font-size: 2rem;
    pointer-events: none;
    z-index: 100;
    animation: emojiFloat 3s ease-out forwards
}

@keyframes emojiFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(.5) rotate(0deg)
    }

    50% {
        opacity: .8;
        transform: translateY(-80px) scale(1) rotate(180deg)
    }

    100% {
        opacity: 0;
        transform: translateY(-160px) scale(.5) rotate(360deg)
    }
}

/* ========= تحسينات حسب الارتفاع (لابتوبات 14" ~ 768px) ========= */
@media (max-height: 820px) {
    .branding-quote {
        display: none;
    }
    /* تقليل الطول */
    .feature-icons {
        margin-top: .6rem;
    }

    .form-header {
        margin-bottom: 1rem;
    }
}

/* متجاوب */
@media (max-width:1024px) {
    .login-grid {
        grid-template-columns: 1fr
    }
    /* إخفاء العمود الأيسر في الموبايل/التابلت */
    .branding-section {
        display: none
    }
}

@media (max-width:768px) {
    .main-container {
        padding: .5rem
    }

    .form-section {
        padding: 1.5rem 1.25rem
    }

    .form-title {
        font-size: 1.8rem
    }

    .floating-icon {
        display: none
    }

    .login-card {
        border-radius: 1rem;
        max-height: calc(100dvh - 1rem)
    }
}

@media (max-width:480px) {
    .form-section {
        padding: 1.25rem 1rem
    }

    .form-title {
        font-size: 1.6rem
    }
}
