/* Org chart */

.org-bento {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0;
    text-align: center;
}

/* Controls */
.org-bento__controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.org-bento__ctrl-btn {
    padding: 6px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    color: #4a5568;
    font-family: ProbaPro, sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.org-bento__ctrl-btn:hover {
    background: #2d5ca6;
    color: #fff;
    border-color: #2d5ca6;
}

/* --- Top row: [Deputy] --- [BOSS] --- [Deputy] --- */
.org-bento__level1 {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
}

.org-bento__boss {
    flex-shrink: 0;
}

.org-bento__deputy {
    flex: 1;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
}

/* --- Person card (shared style for boss + deputies) --- */
.org-bento__person-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 24px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    width: 280px;
}

a.org-bento__person-card:hover {
    box-shadow: 0 6px 20px rgba(45,92,166,0.15);
    transform: translateY(-3px);
    border-color: #2d5ca6;
}

/* Photo */
.org-bento__person-photo {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    object-fit: cover;
    object-position: center top;
    border: 3px solid #e2e8f0 !important;
    display: inline-block !important;
}

/* Boss: slightly larger */
.org-bento__person-photo--boss {
    width: 100px !important;
    height: 100px !important;
}

.org-bento__person-card--boss {
    padding: 20px 24px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #e2e8f0;
    width: 280px;
}

.org-bento__person-title {
    font-family: ProbaPro, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #1a202c !important;
    line-height: 1.3;
}

.org-bento__person-card--boss .org-bento__person-title {
    font-size: 18px;
}

.org-bento__person-name {
    font-family: ProbaPro, sans-serif;
    font-size: 13px;
    color: #2d5ca6 !important;
    font-weight: 600;
}

.org-bento__person-card--boss .org-bento__person-name {
    font-size: 14px;
}

/* --- Deputy expand toggle (below person card) --- */
.org-bento__toggle--below {
    margin-top: 10px;
}

/* Full-width expandable panel below cards */
.org-bento__panel {
    margin-top: 16px;
    padding: 20px 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: left;
    animation: orgFadeIn 0.25s ease;
}

.org-bento__panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.org-bento__panel-item {
    padding: 16px 18px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

/* Color stripe at top of card */
.org-bento__panel-item::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2d5ca6, #5b8fd9);
}

/* Items without sub-items get a softer color */
.org-bento__panel-item:not(:has(.org-bento__panel-sub))::after {
    background: linear-gradient(90deg, #94a3b8, #cbd5e0);
}

.org-bento__panel-title {
    font-family: ProbaPro, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f2f5;
    line-height: 1.3;
}

/* Items without sub-list: no bottom border on title */
.org-bento__panel-item:not(:has(.org-bento__panel-sub)) .org-bento__panel-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.org-bento__panel-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.org-bento__panel-sub > li {
    padding: 8px 12px;
    font-size: 13px;
    color: #2d3748;
    font-family: ProbaPro, sans-serif;
    border-radius: 8px;
    transition: all 0.15s ease;
    position: relative;
    padding-left: 28px;
    line-height: 1.4;
}

.org-bento__panel-sub > li::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 15px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2d5ca6;
    opacity: 0.4;
    transition: all 0.15s ease;
}

.org-bento__panel-sub > li:hover {
    background: #f0f4ff;
}

.org-bento__panel-sub > li:hover::before {
    opacity: 1;
    transform: scale(1.3);
}

/* Nested sub-items (level 3) */
.org-bento__panel-sub ul {
    list-style: none;
    padding: 0;
    margin: 6px 0 2px 16px;
}

.org-bento__panel-sub ul li {
    font-size: 12px;
    color: #64748b;
    padding: 5px 10px 5px 22px;
    position: relative;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.org-bento__panel-sub ul li::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.15s ease;
}

.org-bento__panel-sub ul li:hover {
    background: #f8fafc;
    color: #2d3748;
}

.org-bento__panel-sub ul li:hover::before {
    background: #2d5ca6;
}

/* Active card highlight with glow */
.org-bento__person-card--active {
    border-color: #2d5ca6;
    box-shadow: 0 4px 20px rgba(45,92,166,0.2), 0 0 0 3px rgba(45,92,166,0.08);
}

/* Pulse animation on photo when card is active */
.org-bento__person-card--active .org-bento__person-photo {
    animation: orgPulseRing 2s ease-in-out infinite;
}

@keyframes orgPulseRing {
    0%, 100% { box-shadow: 0 0 0 0 rgba(45,92,166,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(45,92,166,0); }
}

/* Staggered fade-in for panel items */
.org-bento__panel-item {
    animation: orgItemSlide 0.3s ease both;
}

.org-bento__panel-item:nth-child(1) { animation-delay: 0s; }
.org-bento__panel-item:nth-child(2) { animation-delay: 0.05s; }
.org-bento__panel-item:nth-child(3) { animation-delay: 0.1s; }
.org-bento__panel-item:nth-child(4) { animation-delay: 0.15s; }
.org-bento__panel-item:nth-child(5) { animation-delay: 0.2s; }

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

/* Hover lift on panel items */
.org-bento__panel-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.org-bento__panel-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(45,92,166,0.1);
}

/* Smooth scale on person card hover */
.org-bento__person-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.org-bento__person-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* Photo zoom on hover */
.org-bento__person-photo {
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.org-bento__person-card:hover .org-bento__person-photo {
    transform: scale(1.08);
    border-color: #2d5ca6 !important;
}

/* Panel slide-up entrance */
.org-bento__panel {
    animation: orgPanelUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Gradient accent line on panel top */
.org-bento__panel::before {
    content: "";
    display: block;
    height: 3px;
    margin: -20px -24px 16px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, #2d5ca6, #5b8fd9, #2d5ca6);
    background-size: 200% 100%;
    animation: orgGradientShift 3s ease infinite;
}

@keyframes orgGradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Sub-list items cascade */
.org-bento__panel-sub li {
    animation: orgItemSlide 0.2s ease both;
}

.org-bento__panel-sub li:nth-child(1) { animation-delay: 0.1s; }
.org-bento__panel-sub li:nth-child(2) { animation-delay: 0.15s; }
.org-bento__panel-sub li:nth-child(3) { animation-delay: 0.2s; }
.org-bento__panel-sub li:nth-child(4) { animation-delay: 0.25s; }
.org-bento__panel-sub li:nth-child(5) { animation-delay: 0.3s; }
.org-bento__panel-sub li:nth-child(n+6) { animation-delay: 0.35s; }

/* Hint text bounce on hover */
.org-bento__hint {
    transition: color 0.2s ease;
}

.org-bento__person-card:hover .org-bento__hint {
    color: #2d5ca6;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01s !important;
        transition-duration: 0.01s !important;
    }
}

/* Hint text (+ 2, + підрозділи) */
.org-bento__hint {
    font-size: 12px;
    color: #718096;
    font-family: ProbaPro, sans-serif;
}

/* --- Connector (hidden) --- */
.org-bento__connector-v {
    display: none;
}

/* --- Toggle button --- */
.org-bento__toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    background: #f7f9fc;
    color: #2d5ca6;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.org-bento__toggle:hover {
    background: #2d5ca6;
    color: #fff;
    border-color: #2d5ca6;
}

.org-bento__toggle-icon { font-size: 15px; font-weight: 700; }
.org-bento__toggle-count { font-size: 12px; }

/* --- Department card (bottom grid) --- */
.org-bento__card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.org-bento__card:hover {
    box-shadow: 0 4px 16px rgba(45,92,166,0.12);
    border-color: #2d5ca6;
    transform: translateY(-2px);
}

.org-bento__card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.org-bento__card-text { flex: 1; min-width: 0; }

.org-bento__card-title {
    font-family: ProbaPro, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
}

/* --- Lists --- */
.org-bento__list {
    list-style: none;
    margin: 10px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid #eef1f6;
    animation: orgFadeIn 0.2s ease;
}

@keyframes orgFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.org-bento__list-item {
    padding: 5px 0 5px 16px;
    position: relative;
    font-family: ProbaPro, sans-serif;
    font-size: 13px;
    color: #2d3748;
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.org-bento__list-item::before {
    content: "";
    position: absolute;
    left: 0; top: 13px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #cbd5e0;
}

.org-bento__list-item--parent::before { background: #2d5ca6; }
.org-bento__list-title { flex: 1; min-width: 0; }

.org-bento__sub-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border: 1.5px solid #cbd5e0;
    border-radius: 50%;
    background: #fff;
    color: #2d5ca6;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.org-bento__sub-toggle:hover {
    background: #2d5ca6;
    color: #fff;
    border-color: #2d5ca6;
}

.org-bento__sublist {
    list-style: none;
    margin: 6px 0 4px 20px;
    padding: 0;
    width: 100%;
    animation: orgFadeIn 0.2s ease;
}

.org-bento__sublist li {
    padding: 4px 0 4px 14px;
    font-size: 12px;
    color: #4a5568;
    position: relative;
}

.org-bento__sublist li::before {
    content: "";
    position: absolute;
    left: 0; top: 11px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #a0aec0;
}

/* --- Bottom grid --- */
.org-bento__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding-top: 14px;
    text-align: left;
}

/* Grid animation */
.org-bento__grid-wrap {
    animation: orgFadeIn 0.25s ease;
}

/* --- Mobile --- */
@media (max-width: 767px) {
    .org-bento { padding: 12px 0; }
    .org-bento__level1 { flex-direction: column; align-items: center; gap: 16px; }
    .org-bento__boss { order: -1; }
    .org-bento__deputy { max-width: 100%; padding-top: 0; }
    .org-bento__person-card { width: 100% !important; padding: 14px 16px 12px; }
    .org-bento__person-photo { width: 60px !important; height: 60px !important; }
    .org-bento__person-photo--boss { width: 72px !important; height: 72px !important; }
    .org-bento__person-title { font-size: 14px; }
    .org-bento__person-card--boss .org-bento__person-title { font-size: 15px; }
    .org-bento__grid { grid-template-columns: 1fr !important; }
    .org-bento__grid::before { display: none; }
    .org-bento__grid > .org-bento__card::before { display: none; }
}
