﻿/* ==========================================================================
   Ofooqx (أُفق) - Modern Responsive Auth Stylesheet
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #0f172a;
}

/* الحاوية الرئيسية (افتراضياً لـ Login تتوسط الشاشة) */
.auth-page-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 5%;
    direction: rtl;
    background: linear-gradient(135deg, rgba(0, 104, 55, 0.88), rgba(15, 23, 42, 0.94)), url('https://images.unsplash.com/photo-1556742049-0a67d577c4d3?q=80&w=1920&auto=format&fit=crop') center/cover no-repeat fixed;
}

    /* تخصيص حاوية صفحة التسجيل لتبدأ من الأعلى وتأخذ مساحة أوسع */
    .auth-page-container.register-container {
        align-items: flex-start !important;
        padding-top: 3rem;
        padding-bottom: 3rem;
        overflow-y: auto;
    }

/* بطاقة النموذج (افتراضية لـ Login) */
.auth-card-wrapper {
    background: #ffffff;
    width: 100%;
    max-width: 520px;
    padding: 32px 28px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
    margin: auto;
}

/* تكبير كارد التسجيل ليكون أوسع ويستوعب 3 أعمدة باحترافية */
.auth-page-container.register-container .auth-card-wrapper {
    max-width: 900px;
    padding: 36px 32px;
    margin-top: 0;
    margin-bottom: auto;
}

/* الهيدر والأيقونة */
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-icon {
    background: rgba(0, 104, 55, 0.1);
    color: #006837;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 104, 55, 0.15);
}

    .auth-logo-icon i {
        font-size: 30px !important;
    }

.auth-header h2 {
    color: #006837;
    font-weight: 800;
    font-size: 1.5rem;
    margin: 0 0 6px 0;
}

.auth-header p {
    color: #64748b;
    font-size: 0.88rem;
    margin: 0;
}

/* مفتاح التبديل */
.login-type-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    gap: 6px;
}

    .login-type-toggle button {
        flex: 1;
        border: none;
        background: transparent;
        padding: 10px 8px;
        border-radius: 9px;
        font-size: 0.85rem;
        font-weight: 700;
        color: #64748b;
        cursor: pointer;
        transition: all 0.2s ease;
        font-family: inherit;
    }

        .login-type-toggle button.active {
            background: #006837;
            color: #ffffff;
            box-shadow: 0 2px 8px rgba(0, 104, 55, 0.25);
        }

/* شبكة الإدخال الخاصة بالتسجيل (3 أعمدة حديثة) */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 16px;
    width: 100%;
}

.input-group {
    margin-bottom: 4px;
    text-align: right;
    width: 100%;
}

    .input-group.full-width {
        grid-column: span 3;
    }

    .input-group label {
        display: block;
        font-size: 0.8rem;
        margin-bottom: 6px;
        font-weight: 700;
        color: #334155;
    }

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

    /* الأيقونات الأساسية (اليمين) */
    .input-wrapper > i.field-icon {
        position: absolute;
        right: 12px;
        color: #006837;
        font-size: 1.2rem;
        pointer-events: none;
        z-index: 2;
    }

    /* أزرار التفاعل وسهم القوائم (اليسار) */
    .input-wrapper .toggle-password-btn,
    .input-wrapper .select-arrow {
        position: absolute;
        left: 12px;
        color: #64748b;
        font-size: 1.2rem;
        z-index: 2;
        background: transparent;
        border: none;
        padding: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .input-wrapper .select-arrow {
        pointer-events: none;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    /* تنسيق المدخلات */
    .input-wrapper input,
    .input-wrapper select,
    .input-wrapper .form-control {
        width: 100%;
        padding: 11px 40px 11px 38px;
        border: 1px solid #cbd5e1;
        border-radius: 10px;
        outline: none;
        background: #f8fafc;
        color: #1e293b;
        font-size: 0.88rem;
        box-sizing: border-box;
        transition: all 0.2s ease;
        font-family: inherit;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
    }

        .input-wrapper input[type="file"] {
            padding: 8px 40px 8px 12px;
            cursor: pointer;
        }

    .input-wrapper select {
        cursor: pointer;
    }

        .input-wrapper select option {
            background-color: #ffffff;
            color: #1e293b;
        }

        .input-wrapper input:focus,
        .input-wrapper select:focus {
            border-color: #006837;
            background: #ffffff;
            box-shadow: 0 0 0 3px rgba(0, 104, 55, 0.12);
        }

    .input-wrapper:focus-within .select-arrow {
        color: #006837;
        transform: rotate(180deg);
    }

.validation-message {
    color: #dc2626;
    font-size: 0.72rem;
    margin-top: 4px;
    display: block;
    font-weight: 600;
}

/* زر العمليات */
.login-btn {
    width: 100%;
    background: #006837;
    color: #ffffff;
    border: none;
    padding: 13px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.98rem;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(0, 104, 55, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    grid-column: span 3; /* لجعل الزر يمتد بعرض الشبكة بالكامل في صفحة التسجيل */
}

    .login-btn:hover:not(:disabled) {
        background: #00522b;
        transform: translateY(-1px);
    }

    .login-btn:disabled {
        opacity: 0.75;
        cursor: not-allowed;
    }

.footer-links {
    text-align: center;
    margin-top: 18px;
    font-size: 0.88rem;
    color: #64748b;
    grid-column: span 3;
}

    .footer-links a {
        color: #006837;
        text-decoration: none;
        font-weight: 700;
        margin-right: 6px;
    }

        .footer-links a:hover {
            text-decoration: underline;
        }

/* النوافذ المنبثقة (Popups) */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    direction: rtl;
    padding: 1rem;
}

.popup-box {
    background: #ffffff;
    padding: 28px 24px;
    border-radius: 18px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: popupAppear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-icon {
    margin-bottom: 12px;
}

.popup-message {
    color: #1e293b;
    font-size: 0.92rem;
    margin-bottom: 18px;
    line-height: 1.6;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   التجاوب الشامل (Responsive Design) - تحويل الـ 3 أعمدة إلى عمود واحد في الموبايل
   ========================================================================== */

@media (max-width: 992px) {
    .auth-page-container.register-container .auth-card-wrapper {
        max-width: 650px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr); /* تابلت: عمودين */
    }

    .input-group.full-width,
    .login-btn,
    .footer-links {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .auth-page-container {
        padding: 1rem 0.5rem;
    }

        .auth-page-container.register-container {
            padding: 1rem 0.5rem 2rem 0.5rem;
            align-items: flex-start !important;
        }

            .auth-card-wrapper,
            .auth-page-container.register-container .auth-card-wrapper {
                border-radius: 16px;
                padding: 20px 16px;
                max-width: 100%;
            }

    .form-grid {
        grid-template-columns: 1fr; /* موبايل: عمود واحد بالكامل */
        gap: 0;
    }

    .input-group.full-width,
    .login-btn,
    .footer-links {
        grid-column: span 1;
    }

    .auth-header h2 {
        font-size: 1.25rem;
    }

    .login-btn {
        padding: 12px;
        font-size: 0.92rem;
    }
}
