/**
 * واجهة تسجيل الدخول المتطورة
 * Advanced Login Interface
 * نظام تتبع الشحنات - Shipment Tracking System
 */

/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Amiri', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: auto; /* إظهار التمرير إذا تجاوز المحتوى الارتفاع */
    overflow-x: hidden; /* منع التمرير الأفقي */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* تحسينات للهواتف الذكية */
@media (max-width: 768px) {
    body {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* منع التكبير عند النقر المزدوج */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* تحسين أداء التمرير */
    .login-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* الحاوي الرئيسي */
.login-container {
    display: flex;
    height: auto;       /* السماح بالتمدد */
    min-height: 100vh;  /* على الأقل ملء الشاشة */
    width: 100%;
}

/* تحسينات للشاشات المتوسطة (1024px - 1280px) */
@media (max-width: 1280px) and (min-width: 1024px) {
    .login-form-section {
        padding-top: 2.5rem;
    }
    .login-logo {
        margin-bottom: 2rem;
        display: block;
    }
    .login-logo img {
        max-width: 170px;
        display: block;
        margin: 0 auto;
    }
}

/* تحسينات لشاشات اللابتوب الصغيرة والمتوسطة */
@media (max-width: 1366px) {
    body {
        overflow: auto;
    }
    .login-container {
        height: auto;
        min-height: 100vh;
    }
    .login-form-section {
        width: 50%;
        padding: 1.5rem;
        padding-top: 2rem;
        justify-content: flex-start;
    }
    .background-section {
        width: 50%;
    }
    .background-logo img {
        max-width: 280px;
        max-height: 280px;
    }
    .login-logo {
        margin-bottom: 1.5rem;
        padding: 0;
        width: 100%;
        display: block;
    }
    .login-logo img {
        max-width: 160px;
        width: auto;
        height: auto;
        display: block;
        margin: 0 auto;
    }
    .welcome-section { margin-bottom: 0.5rem; }
    .form-group { margin-bottom: 1rem; }
    .form-options { margin-bottom: 1rem; }
    .login-btn { padding: 0.9rem; }
    .signup-link { margin-top: 1rem; }
}

/* عندما يكون الارتفاع صغيراً (بعض اللابتوبات) */
@media (max-height: 750px) {
    body {
        overflow: auto;
    }
    .login-container {
        height: auto;
        min-height: 100vh;
    }
    .login-form-section {
        padding: 1rem;
        padding-top: 1.5rem;
        justify-content: flex-start;
    }
    .background-logo img {
        max-width: 260px;
        max-height: 260px;
    }
    .login-logo {
        margin-bottom: 1rem;
        padding: 0;
        width: 100%;
        display: block;
    }
    .login-logo img {
        max-width: 140px;
        width: auto;
        height: auto;
        display: block;
        margin: 0 auto;
    }
    .welcome-title { font-size: 1.5rem; }
    .welcome-subtitle { font-size: 0.95rem; }
    .form-group { margin-bottom: 0.9rem; }
    .form-label { margin-bottom: 0.35rem; }
    .form-input { padding: 0.8rem 1rem 0.8rem 3rem; }
    .form-options { margin-bottom: 0.9rem; }
    .login-btn { padding: 0.85rem; }
}

/* عندما يكون الارتفاع أصغر من 650px قم بتمرير القسم الأيمن أيضاً */
@media (max-height: 650px) {
    .background-section {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* القسم الأيسر - نموذج تسجيل الدخول */
.login-form-section {
    width: 40%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 2rem 3rem;
    padding-top: 2rem;
    overflow-y: auto;            /* تفعيل التمرير عند الحاجة */
    overflow-x: hidden;          /* منع التمرير الأفقي */
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

/* الشعار */
.login-logo {
    margin-bottom: 1rem;
    margin-top: 0;
    text-align: center;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
    overflow: hidden;
    display: block;
    flex-shrink: 0;
}

.login-logo img {
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: all 0.3s ease;
    margin-bottom: 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-logo img:hover {
    transform: scale(1.05);
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 1rem;
    letter-spacing: -1px;
}

.login-logo p {
    font-size: 1rem;
    color: #64748b;
    margin-top: 0.5rem;
}

/* رسالة الترحيب */
.welcome-section {
    text-align: center;
    margin-bottom: 1rem;
}

.welcome-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.5;
}

/* نموذج تسجيل الدخول */
.login-form {
    width: 100%;
    max-width: 400px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    position: relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* تحسينات للحقول على الهواتف */
@media (max-width: 768px) {
    .form-input {
        font-size: 16px; /* منع التكبير على iOS */
        border-radius: 12px;
    }
    
    .form-input:focus {
        transform: scale(1.02);
    }
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
}

/* أيقونات الحقول */
.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1rem;
    z-index: 5;
}

.input-wrapper {
    position: relative;
}

/* خيارات إضافية */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

.remember-me label {
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
}

.forgot-password {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #1d4ed8;
}

/* زر تسجيل الدخول */
.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Cairo', 'Amiri', serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

/* تحسينات للأزرار على الهواتف */
@media (max-width: 768px) {
    .login-btn {
        border-radius: 12px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .login-btn:active {
        transform: scale(0.98);
    }
}

.login-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

/* رابط التسجيل */
.signup-link {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #64748b;
}

.signup-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.signup-link a:hover {
    color: #1d4ed8;
}

/* خط فاصل */
.divider {
    width: 100%;
    height: 1px;
    background: #e2e8f0;
    margin: 0.3rem 0;
}

/* قسم تتبع الشحنات */
.tracking-section {
    text-align: center;
}

/* خط فاصل */
.tracking-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 1rem 0;
}

/* زر الرجوع */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #64748b;
    border: 2px solid #475569;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.back-btn:hover {
    background: #475569;
    border-color: #334155;
    transform: translateY(-1px);
    color: white;
}

/* القسم الأيمن - صورة الخلفية */
.background-section {
    width: 60%;
    background: url('../images/bg1.jpg') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.background-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/bg1.jpg') center/cover no-repeat;
    filter: blur(2px);
    z-index: 0;
}

/* طبقة تراكب */
.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.3) 0%, rgba(29, 78, 216, 0.3) 100%);
    z-index: 1;
}

/* طبقة داكنة إضافية */
.background-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* محتوى الخلفية */
.background-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    padding: 2rem;
}

.background-logo {
    margin-bottom: 2rem;
}

.background-logo img {
    max-width: 500px;
    width: auto;
    height: auto;
    filter: brightness(0) invert(1) contrast(1.3) drop-shadow(0 2px 8px rgba(255, 255, 255, 0.3));
    transition: all 0.3s ease;
    z-index: 10;
    position: relative;
}

.background-logo img:hover {
    transform: scale(1.05);
    filter: brightness(0) invert(1) contrast(1.5) drop-shadow(0 4px 15px rgba(255, 255, 255, 0.6));
}

.background-text {
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
}

.background-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* تأثيرات متقدمة */
.login-form-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, #e2e8f0, transparent);
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }
    
    .login-container {
        flex-direction: column;
        min-height: 100vh;
        height: auto;
    }
    
    .login-form-section {
        width: 100%;
        padding: 2rem 1rem;
        padding-top: 2rem;
        justify-content: flex-start;
        overflow-x: hidden;
    }
    
    .background-section {
        width: 100%;
        min-height: 30vh;
        height: auto;
    }
    
    .login-logo img {
        max-width: 150px;
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .welcome-subtitle {
        font-size: 0.9rem;
    }
    
    .background-text {
        font-size: 1.2rem;
    }
    
    .background-logo img {
        max-width: 200px;
    }
    
    .form-group {
        margin-bottom: 1.2rem;
    }
    
    .form-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .login-btn {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .login-form-section {
        padding: 1.5rem 0.75rem;
    }
    
    .background-section {
        min-height: 25vh;
    }
    
    .login-logo img {
        max-width: 120px;
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .welcome-title {
        font-size: 1.3rem;
    }
    
    .welcome-subtitle {
        font-size: 0.85rem;
    }
    
    .form-input {
        padding: 0.75rem 0.75rem 0.75rem 2.5rem;
        font-size: 0.95rem;
    }
    
    .input-icon {
        left: 0.75rem;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.85rem;
    }
    
    .login-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .background-logo img {
        max-width: 150px;
    }
    
    .background-subtitle {
        font-size: 0.9rem;
        padding: 0 1rem;
    }
    
    .signup-link {
        font-size: 0.85rem;
    }
    
    .back-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* تحسينات للهواتف الصغيرة جداً */
@media (max-width: 360px) {
    .login-form-section {
        padding: 1rem 0.5rem;
    }
    
    .background-section {
        min-height: 20vh;
    }
    
    .login-logo img {
        max-width: 100px;
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .welcome-title {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }
    
    .welcome-subtitle {
        font-size: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .form-input {
        padding: 0.7rem 0.7rem 0.7rem 2.2rem;
        font-size: 16px; /* منع التكبير */
        border-radius: 10px;
    }
    
    .input-icon {
        left: 0.7rem;
        font-size: 0.85rem;
    }
    
    .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .login-btn {
        padding: 0.75rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }
    
    .background-logo img {
        max-width: 120px;
        max-height: 120px;
    }
    
    .background-subtitle {
        font-size: 0.8rem;
        padding: 0 0.5rem;
    }
    
    .signup-link {
        font-size: 0.8rem;
        margin-top: 1.5rem;
    }
    
    .back-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }
    
    .form-options {
        margin-bottom: 1.5rem;
    }
    
    .remember-me label {
        font-size: 0.8rem;
    }
    
    .forgot-password {
        font-size: 0.8rem;
    }
}

/* تحسينات للشاشات الأفقية على الهواتف */
@media (max-width: 768px) and (orientation: landscape) {
    .login-container {
        flex-direction: row;
    }
    
    .login-form-section {
        width: 50%;
        padding: 1rem;
    }
    
    .background-section {
        width: 50%;
    }
    
    .login-logo img {
        max-width: 100px;
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .welcome-title {
        font-size: 1.2rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .background-logo img {
        max-width: 150px;
    }
}

/* تحسينات للطباعة */
@media print {
    .background-section {
        display: none;
    }
    
    .login-form-section {
        width: 100%;
        background: white;
    }
    
    .login-btn {
        background: #2563eb !important;
        font-family: 'Cairo', 'Amiri', serif;
    }
}
