/* ============================================================
   AEA ERP — Global Custom Stylesheet
   ============================================================ */

/* Brand Theme Colors Override */
:root {
    --bs-primary: #1f3b60 !important;
    --bs-primary-rgb: 31, 59, 96 !important;
    --bs-secondary: #0e76bd !important;
    --bs-secondary-rgb: 14, 118, 189 !important;
    --tint-primary: rgba(31, 59, 96, 0.12) !important;
    --tint-secondary: rgba(14, 118, 189, 0.12) !important;
    --tone-brand-soft: rgba(31, 59, 96, 0.10) !important;
}

.btn-primary {
    background-color: #1f3b60 !important;
    border-color: #1f3b60 !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #162c49 !important;
    border-color: #162c49 !important;
}

.btn-secondary {
    background-color: #0e76bd !important;
    border-color: #0e76bd !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    background-color: #0b5e96 !important;
    border-color: #0b5e96 !important;
}

.text-primary {
    color: #1f3b60 !important;
}

.text-secondary {
    color: #0e76bd !important;
}

.bg-primary {
    background-color: #1f3b60 !important;
}

.bg-secondary {
    background-color: #0e76bd !important;
}

/* 1. Modal Tab Content Standard Height */
.employee-modal-tab-content {
    min-height: 280px;
}

/* 2. Avatar Rounded Helper */
.avatar.avatar-rounded {
    border-radius: 50% !important;
}

/* 3. Employee Profile Card Subtle Hover (No transform, No elevation shadow) */
.employee-profile-wrapper .card,
.employee-profile-wrapper .card-hover,
.employee-profile-wrapper .border.card-hover {
    transition: border-color 0.2s ease, background-color 0.2s ease !important;
    transform: none !important;
}

.employee-profile-wrapper .card:hover,
.employee-profile-wrapper .card-hover:hover,
.employee-profile-wrapper .border.card-hover:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: #cbd5e1 !important;
    background-color: #f8fafc !important;
}

/* 4. Global Print Media Styles */
@media print {
    .header,
    .sidebar,
    .btn,
    .breadcrumb,
    .nav-tabs,
    .custom-tab,
    .modal {
        display: none !important;
    }
    .page-wrapper,
    .content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* 5. OrgChart Custom Styling (Departments Hierarchy) */
.orgchart-container {
    position: relative;
    overflow: hidden;
    min-height: 580px;
    background-color: #fcfcfd;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
    border-radius: 0.5rem;
    cursor: grab;
    user-select: none;
}

.orgchart-container.is-panning,
.orgchart-container:active {
    cursor: grabbing;
}

/* Force hierarchy tree to strictly use LTR coordinates for symmetrical layout in both English & Arabic */
.orgchart,
.orgchart ul.nodes,
.orgchart li.hierarchy {
    direction: ltr !important;
    text-align: center !important;
}

.orgchart {
    background-image: none !important;
    display: inline-block !important;
    padding: 30px 20px !important;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    will-change: transform;
}

.orgchart ul.nodes {
    display: flex !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    justify-content: center !important;
}

.orgchart li.hierarchy {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.orgchart .node {
    width: auto !important;
    background: transparent !important;
    border: none !important;
    margin: 0 16px 0 16px !important;
    display: inline-block !important;
    position: relative !important;
}

/* Vertical spacing between parent and child row */
.orgchart .nodes .nodes {
    margin-top: 40px !important;
    position: relative !important;
}

.orgchart .node:hover,
.orgchart .node.focused {
    background-color: transparent !important;
}

.org-card {
    width: 250px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    padding: 14px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.org-card:hover {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.org-card.is-root-node {
    border-top: 4px solid #126b4e;
}

.org-card:not(.is-root-node) {
    border-top: 4px solid #0d6efd;
}

/* Downward line from parent node */
.orgchart .node:has(+.nodes)::after {
    content: "" !important;
    position: absolute !important;
    bottom: -20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 2px !important;
    height: 20px !important;
    background-color: #94a3b8 !important;
    z-index: 1 !important;
}

/* Horizontal crossbar across sibling hierarchies */
.orgchart .hierarchy::before {
    content: "" !important;
    position: absolute !important;
    top: -20px !important;
    border-top: 2px solid #94a3b8 !important;
    box-sizing: border-box !important;
    z-index: 1 !important;
}

.orgchart .hierarchy {
    position: relative !important;
}

.orgchart .hierarchy:first-child:not(:only-child)::before {
    left: 50% !important;
    width: 50% !important;
}

.orgchart .hierarchy:last-child:not(:only-child)::before {
    left: 0 !important;
    width: 50% !important;
}

.orgchart .hierarchy:not(:first-child):not(:last-child)::before {
    left: 0 !important;
    width: 100% !important;
}

.orgchart .hierarchy:only-child::before {
    display: none !important;
}

/* Upward line into child node */
.orgchart .nodes .nodes .node::before {
    content: "" !important;
    position: absolute !important;
    top: -20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 2px !important;
    height: 20px !important;
    background-color: #94a3b8 !important;
    z-index: 1 !important;
}

.orgchart > .nodes > .hierarchy > .node::before {
    display: none !important;
}

.orgchart .node .edge,
.orgchart .node .toggleBtn {
    display: none !important;
    pointer-events: none !important;
}

/* 6. Topbar Quick Actions - Modern Flat Icons (No Shadow / No 3D) */
.anew-menu .anew-ic {
    box-shadow: none !important;
    border-radius: 10px !important;
}

.anew-menu .anew-ic.anew-blue {
    background: rgba(37, 99, 235, 0.1) !important;
    color: #2563eb !important;
}

.anew-menu .anew-ic.anew-green {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
}

.anew-menu .anew-ic.anew-amber {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #d97706 !important;
}

.anew-menu .anew-ic.anew-purple {
    background: rgba(124, 58, 237, 0.1) !important;
    color: #7c3aed !important;
}

.anew-menu .anew-ic.anew-cyan {
    background: rgba(14, 165, 233, 0.12) !important;
    color: #0284c7 !important;
}

.anew-menu .anew-ic.anew-pink {
    background: rgba(236, 72, 153, 0.1) !important;
    color: #db2777 !important;
}

/* Quick Actions - Disable Hover Shift & Gap Stretching */
.anew-menu .anew-item:hover {
    transform: none !important;
}

.anew-menu .anew-foot a:hover {
    gap: 0.35rem !important;
    transform: none !important;
}

/* Batch & Branch Menus - Flat Styling */
.ay-menu .ay-ic,
.ay-item.active .ay-ic {
    box-shadow: none !important;
}

.ay-item:hover {
    transform: none !important;
}

/* Topbar Dropdown Buttons - Leading Icon Chip */
.header .dropdown > .btn-outline-light.bg-white:not(.btn-icon) > i:first-child {
    width: 28px;
    height: 28px;
    margin-right: 8px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 59, 96, 0.08);
    color: #1f3b60;
    border-radius: 9px;
    font-size: 16px;
    flex-shrink: 0;
}

[dir="rtl"] .header .dropdown > .btn-outline-light.bg-white:not(.btn-icon) > i:first-child,
.layout-mode-rtl .header .dropdown > .btn-outline-light.bg-white:not(.btn-icon) > i:first-child {
    margin-right: 0 !important;
    margin-left: 8px !important;
}

/* Dashboard Card System Color Badges */
.card-badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
}
.card-badge-green { background: rgba(16, 185, 129, 0.12); color: #059669; }
.card-badge-blue { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.card-badge-yellow { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.card-badge-light-orange { background: rgba(251, 146, 60, 0.18); color: #ea580c; }
.card-badge-dark-orange { background: rgba(234, 88, 12, 0.22); color: #c2410c; }
.card-badge-red { background: rgba(239, 68, 68, 0.16); color: #dc2626; }
.card-badge-black { background: rgba(30, 41, 59, 0.14); color: #0f172a; }

/* Welcome Banner Brand Icon - Flat Design */
.welcome-banner .welcome-banner-brand {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    background: rgba(37, 99, 235, 0.1) !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    border: none !important;
}

.welcome-banner .welcome-banner-brand i {
    color: #2563eb !important;
    font-size: 26px !important;
    display: inline-block !important;
    line-height: 1 !important;
}

/* RTL Spacing Alignment for Banner Brand Icon */
[dir="rtl"] .welcome-banner .welcome-banner-brand,
.layout-mode-rtl .welcome-banner .welcome-banner-brand {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

/* ============================================================
   Sticky Branch Column Fix (Freeze First Column)
   ============================================================ */
.sticky-col-branch {
    position: sticky !important;
    left: 0 !important;
    z-index: 5 !important;
    background-color: #ffffff !important;
    --bs-table-bg: #ffffff !important;
}

[dir="rtl"] .sticky-col-branch,
.layout-mode-rtl .sticky-col-branch,
html[dir="rtl"] .sticky-col-branch {
    right: 0 !important;
    left: auto !important;
}

th.sticky-col-branch {
    z-index: 6 !important;
    background-color: #f8f9fa !important;
    --bs-table-bg: #f8f9fa !important;
}

.table-hover tbody tr:hover .sticky-col-branch {
    background-color: #f1f5f9 !important;
    --bs-table-bg: #f1f5f9 !important;
}

/* ============================================================
   Auth & Login Page Styling
   ============================================================ */
.account-page {
    background-color: #f6f8fb !important;
}

.auth-container {
    min-height: 100vh;
}

.auth-card-wrapper {
    width: 100%;
    max-width: 440px;
}

.auth-logo {
    max-height: 64px;
    max-width: 220px;
    object-fit: contain;
}

.auth-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.85rem;
    border-radius: 50rem !important;
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.15s ease-in-out;
}

.auth-lang-btn:hover {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07) !important;
}
