:root {
    --primary:       #1a3c5e;
    --primary-dark:  #102840;
    --primary-light: #2a5580;
    --accent:        #c8972a;
    --accent-light:  #e8b84b;
    --white:         #ffffff;
    --light:         #f4f6f9;
    --text-dark:     #1a1a2e;
    --text-muted:    #8a9bb0;
    --border:        #d0dae8;
    --shadow:        0 20px 60px rgba(26, 60, 94, 0.15);
    --radius:        14px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: SystemFont;
    src: url('../fonts/KUF.ttf') format('truetype');
}

body {
    font-family: SystemFont, sans-serif;
    direction: rtl;
    background: var(--light);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* ======= Login Wrapper ======= */
.login-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ======= Brand Side ======= */
.login-brand {
    flex: 0 0 45%;
    background: linear-gradient(155deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 100vh;
}

.brand-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 40px,
        rgba(255,255,255,0.015) 40px,
        rgba(255,255,255,0.015) 80px
    );
}

.brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-logo {
    width: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    padding: 20px;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.brand-title {
    font-size: 1.9rem;
    color: var(--white);
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.brand-subtitle {
    font-size: 1rem;
    color: var(--accent-light);
    margin-bottom: 24px;
}

.brand-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    margin: 0 auto 24px;
}

.brand-desc {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.55);
    max-width: 280px;
    line-height: 1.8;
}

/* ======= Form Side ======= */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    padding: 40px 30px;
}

.login-form-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px 44px;
    width: 100%;
    max-width: 460px;
    border-top: 4px solid var(--accent);
}

/* ======= Form Header ======= */
.form-header {
    text-align: center;
    margin-bottom: 36px;
}

.form-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 8px 24px rgba(26, 60, 94, 0.25);
}

.form-icon i {
    font-size: 1.8rem;
    color: var(--white);
}

.form-header h2 {
    font-size: 1.7rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ======= Input Groups ======= */
.form-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group label i {
    color: var(--primary);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: SystemFont, sans-serif;
    font-size: 1rem;
    color: var(--text-dark);
    background: var(--light);
    transition: all 0.3s ease;
    text-align: right;
    direction: rtl;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(26, 60, 94, 0.08);
}

/* ======= Login Button ======= */
.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: SystemFont, sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(26, 60, 94, 0.3);
    letter-spacing: 1px;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: 0 8px 28px rgba(26, 60, 94, 0.4);
    transform: translateY(-1px);
}

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

/* ======= Spinner ======= */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 60, 94, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.spinner-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 36px 48px;
    text-align: center;
    box-shadow: var(--shadow);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.spinner-box p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======= Modal ======= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 60, 94, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 44px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 380px;
    width: 90%;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
    margin-bottom: 16px;
}

.modal-icon i {
    font-size: 3rem;
    color: #e74c3c;
}

.modal-card h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.modal-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.modal-btn {
    padding: 11px 40px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: SystemFont, sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-btn:hover {
    background: var(--primary-dark);
}

/* ======= Mobile Logo - hidden on desktop ======= */
.mobile-logo {
    display: none;
}

/* ======= Responsive - Tablet & Mobile ======= */
@media (max-width: 900px) {

    .login-wrapper {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        height: auto;
        overflow: auto;
        background: linear-gradient(155deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    }

    .login-brand {
        display: none;
    }

    .login-form-side {
        width: 100%;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        background: transparent;
    }

    /* Mobile logo - large to replace brand side */
    .mobile-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 30px;
        width: 100%;
        max-width: 420px;
    }

    .mobile-logo img {
        width: 180px;
        height: 180px;
        object-fit: contain;
        filter: brightness(0) invert(1);
    }

    .login-form-card {
        padding: 32px 24px;
        width: 100%;
        max-width: 420px;
    }
}

/* ======= Responsive - Small Mobile ======= */
@media (max-width: 480px) {

    .mobile-logo img {
        width: 140px;
        height: 140px;
    }

    .login-form-card {
        padding: 28px 18px;
    }

    .form-header h2 {
        font-size: 1.4rem;
    }
}
