@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;900&display=swap');

:root {
    --primary-blue: #0066cc;
    --dark-blue: #003d7a;
    --accent-cyan: #00BFFF; 
    --light-text: #003d7a; 
    --form-text: #333333; 
    --glass-bg: rgba(255, 255, 255, 0.65); 
    --glass-border: rgba(0, 0, 0, 0.1); 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    font-family: 'Tajawal', sans-serif;
    overflow-x: hidden; /* تغيير من overflow: hidden إلى overflow-x فقط */
    overflow-y: auto; /* السماح بالتمرير العمودي عند الحاجة */
}

/* إصلاح الفيديو الخلفي */
.video-background {
    position: fixed; /* مهم جداً: fixed وليس absolute */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* خلف كل شيء */
    overflow: hidden;
}

#bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.video-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1;
}

/* إصلاح container النموذج */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 10; /* رقم أعلى للتأكد من الظهور فوق الفيديو */
}

.login-form {
    width: 100%;
    max-width: 420px;
    padding: 40px 35px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-radius: 20px;
    box-shadow: 
        0 15px 45px rgba(0, 0, 0, 0.25),
        0 0 0 1px var(--glass-border) inset;
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 20; /* رقم أعلى */
    animation: slideInUp 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .logo-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--primary-blue) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: white;
    box-shadow: 
        0 10px 30px rgba(0, 191, 255, 0.3),
        0 0 0 5px rgba(255, 255, 255, 0.1);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

h2 {
    color: var(--primary-blue); 
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: var(--form-text); 
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--light-text);
    font-weight: 600;
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i.bi-person-fill, 
.input-wrapper i.bi-lock-fill {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-blue);
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 5;
    pointer-events: none; /* حتى لا تتداخل مع الإدخال */
}

.input-group input {
    width: 100%;
    padding: 14px 45px 14px 45px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    background: rgba(255, 255, 255, 0.9);
    color: var(--form-text);
    transition: all 0.3s ease;
}

.input-group input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.1);
}

.input-wrapper:focus-within i.bi-person-fill,
.input-wrapper:focus-within i.bi-lock-fill {
    color: var(--accent-cyan);
}

.password-toggle {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--primary-blue);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--accent-cyan);
}

.remember-me {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-left: 8px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.remember-me label {
    margin: 0;
    color: var(--form-text);
    font-size: 0.9rem;
    cursor: pointer;
}

.login-button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 102, 204, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.error-message, .success-message {
    color: white;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(5px);
    font-size: 0.95rem;
}

.error-message {
    background: rgba(220, 53, 69, 0.85);
    animation: shake 0.6s ease;
}

.success-message {
    background: rgba(40, 167, 69, 0.85);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-footer {
    margin-top: 25px;
    text-align: center;
    color: var(--form-text);
    font-size: 0.85rem;
}

.login-footer p {
    margin-bottom: 4px;
}

.login-footer a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* تحسينات للتوافقية مع الموبايل */
@media (max-width: 500px) {
    body, html {
        overflow-y: auto; /* السماح بالتمرير على الموبايل */
    }
    
    .login-container {
        padding: 15px;
        align-items: flex-start; /* محاذاة للأعلى على الموبايل */
        padding-top: 30px;
    }
    
    .login-form {
        max-width: 100%;
        padding: 30px 20px;
        margin: 0;
    }
    
    .login-logo .logo-circle {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .input-group input {
        padding: 12px 40px 12px 40px;
    }
}

/* إصلاح مشكلة الشاشات الصغيرة جداً */
@media (max-height: 700px) {
    .login-container {
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .login-form {
        padding: 25px 30px;
    }
    
    .login-logo {
        margin-bottom: 20px;
    }
    
    .login-logo .logo-circle {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }
}