@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Cairo:wght@600;700;800;900&display=swap');

:root {
    --brand-deep: #073b3a;
    --brand-mid: #0e7c74;
    --brand-teal-a: #14a394;
    --brand-teal-b: #0a6e63;
    --brand-blue-a: #2f7fb0;
    --brand-blue-b: #1c5378;

    --gold: #e3a94c;
    --gold-soft: #f4d9a3;

    --line: #a9c3bf;
    --line-glow: rgba(227, 169, 76, 0.45);

    --bg: #f8f7f2;
    --ink: #123534;
}


/* =========================================
   MAIN SECTION
========================================= */

.structure-section {
    position: relative;
    padding: 80px 0 110px;

    background:
        radial-gradient(
            ellipse 900px 500px at 50% 0%,
            rgba(227, 169, 76, 0.10),
            transparent 60%
        ),
        radial-gradient(
            circle at 50% 0%,
            rgba(14, 124, 116, 0.06),
            transparent 55%
        ),
        var(--bg);

    direction: rtl;
    overflow-x: auto;

    font-family: 'Tajawal', sans-serif;
}


/* =========================================
   CONTAINER
========================================= */

.structure-container {
    width: 100%;
    margin: 0 auto;
}


/* =========================================
   HEADING
========================================= */

.structure-heading {
    position: relative;
    text-align: center;
    margin-bottom: 65px;
}

.structure-heading span {
    display: inline-block;

    position: relative;

    padding: 0 30px;
    margin-bottom: 8px;

    color: var(--gold);

    font-size: 14px;
    font-weight: 800;

    letter-spacing: 0.5px;
}

.structure-heading span::before,
.structure-heading span::after {
    content: "";

    position: absolute;
    top: 50%;

    width: 20px;
    height: 1px;

    background: linear-gradient(
        90deg,
        transparent,
        var(--gold)
    );
}

.structure-heading span::before {
    right: 0;
}

.structure-heading span::after {
    left: 0;
    transform: scaleX(-1);
}

.structure-heading h1 {
    margin: 0;

    color: var(--brand-deep);

    font-family: 'Cairo', 'Tajawal', sans-serif;

    font-size: 42px;
    font-weight: 900;

    line-height: 1.3;
}

.structure-line {
    width: 75px;
    height: 4px;

    margin: 16px auto 0;

    border-radius: 20px;

    background: linear-gradient(
        90deg,
        var(--brand-teal-a),
        var(--gold)
    );
}


/* =========================================
   ORGANIZATION CHART CANVAS
========================================= */

.organization-chart {
    position: relative;

    width: 1400px;
    height: 720px;

    margin: 0 auto;
}


/* =========================================
   NODE WRAPPER (positioned by left % + top px)
========================================= */

.org-item {
    position: absolute;

    top: 0;
    left: 50%;

    transform: translateX(-50%);

    z-index: 5;

    animation: rise-in 0.6s ease both;
}


/* =========================================
   BOX (text lives INSIDE the box, in white)
========================================= */

.org-box {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto;

    padding: 8px 14px;

    border-radius: 10px;

    color: #ffffff;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    text-align: center;
    line-height: 1.35;

    box-shadow:
        0 4px 12px rgba(7, 59, 58, 0.18),
        inset 0 0 0 1px rgba(255, 255, 255, 0.25);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.org-box::after {
    content: "";

    position: absolute;
    inset: 0;

    border-radius: inherit;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.20),
            transparent 65%
        );

    pointer-events: none;
}


/* Size variants */

.org-box.sz-sm {
    width: 150px;
    min-height: 44px;
    font-size: 12.5px;
}

.org-box.sz-md {
    width: 168px;
    min-height: 58px;
    font-size: 11.5px;
}

.org-box.sz-lg {
    width: 188px;
    min-height: 72px;
    font-size: 11px;
}


/* =========================================
   TEAL BOX
========================================= */

.org-box.teal {
    background:
        linear-gradient(
            145deg,
            var(--brand-teal-a),
            var(--brand-teal-b)
        );
}

.org-item:hover .org-box.teal {
    transform: translateY(-4px) scale(1.05);

    box-shadow:
        0 9px 20px rgba(10, 110, 99, 0.32),
        inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}


/* =========================================
   BLUE BOX
========================================= */

.org-box.blue {
    background:
        linear-gradient(
            145deg,
            var(--brand-blue-a),
            var(--brand-blue-b)
        );
}

.org-item:hover .org-box.blue {
    transform: translateY(-4px) scale(1.05);

    box-shadow:
        0 9px 20px rgba(28, 83, 120, 0.32),
        inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}


/* =========================================
   TOP TRUNK: assembly -> president -> executive
========================================= */

.general-assembly   { top: 0; }
.board-president    { top: 78px; }
.executive-manager  { top: 158px; }

.general-assembly .org-box::before {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 220px;
    height: 220px;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            var(--line-glow),
            transparent 70%
        );

    z-index: -1;
}


/* =========================================
   CONNECTOR LINES (generic)
========================================= */

.org-line {
    position: absolute;

    width: 2px;

    background:
        linear-gradient(
            180deg,
            var(--gold),
            var(--line)
        );

    border-radius: 5px;

    z-index: 2;
}

.org-line::before,
.org-line::after {
    content: "";

    position: absolute;

    left: 50%;

    width: 6px;
    height: 6px;

    transform: translateX(-50%);

    border-radius: 50%;

    background: var(--gold);

    box-shadow:
        0 0 7px var(--line-glow);
}

.org-line::before {
    top: -3px;
}

.org-line::after {
    bottom: -3px;

    background: var(--brand-mid);
}

/* horizontal connector bars */
.org-bar {
    position: absolute;

    height: 2px;

    background:
        linear-gradient(
            90deg,
            transparent,
            var(--line) 12%,
            var(--line) 88%,
            transparent
        );

    z-index: 1;
}


/* Trunk: assembly -> president -> executive */
.line-assembly  { top: 42px;  height: 36px; left: 50%; transform: translateX(-50%); }
.line-president { top: 124px; height: 34px; left: 50%; transform: translateX(-50%); }

/* Executive -> row3 (secretariat / financial advisor) */
.line-exec-stub { top: 204px; height: 18px; left: 50%; transform: translateX(-50%); }
.bar-row3       { top: 222px; left: 30%; width: 40%; }
.line-row3-a    { top: 222px; height: 24px; left: 30%; transform: translateX(-50%); }
.line-row3-b    { top: 222px; height: 24px; left: 70%; transform: translateX(-50%); }

/* Long trunk bypassing row3, down to row4 branch */
.line-trunk-4   { top: 204px; height: 128px; left: 50%; transform: translateX(-50%); }
.bar-row4       { top: 332px; left: 25%; width: 50%; }
.line-row4-a    { top: 332px; height: 18px; left: 25%; transform: translateX(-50%); }
.line-row4-b    { top: 332px; height: 18px; left: 75%; transform: translateX(-50%); }

/* Row4 -> row5 branches (left group under general supervisor) */
.line-row4a-stub { top: 404px; height: 40px; left: 25%; transform: translateX(-50%); }
.bar-row5-left   { top: 444px; left: 12.5%; width: 25%; }
.line-row5-a1    { top: 444px; height: 26px; left: 12.5%; transform: translateX(-50%); }
.line-row5-a2    { top: 444px; height: 26px; left: 37.5%; transform: translateX(-50%); }

/* Row4 -> row5 branches (right group under resource manager) */
.line-row4b-stub { top: 408px; height: 36px; left: 75%; transform: translateX(-50%); }
.bar-row5-right  { top: 444px; left: 62.5%; width: 25%; }
.line-row5-b1    { top: 444px; height: 26px; left: 62.5%; transform: translateX(-50%); }
.line-row5-b2    { top: 444px; height: 26px; left: 87.5%; transform: translateX(-50%); }

/* Row5 -> row6 (straight verticals, no extra branch) */
.line-row6-a { top: 526px; height: 74px; left: 12.5%; transform: translateX(-50%); }
.line-row6-b { top: 526px; height: 74px; left: 37.5%; transform: translateX(-50%); }
.line-row6-c { top: 526px; height: 74px; left: 87.5%; transform: translateX(-50%); }


/* =========================================
   ROW POSITIONS (nodes)
========================================= */

.secretariat        { top: 246px; left: 30%; }
.financial-advisor   { top: 246px; left: 70%; }

.general-supervisor  { top: 350px; left: 25%; }
.resource-manager    { top: 350px; left: 75%; }

.prog-manager        { top: 470px; left: 12.5%; }
.hr-manager          { top: 470px; left: 37.5%; }
.resource-development{ top: 470px; left: 62.5%; }
.financial-affairs   { top: 470px; left: 87.5%; }

.tech-manager        { top: 600px; left: 12.5%; }
.governance-manager  { top: 600px; left: 37.5%; }
.support-services    { top: 600px; left: 87.5%; }


/* =========================================
   ENTRY ANIMATION
========================================= */

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
    }
}

.general-assembly       { animation-delay: 0s; }
.board-president        { animation-delay: 0.08s; }
.executive-manager      { animation-delay: 0.16s; }
.secretariat,
.financial-advisor      { animation-delay: 0.24s; }
.general-supervisor,
.resource-manager       { animation-delay: 0.32s; }
.prog-manager,
.hr-manager,
.resource-development,
.financial-affairs      { animation-delay: 0.40s; }
.tech-manager,
.governance-manager,
.support-services       { animation-delay: 0.48s; }


/* =========================================
   REDUCED MOTION
========================================= */

@media (prefers-reduced-motion: reduce) {
    .org-item {
        animation: none;
    }

    .org-box,
    .org-item:hover .org-box {
        transition: none;
        transform: none;
    }
}


/* =========================================
   RESPONSIVE (horizontal scroll on small screens)
========================================= */

@media (max-width: 1450px) {
    .structure-section {
        overflow-x: auto;
    }

    .structure-container {
        min-width: 1450px;
    }
}

@media (max-width: 768px) {
    .structure-section {
        padding: 50px 0 80px;

        overflow-x: auto;
        overflow-y: hidden;

        -webkit-overflow-scrolling: touch;
    }

    .structure-container {
        width: 1450px;
        min-width: 1450px;
    }

    .structure-heading {
        margin-bottom: 45px;
    }

    .structure-heading h1 {
        font-size: 30px;
    }

    .structure-heading span {
        font-size: 12px;
    }
}

