/* ==========================================================================
   ELBANA ERP - Executive Entry Experience Design System
   Architecture: Origin (Principal UI/UX Architect)
   Typography: IBM Plex Sans Arabic (Local) + Cairo / Tajawal Fallback
   Target: RTL Native Arabic, Zero Vendor Bloat, Seamless White Logo Integration
   ========================================================================== */

/* 1. Local Arabic Typography */
@font-face {
    font-family: 'ELBANA Arabic';
    src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ELBANA Arabic';
    src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ELBANA Arabic';
    src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* 2. Design Tokens */
:root {
    --elbana-navy-deep:     #0a1924;
    --elbana-navy-main:     #0f2738;
    --elbana-navy-surface:  #13334c;
    --elbana-navy-hover:    #1c496c;
    --elbana-navy-light:    #f0f5f9;

    --elbana-crimson-main:  #b91c1c;
    --elbana-crimson-hover: #991b1b;
    --elbana-crimson-alert: #dc2626;
    --elbana-crimson-soft:  #fef2f2;

    --elbana-bg-canvas:     #f8fafc;
    --elbana-bg-card:       #ffffff;
    --elbana-bg-subtle:     #f1f5f9;
    --elbana-border:        #e2e8f0;
    --elbana-border-focus:  #0284c7;

    --elbana-text-heading:  #0f172a;
    --elbana-text-body:     #334155;
    --elbana-text-muted:    #64748b;
    --elbana-text-ph:       #94a3b8;

    --elbana-emerald:       #059669;
    --elbana-emerald-soft:  #ecfdf5;

    --elbana-radius-sm:     8px;
    --elbana-radius-md:     12px;
    --elbana-radius-lg:     18px;
    --elbana-radius-xl:     24px;
    --elbana-radius-pill:   9999px;

    --elbana-shadow-xs:     0 1px 2px rgba(15, 39, 56, 0.04);
    --elbana-shadow-sm:     0 4px 14px rgba(15, 39, 56, 0.05);
    --elbana-shadow-md:     0 10px 25px -4px rgba(15, 39, 56, 0.06);
    --elbana-shadow-xl:     0 20px 45px -10px rgba(15, 39, 56, 0.09), 0 6px 16px -4px rgba(15, 39, 56, 0.04);
}

/* 3. Base Reset & Structure */
html {
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body.elbana-auth {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--elbana-bg-canvas);
    background-image: 
        radial-gradient(at 15% 15%, rgba(15, 39, 56, 0.035) 0px, transparent 65%),
        radial-gradient(at 85% 85%, rgba(185, 28, 28, 0.025) 0px, transparent 65%);
    background-attachment: fixed;
    color: var(--elbana-text-body);
    font-family: 'ELBANA Arabic', 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

button, input {
    font-family: inherit;
}

:focus-visible {
    outline: 2px solid var(--elbana-border-focus);
    outline-offset: 2px;
}

/* 4. Layout Shell */
.elbana-shell {
    width: min(1180px, 100%);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 20px 24px 18px;
    display: flex;
    flex-direction: column;
}

/* 5. Header Component */
.elbana-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--elbana-border);
}

.elbana-header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.elbana-header-brand:hover {
    text-decoration: none;
}

/* White Logo Badge - Engineered for Pure-White Background Logo */
.elbana-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff !important;
    padding: 6px 14px;
    border-radius: var(--elbana-radius-md);
    border: 1px solid var(--elbana-border);
    box-shadow: var(--elbana-shadow-xs);
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.elbana-header-brand:hover .elbana-logo-badge {
    transform: translateY(-1px);
    box-shadow: var(--elbana-shadow-sm);
}

.elbana-logo-img {
    display: block;
    width: 140px;
    height: auto;
    max-height: 52px;
    aspect-ratio: 944 / 490;
    object-fit: contain;
}

.elbana-header-brand-info {
    display: flex;
    flex-direction: column;
}

.elbana-header-brand-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--elbana-navy-main);
    line-height: 1.3;
}

.elbana-header-brand-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--elbana-text-muted);
}

/* Status Pill in Header */
.elbana-header-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid var(--elbana-border);
    border-radius: var(--elbana-radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--elbana-navy-main);
    box-shadow: var(--elbana-shadow-xs);
}

.elbana-status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--elbana-emerald);
    position: relative;
}

.elbana-status-pulse::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background-color: rgba(5, 150, 105, 0.35);
    animation: elbana-pulse 2s infinite ease-out;
}

@keyframes elbana-pulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    70% { transform: scale(1.7); opacity: 0; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* 6. Main Workspace Area */
.elbana-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 0;
}

/* 7. Welcome Landing Screen (/ ) */
.elbana-welcome-wrapper {
    width: min(100%, 560px);
    margin: 0 auto;
}

.elbana-welcome-card {
    background: var(--elbana-bg-card);
    border: 1px solid var(--elbana-border);
    border-radius: var(--elbana-radius-xl);
    box-shadow: var(--elbana-shadow-xl);
    padding: 46px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.elbana-welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--elbana-crimson-main), var(--elbana-navy-surface));
}

.elbana-welcome-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff !important;
    padding: 12px 24px;
    border-radius: var(--elbana-radius-lg);
    border: 1px solid var(--elbana-border);
    box-shadow: var(--elbana-shadow-sm);
    margin-bottom: 24px;
}

.elbana-welcome-logo-img {
    display: block;
    width: 180px;
    height: auto;
    max-height: 68px;
    aspect-ratio: 944 / 490;
    object-fit: contain;
}

.elbana-welcome-title {
    font-size: clamp(23px, 3.2vw, 28px);
    font-weight: 700;
    color: var(--elbana-navy-main);
    margin: 0 0 8px;
    line-height: 1.35;
}

.elbana-welcome-desc {
    font-size: 15px;
    color: var(--elbana-text-muted);
    line-height: 1.7;
    margin: 0 0 28px;
}

.elbana-btn-welcome {
    max-width: 260px;
}

/* 8. Modern Focused Login Screen (/login) */
.elbana-login-wrapper {
    width: min(100%, 460px);
    margin: 0 auto;
}

.elbana-login-card {
    background: var(--elbana-bg-card);
    border: 1px solid var(--elbana-border);
    border-radius: var(--elbana-radius-xl);
    box-shadow: var(--elbana-shadow-xl);
    padding: 38px 34px 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.elbana-login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--elbana-crimson-main), var(--elbana-navy-main));
}

.elbana-card-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff !important;
    padding: 10px 20px;
    border-radius: var(--elbana-radius-md);
    border: 1px solid var(--elbana-border);
    box-shadow: var(--elbana-shadow-xs);
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.elbana-card-logo-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--elbana-shadow-sm);
}

.elbana-card-logo-img {
    display: block;
    width: 160px;
    height: auto;
    max-height: 60px;
    aspect-ratio: 944 / 490;
    object-fit: contain;
}

.elbana-card-header {
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
}

.elbana-card-title {
    font-size: 23px;
    font-weight: 700;
    color: var(--elbana-navy-main);
    margin: 0 0 6px;
    line-height: 1.35;
}

.elbana-card-subtitle {
    font-size: 14px;
    color: var(--elbana-text-muted);
    margin: 0;
}

.elbana-login-card form {
    width: 100%;
}

/* 9. Form Fields & Ergonomic Controls */
.elbana-field {
    margin-bottom: 18px;
    width: 100%;
}

.elbana-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--elbana-navy-main);
    margin-bottom: 7px;
}

.elbana-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.elbana-input-icon {
    position: absolute;
    right: 14px;
    display: grid;
    place-items: center;
    color: var(--elbana-text-muted);
    pointer-events: none;
}

.elbana-input-icon svg {
    width: 19px;
    height: 19px;
}

.elbana-input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 12px 44px 12px 46px;
    background: #ffffff;
    border: 1px solid var(--elbana-border);
    border-radius: var(--elbana-radius-sm);
    color: var(--elbana-text-heading);
    font-size: 15px;
    font-weight: 500;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.elbana-input::-ms-reveal,
.elbana-input::-ms-clear {
    display: none;
}

.elbana-input::placeholder {
    color: var(--elbana-text-ph);
    font-size: 14px;
}

.elbana-input:hover {
    border-color: #cbd5e1;
}

.elbana-input:focus {
    border-color: var(--elbana-border-focus);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    outline: none;
}

.elbana-field.has-error .elbana-input {
    border-color: var(--elbana-crimson-alert);
    background-color: var(--elbana-crimson-soft);
}

.elbana-field-error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--elbana-crimson-alert);
    font-weight: 600;
}

.elbana-field-error svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Password Toggle Button */
.elbana-pwd-toggle {
    position: absolute;
    left: 8px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--elbana-radius-sm);
    background: transparent;
    color: var(--elbana-text-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.elbana-pwd-toggle:hover {
    background-color: var(--elbana-bg-subtle);
    color: var(--elbana-navy-main);
}

.elbana-pwd-toggle svg {
    width: 20px;
    height: 20px;
}

/* Options Bar (Remember Me & Forgot Link) */
.elbana-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    font-size: 13.5px;
    width: 100%;
}

.elbana-remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: var(--elbana-text-body);
}

.elbana-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    accent-color: var(--elbana-crimson-main);
    cursor: pointer;
}

.elbana-forgot-link {
    color: var(--elbana-navy-surface);
    font-weight: 600;
    font-size: 13px;
}

.elbana-forgot-link:hover {
    color: var(--elbana-crimson-main);
    text-decoration: underline;
}

/* 10. Primary CTA Button */
.elbana-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    padding: 12px 24px;
    background-color: var(--elbana-crimson-main);
    color: #ffffff !important;
    border: 0;
    border-radius: var(--elbana-radius-sm);
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(185, 28, 28, 0.22);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.elbana-btn-primary:hover {
    background-color: var(--elbana-crimson-hover);
    box-shadow: 0 6px 18px rgba(185, 28, 28, 0.32);
    text-decoration: none;
}

.elbana-btn-primary:active {
    transform: translateY(1px);
}

.elbana-btn-primary svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

/* RTL Arrow movement on hover */
.elbana-btn-primary:hover svg {
    transform: translateX(-4px);
}

/* 11. Footer Component */
.elbana-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 16px;
    border-top: 1px solid var(--elbana-border);
    font-size: 12px;
    color: var(--elbana-text-muted);
}

.elbana-footer-copy {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 12. Alert Boxes */
.elbana-alert {
    padding: 12px 14px;
    border-radius: var(--elbana-radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.elbana-alert-danger {
    background-color: var(--elbana-crimson-soft);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: var(--elbana-crimson-alert);
}

/* 13. Demo Mode Buttons */
.elbana-demo-panel {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed var(--elbana-border);
    font-size: 12px;
    width: 100%;
}

.elbana-demo-title {
    font-weight: 600;
    color: var(--elbana-text-muted);
    margin-bottom: 8px;
}

.elbana-demo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.elbana-demo-chip {
    padding: 4px 9px;
    background: var(--elbana-bg-subtle);
    border: 1px solid var(--elbana-border);
    border-radius: var(--elbana-radius-sm);
    color: var(--elbana-navy-surface);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.elbana-demo-chip:hover {
    background: #e2e8f0;
    text-decoration: none;
}

/* 14. Responsive Breakpoints */
@media (max-width: 640px) {
    .elbana-shell {
        padding: 14px 16px 12px;
    }

    .elbana-header-brand-info {
        display: none;
    }

    .elbana-welcome-card {
        padding: 34px 20px;
    }

    .elbana-welcome-logo-badge {
        padding: 10px 18px;
        margin-bottom: 18px;
    }

    .elbana-welcome-logo-img {
        width: 140px;
        max-height: 52px;
    }

    .elbana-welcome-title {
        font-size: 21px;
    }

    .elbana-welcome-desc {
        font-size: 14px;
        margin-bottom: 22px;
    }

    .elbana-login-card {
        padding: 24px 20px 22px;
        border-radius: var(--elbana-radius-lg);
    }

    .elbana-card-logo-badge {
        padding: 8px 16px;
        margin-bottom: 14px;
    }

    .elbana-card-logo-img {
        width: 130px;
        max-height: 48px;
    }

    .elbana-card-title {
        font-size: 21px;
    }

    .elbana-footer {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
}

@media (max-width: 380px) {
    .elbana-input {
        font-size: 14px;
        height: 48px;
    }

    .elbana-btn-primary {
        height: 48px;
        font-size: 14.5px;
    }

    .elbana-options-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.elbana-spinner {
    width: 18px;
    height: 18px;
    animation: elbana-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes elbana-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 15. Accessibility (Reduced Motion) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
