/* Login page: split layout, branding, form and responsive styles. */
*, *::before, *::after {
    box-sizing: border-box;
}

body.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif !important;
    background: #0B1220;
    overflow-x: hidden;
}

/* ===== Wrapper ===== */
.auth-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* Branding panel */
.auth-brand {
    flex: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 50px;
    overflow: hidden;
    color: #fff;
    background: #0A1128;
    z-index: 1;
}

/* Animated gradient overlay */
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(27, 132, 255, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.15) 0%, transparent 60%),
        linear-gradient(135deg, #0A1128 0%, #0F1E3D 50%, #0A1128 100%);
    animation: bgShift 15s ease-in-out infinite;
    z-index: -3;
}

@keyframes bgShift {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(20deg);
    }
}

/* Grid pattern overlay */
.auth-brand::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(27, 132, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(27, 132, 255, 0.06) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* Floating orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}
.orb-1 {
    width: 400px;
    height: 400px;
    background: #1B84FF;
    top: -100px;
    right: -100px;
    animation: orbFloat1 12s ease-in-out infinite;
}
.orb-2 {
    width: 350px;
    height: 350px;
    background: #8B5CF6;
    bottom: -100px;
    left: -80px;
    animation: orbFloat2 14s ease-in-out infinite;
}
.orb-3 {
    width: 250px;
    height: 250px;
    background: #06B6D4;
    top: 40%;
    left: 30%;
    animation: orbFloat3 10s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes orbFloat1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-40px, 40px) scale(1.1);
    }
}
@keyframes orbFloat2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(50px, -30px) scale(1.15);
    }
}
@keyframes orbFloat3 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-30px, -50px) scale(1.2);
        opacity: 0.5;
    }
}

/* Brand content */
.brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 520px;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo */
.brand-logo {
    margin-bottom: 40px;
    display: inline-block;
    padding: 16px 28px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(27, 132, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 40px 10px rgba(27, 132, 255, 0.15);
    }
}

.brand-logo img {
    max-height: 85px;
    display: block;
    filter: brightness(0) invert(1);
}

/* Title with gradient text */
.brand-title {
    font-size: 38px;
    font-weight: 800;
    margin: 0 0 16px;
    line-height: 1.3;
    background: linear-gradient(135deg, #FFFFFF 0%, #93C5FD 50%, #FFFFFF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
}

.brand-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.9;
    margin: 0 0 40px;
}

/* Feature cards */
.brand-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: start;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInRight 0.6s ease-out backwards;
}

.feature-item:nth-child(1) {
    animation-delay: 0.2s;
}
.feature-item:nth-child(2) {
    animation-delay: 0.35s;
}
.feature-item:nth-child(3) {
    animation-delay: 0.5s;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.feature-item:hover {
    background: rgba(27, 132, 255, 0.12);
    border-color: rgba(27, 132, 255, 0.4);
    transform: translateX(-8px);
    box-shadow: 0 8px 24px rgba(27, 132, 255, 0.15);
}

.feature-item i {
    font-size: 18px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B84FF 0%, #0E70E0 100%);
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(27, 132, 255, 0.35);
    color: #fff;
}

.feature-item span {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

/* Login form panel */
.auth-form-side {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    position: relative;
    background: #0B1220;
    overflow: hidden;
}

/* Background decoration on right side */
.auth-form-side::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(27, 132, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    z-index: 0;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 48px 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: cardEnter 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Subtle glow line on top */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(27, 132, 255, 0.6), transparent);
}

/* ===== Header ===== */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0 0 8px;
    letter-spacing: -0.3px;
}

.auth-header p {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    font-weight: 400;
}

/* ===== Form fields ===== */
.field-group {
    margin-bottom: 18px;
}

.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.input-wrapper:focus-within {
    background: rgba(27, 132, 255, 0.06);
    border-color: rgba(27, 132, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(27, 132, 255, 0.1);
}

.input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 15px;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.input-wrapper:focus-within .input-icon {
    color: #1B84FF;
}

.input-wrapper input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    padding: 14px 4px;
    font-size: 14px;
    color: #FFFFFF;
    font-family: inherit;
    letter-spacing: 0.2px;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
}

/* Fix Chrome autofill */
.input-wrapper input:-webkit-autofill,
.input-wrapper input:-webkit-autofill:hover,
.input-wrapper input:-webkit-autofill:focus {
    -webkit-text-fill-color: #FFFFFF;
    -webkit-box-shadow: 0 0 0 1000px rgba(20, 30, 50, 0.9) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* ===== Options ===== */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 26px;
    font-size: 13px;
}

.remember-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    user-select: none;
}

.remember-wrap input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.remember-wrap input[type="checkbox"]:hover {
    border-color: rgba(27, 132, 255, 0.6);
}

.remember-wrap input[type="checkbox"]:checked {
    background: #1B84FF;
    border-color: #1B84FF;
}

.remember-wrap input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    color: #60A5FA;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.forgot-link:hover {
    color: #93C5FD;
    text-shadow: 0 0 12px rgba(96, 165, 250, 0.5);
}

/* ===== Submit button ===== */
.btn-auth {
    position: relative;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #1B84FF 0%, #0E70E0 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 14px rgba(27, 132, 255, 0.4),
        0 0 0 0 rgba(27, 132, 255, 0.5);
    letter-spacing: 0.3px;
}

.btn-auth::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.6s ease;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(27, 132, 255, 0.5),
        0 0 0 4px rgba(27, 132, 255, 0.15);
}

.btn-auth:hover::before {
    left: 100%;
}

.btn-auth:active {
    transform: translateY(0);
}

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Validation messages */
.auth-errors,
.login-page .fv-plugins-message-container {
    color: #F87171;
    font-size: 12px;
    margin-top: 6px;
    font-weight: 500;
}

.auth-errors {
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 12px;
    background: rgba(248, 113, 113, 0.08);
}

.auth-errors ul {
    margin: 0;
    padding-inline-start: 18px;
}

.auth-status {
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(110, 231, 183, 0.3);
    border-radius: 12px;
    color: #6EE7B7;
    background: rgba(110, 231, 183, 0.08);
    font-size: 13px;
}

.auth-back-link {
    display: block;
    margin-top: 20px;
    text-align: center;
}

.btn-auth:focus-visible,
.forgot-link:focus-visible,
.remember-wrap input:focus-visible {
    outline: 2px solid #93C5FD;
    outline-offset: 4px;
}

/* Responsive layout */
@media (max-width: 1024px) {
    .brand-title {
        font-size: 30px;
    }
    .auth-brand {
        padding: 50px 36px;
    }
}

@media (max-width: 900px) {
    .auth-wrapper {
        flex-direction: column;
    }

    .auth-brand {
        min-height: auto;
        padding: 50px 24px 40px;
        flex: none;
    }

    .brand-features {
        display: none;
    }
    .brand-logo {
        margin-bottom: 24px;
        padding: 12px 20px;
    }
    .brand-logo img {
        max-height: 45px;
    }
    .brand-title {
        font-size: 24px;
        margin-bottom: 10px;
    }
    .brand-subtitle {
        font-size: 13px;
        margin-bottom: 0;
    }

    .auth-form-side {
        padding: 32px 20px 48px;
        flex: none;
    }

    .auth-card {
        padding: 36px 26px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 18px;
    }
    .auth-header h1 {
        font-size: 22px;
    }
    .input-wrapper input {
        padding: 13px 4px;
        font-size: 13.5px;
    }
    .auth-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-page *,
    .login-page *::before,
    .login-page *::after {
        animation: none !important;
        transition: none !important;
    }
}
