@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@400;700;800&display=swap');

:root {
    --primary: #B01D23;
    --primary-dark: #631719;
    --primary-light: #d22329;

    --bg: #f5f7fa;
    --card-bg: rgba(255, 255, 255, 0.92);
    --border: #e7ecef;

    --text: #102018;
    --text-muted: #6c7a73;
    --text-light: #9aa7a0;

    --success-bg: #ecfff6;
    --success-text: #0f8a54;
    --success-border: #b9f3d5;

    --error-bg: #fff1f4;
    --error-text: #d6455d;
    --error-border: #ffc0cb;

    --shadow-sm: 0 4px 16px rgba(16, 32, 24, 0.06);
    --shadow-md: 0 12px 35px rgba(16, 32, 24, 0.10);
    --shadow-lg: 0 18px 60px rgba(16, 32, 24, 0.14);

    --radius-lg: 18px;
    --radius-xl: 28px;

    --transition: 0.25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}
*,
input {
    font-family: 'Almarai';
}
body {
    margin: 0;
    min-height: 100vh;
    direction: rtl;
    font-family: 'Almarai', sans-serif, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif ;
    background:
        radial-gradient(circle at top right, rgba(176, 29, 35, 0.12), transparent 28%),
        radial-gradient(circle at bottom left, rgba(176, 29, 35, 0.08), transparent 25%),
        linear-gradient(180deg, #f8fbfa 0%, #eef3f1 100%);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.auth-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 4px;
    flex-direction: column;
}

.logo {
    display: inline-flex;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 18px;
    transition: transform var(--transition), box-shadow var(--transition);
    align-items: center;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--primary);
    justify-content: center;
}

.logo:hover {
    transform: translateY(-2px);
}

.logo-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--card-bg);
    border: 1px solid rgba(231, 236, 239, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 34px 30px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.auth-card h2 {
    margin: 0;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text);
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.8;
    border: 1px solid transparent;
    animation: fadeInUp 0.3s ease both;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    height: 52px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 0 16px;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    box-shadow: inset 0 1px 2px rgba(16, 32, 24, 0.03);
}

.auth-card input[type="text"]::placeholder,
.auth-card input[type="password"]::placeholder {
    color: var(--text-light);
}

.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(176, 29, 35, 0.14);
    transform: translateY(-1px);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(176, 29, 35, 0.28);
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.02);
    box-shadow: 0 14px 30px rgba(176, 29, 35, 0.34);
}

.btn-primary:active {
    transform: translateY(0);
}

.footer-link {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.9;
    padding-top: 4px;
}

.footer-link a {
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: none;
    text-underline-offset: 3px;
}

.footer-link a:hover {
    color: var(--text);
}

.auth-card a {
    transition: color var(--transition), opacity var(--transition);
}

.auth-card a:hover {
    opacity: 0.95;
}

input {
    direction: auto;
    unicode-bidi: plaintext;
}

/* Remember Me Toggle */
.remember-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
}

.remember-toggle__checkbox {
    display: none;
}

.remember-toggle__track {
    width: 44px;
    height: 24px;
    background: #e6e9ec;
    border-radius: 999px;
    position: relative;
    transition: 0.25s ease;
    flex-shrink: 0;
}

.remember-toggle__track::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: 0.25s ease;
}

.remember-toggle__checkbox:checked+.remember-toggle__track {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.remember-toggle__checkbox:checked+.remember-toggle__track::after {
    transform: translateX(-20px);
}

.remember-toggle__label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 14px;
    }

    .auth-card {
        padding: 26px 18px;
        border-radius: 22px;
    }

    .logo-image {
        width: 42px;
        height: 42px;
    }

    .auth-card h2 {
        font-size: 1.5rem;
    }

    .btn-primary,
    .auth-card input[type="text"],
    .auth-card input[type="password"] {
        height: 50px;
    }

    .remember-toggle {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .remember-toggle__label {
        width: 100%;
        /* order: 3; */
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* حاوية الحقل */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding-left: 40px;
    /* ترك مساحة للأيقونة */
}

/* تنسيق الأيقونة */
.toggle-password {
    position: absolute;
    left: 22px;
    /* لأن المشروع RTL */
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
    z-index: 10;
}

.toggle-password:hover {
    color: #333;
}

input#password {
    padding-left: 50px !important;
}