/* ==========================================================================
   Organizational Chart Styles - ONDIMP
   ========================================================================== */

.organigrama-section {
    padding: 60px 0;
    background: #ECF6FF;
    min-height: calc(100vh - 200px);
}

.page-title {
    font-size: 1.8rem;
    color: #0F4B91;
    text-align: center;
    margin-bottom: 50px;
    font-weight: 600;
    line-height: 1.4;
}

/* Desktop Organizational Chart */
.org-chart {
    display: block;
    position: relative;
    padding: 20px 10px;
    overflow-x: hidden;
    width: 100%;
}

.org-level {
    display: flex;
    justify-content: center;
    position: relative;
    margin-bottom: 40px;
}

.org-node {
    position: relative;
}

/* Boxes */
.org-box {
    background: white;
    border: 2px solid #0F4B91;
    border-radius: 8px;
    padding: 15px 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

/* Animation delays for boxes */
.org-node--council .org-box { animation-delay: 0s; }
.org-node--director .org-box { animation-delay: 0.6s; }
.org-unit .org-box { animation-delay: 2.2s; }
.org-department:nth-child(1) .org-box { animation-delay: 2.4s; }
.org-department:nth-child(2) .org-box { animation-delay: 2.5s; }
.org-department:nth-child(3) .org-box { animation-delay: 2.6s; }
.org-department:nth-child(5) .org-box { animation-delay: 2.7s; }
.org-department:nth-child(6) .org-box { animation-delay: 2.8s; }
.org-department:nth-child(7) .org-box { animation-delay: 2.9s; }
.org-department:nth-child(8) .org-box { animation-delay: 3.0s; }

.org-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.org-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    display: block;
    line-height: 1.4;
}

/* Council and Director specific styles */
.org-node--council .org-box,
.org-node--director .org-box {
    background: #0F4B91;
    color: white;
    font-weight: 600;
    padding: 20px 40px;
}

.org-node--council .org-title,
.org-node--director .org-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

/* Connectors with Animation */
.org-connector {
    position: absolute;
    background: #0F4B91;
}

/* Vertical Line Animations */
.org-connector--vertical {
    width: 2px;
    height: 40px;
    left: 50%;
    top: -40px;
    transform: translateX(-50%);
    animation: drawVertical 0.5s ease-out forwards;
    transform-origin: top center;
}

.org-connector--vertical-short {
    width: 2px;
    height: 30px;
    left: 50%;
    top: -30px;
    transform: translateX(-50%);
    animation: drawVertical 0.5s ease-out forwards;
    animation-delay: 1.5s;
    opacity: 0;
}

/* Director Level */
.org-level--director {
    position: relative;
    margin-bottom: 70px;
    margin-top: 40px;
}

.org-project-unit {
    position: relative;
}

.org-box--project {
    background: #e8f4f8;
    border: 2px solid #1E5BA8;
    width: 200px;
    padding: 20px 15px;
}

.org-box--project .org-title {
    font-weight: 600;
    color: #0F4B91;
}

/* Vertical connector from Consiliu to Director */
.org-connector--vertical-from-council {
    position: absolute;
    width: 2px;
    height: 72px;
    background: #0F4B91;
    left: 50%;
    top: -50px;
    transform: translateX(-50%);
    z-index: 1;
    animation: drawVertical 0.6s ease-out forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

.org-connector--vertical-from-council::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #0F4B91;
}

/* Project Units Level */
.org-level--units {
    position: relative;
    margin-top: 90px;
    padding: 0 30px;
}

.org-units-wrapper {
    display: flex;
    justify-content: center;
    gap: 200px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

.org-unit {
    position: relative;
}

/* Step-down connectors from Director to Units */
.org-connector--diagonal-left {
    position: absolute;
    width: 2px;
    height: 340px;
    background: #0F4B91;
    left: 50%;
    bottom: -340px;
    transform: translateX(-20px);
    z-index: 0;
    animation: drawVertical 0.8s ease-out forwards;
    animation-delay: 1.4s;
    opacity: 0;
}

.org-connector--diagonal-left::after {
    content: '';
    position: absolute;
    width: 92px;
    height: 2px;
    background: #0F4B91;
    bottom: 0;
    right: 0;
    transform: translateX(100%);
}

/* Arrow at the end of horizontal line to left unit */
.org-unit--left::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #0F4B91;
}

.org-connector--diagonal-right {
    position: absolute;
    width: 2px;
    height: 340px;
    background: #0F4B91;
    left: 50%;
    bottom: -340px;
    transform: translateX(20px);
    z-index: 0;
    animation: drawVertical 0.8s ease-out forwards;
    animation-delay: 1.4s;
    opacity: 0;
}

.org-connector--diagonal-right::after {
    content: '';
    position: absolute;
    width: 92px;
    height: 2px;
    background: #0F4B91;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
}

/* Arrow at the end of horizontal line to right unit */
.org-unit--right::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #0F4B91;
}


.org-node--director {
    position: relative;
    z-index: 2;
}

.org-level--departments {
    position: relative;
    margin-top: 50px;
}

.org-connector--horizontal {
    height: 2px;
    width: calc(100% - 240px);
    top: -50px;
    left: 160px;
    right: 80px;
    animation: drawHorizontalExpand 0.8s ease-out forwards;
    animation-delay: 1.8s;
    opacity: 0;
    transform-origin: center;
}

/* Departments Grid */
.org-departments-wrapper {
    display: grid;
    grid-template-columns: 110px 110px 110px 40px 110px 110px 110px 110px;
    gap: 20px;
    width: auto;
    max-width: none;
    margin: 0 auto;
    position: relative;
    padding: 0 20px;
    justify-content: center;
    padding-left: 150px;
}

.org-department {
    position: relative;
}

.org-connector--branch {
    position: absolute;
    width: 2px;
    height: 42px;
    background: #0F4B91;
    left: 50%;
    top: -50px;
    transform: translateX(-50%);
    animation: drawVertical 0.4s ease-out forwards;
    animation-delay: 2.4s;
    opacity: 0;
    transform-origin: top center;
}

/* Staggered animations for each department branch */
.org-department:nth-child(1) .org-connector--branch { animation-delay: 2.3s; }
.org-department:nth-child(2) .org-connector--branch { animation-delay: 2.4s; }
.org-department:nth-child(3) .org-connector--branch { animation-delay: 2.5s; }
.org-department:nth-child(5) .org-connector--branch { animation-delay: 2.6s; }
.org-department:nth-child(6) .org-connector--branch { animation-delay: 2.7s; }
.org-department:nth-child(7) .org-connector--branch { animation-delay: 2.8s; }
.org-department:nth-child(8) .org-connector--branch { animation-delay: 2.9s; }

/* Arrow heads for department branches */
.org-connector--branch::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #0F4B91;
}

/* Empty department space - no connector branch */
.org-department--empty .org-connector--branch {
    display: none;
}

.org-department .org-box {
    height: 120px;
    width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    word-wrap: break-word;
}

/* Special styling for unit boxes */
.org-unit .org-box {
    background: #e8f4f8;
    border: 2px solid #1E5BA8;
    width: 200px;
    padding: 20px 15px;
}

.org-unit .org-title {
    font-weight: 600;
    color: #0F4B91;
}

/* Mobile Version - Hidden on Desktop */
.org-mobile {
    display: none;
}

/* Animation Keyframes */
@keyframes drawVertical {
    from {
        opacity: 0;
        transform: translateX(-50%) scaleY(0);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scaleY(1);
    }
}

@keyframes drawHorizontalFromLeft {
    from {
        opacity: 0;
        transform: scaleX(0);
        transform-origin: right center;
    }
    to {
        opacity: 1;
        transform: scaleX(1);
        transform-origin: right center;
    }
}

@keyframes drawHorizontalFromRight {
    from {
        opacity: 0;
        transform: scaleX(0);
        transform-origin: left center;
    }
    to {
        opacity: 1;
        transform: scaleX(1);
        transform-origin: left center;
    }
}

@keyframes drawHorizontalExpand {
    from {
        opacity: 0;
        transform: scaleX(0);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

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



/* Responsive Design */
@media (max-width: 1400px) {
    .org-departments-wrapper {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .org-connector--diagonal-left,
    .org-connector--diagonal-right {
        display: none;
    }
}

@media (max-width: 1200px) {
    .org-departments-wrapper {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .org-departments-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .org-box {
        padding: 12px 20px;
    }
    
    .org-title {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    /* Hide desktop version */
    .org-chart {
        display: none;
    }
    
    /* Show mobile version */
    .org-mobile {
        display: block;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .org-mobile-item {
        margin-bottom: 15px;
    }
    
    .org-mobile-box {
        background: white;
        border: 2px solid #0F4B91;
        border-radius: 8px;
        padding: 15px 20px;
        display: flex;
        align-items: center;
        gap: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    
    .org-mobile-box:hover {
        transform: translateX(5px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .org-mobile-item--level1 .org-mobile-box,
    .org-mobile-item--level2 .org-mobile-box {
        background: #0F4B91;
        justify-content: center;
    }
    
    .org-mobile-item--level1 .org-mobile-title,
    .org-mobile-item--level2 .org-mobile-title {
        color: white;
        font-weight: 600;
        font-size: 16px;
    }
    
    .org-mobile-title {
        font-size: 14px;
        color: #333;
        font-weight: 500;
        flex: 1;
    }
    
    .org-mobile-number {
        background: #0F4B91;
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .org-mobile-connector {
        width: 2px;
        height: 30px;
        background: #0F4B91;
        margin: -5px auto;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .org-mobile-departments {
        position: relative;
        padding-left: 20px;
    }
    
    .org-mobile-departments::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 2px;
        background: #0F4B91;
    }
    
    .org-mobile-departments .org-mobile-item {
        position: relative;
    }
    
    .org-mobile-departments .org-mobile-item::before {
        content: '';
        position: absolute;
        left: -20px;
        top: 50%;
        width: 20px;
        height: 2px;
        background: #0F4B91;
        transform: translateY(-50%);
    }
    
    .page-title {
        font-size: 1.3rem;
        padding: 0 15px;
        margin-bottom: 30px;
    }
    
    .organigrama-section {
        padding: 40px 15px;
    }
    
    /* Mobile Project Units Styles */
    .org-mobile-projects {
        margin: 20px 0;
        padding: 20px;
        background: #f0f8ff;
        border-radius: 8px;
        border: 1px solid #1E5BA8;
    }
    
    .org-mobile-section-title {
        font-size: 16px;
        font-weight: 600;
        color: #0F4B91;
        margin-bottom: 15px;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .org-mobile-item--project .org-mobile-box {
        background: #e8f4f8;
        border-color: #1E5BA8;
    }
    
    .org-mobile-item--project .org-mobile-title {
        color: #0F4B91;
        font-weight: 600;
        text-align: center;
    }
    
    .org-mobile-box--project {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .org-mobile-box {
        padding: 12px 15px;
        flex-wrap: wrap;
    }
    
    .org-mobile-title {
        font-size: 13px;
    }
    
    .org-mobile-number {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .page-title {
        font-size: 1.1rem;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .org-connector,
    .org-box {
        animation: none !important;
        opacity: 1 !important;
    }
}

/* Print Styles */
@media print {
    .organigrama-section {
        background: white;
    }
    
    .org-box,
    .org-mobile-box {
        box-shadow: none;
        border: 1px solid #333;
    }
    
    .org-mobile {
        display: block;
    }
    
    .org-chart {
        display: none;
    }
}