/* Modern Flat & Grid Based Org Structure */
.new-org-structure {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Tajawal', sans-serif;
    padding: 20px;
}

/* Connectors */
.org-connector {
    background-color: #cbd5e1;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.org-connector.vertical {
    width: 4px;
    height: 40px;
    border-radius: 2px;
}

.org-connector.split {
    width: 4px;
    height: 40px;
    border-radius: 2px;
}
.org-connector.split::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 66%; /* spans across the branches */
    height: 4px;
    background-color: #cbd5e1;
    border-radius: 2px;
    z-index: -1;
}

@media (max-width: 992px) {
    .org-connector.split::before {
        display: none; /* Hide horizontal split on mobile */
    }
}

/* Top Level */
.org-level.top-level {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.org-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 25px 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-bottom: 4px solid var(--accent-color, #caa64b);
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
    min-width: 250px;
}

.org-card.premium {
    background: linear-gradient(135deg, var(--primary-color, #0b3c5d), var(--secondary-color, #137ba3));
    color: white;
    border-bottom: none;
    box-shadow: 0 15px 35px rgba(11, 60, 93, 0.2);
}

.org-card.premium::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.org-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--accent-color, #caa64b);
    transition: transform 0.3s ease;
}

.org-card.premium .card-icon {
    color: #ffd700;
}

.org-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.org-card h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.org-card p {
    font-size: 0.95rem;
    opacity: 0.8;
    margin: 0;
}

/* Three Columns Level */
.org-level.three-columns {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 992px) {
    .org-level.three-columns {
        grid-template-columns: 1fr;
    }
}

/* Branch */
.org-branch {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: transform 0.4s ease;
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

.org-branch:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.org-branch-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 30px 20px;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.org-branch-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-color, #caa64b);
}

.main-branch .org-branch-header::before {
    background: var(--secondary-color, #137ba3);
}

.org-branch-header .card-icon {
    font-size: 2rem;
    color: var(--primary-color, #0b3c5d);
    margin-bottom: 10px;
}

.org-branch-header h3 {
    font-size: 1.25rem;
    color: var(--primary-color, #0b3c5d);
    font-weight: 800;
}

.org-branch-header p {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 5px;
}

.org-branch-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    background: white;
}

.org-branch-body.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 576px) {
    .org-branch-body.grid-2 {
        grid-template-columns: 1fr;
    }
}

.org-item {
    background: #f8fafc;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.org-item:hover {
    background: var(--primary-color, #0b3c5d);
    color: white;
    border-color: var(--primary-color, #0b3c5d);
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(11, 60, 93, 0.15);
}

/* Fix connector line for LTR and RTL */
[dir="rtl"] .org-connector.split::before {
    /* works in both directions due to translate(-50%, -50%) */
}
