/**
 * EB Mindmap Widget Styles
 *
 * Horizontal mindmap layout with central node and left/right branches,
 * each branch having sub-items (leaves) connected by lines.
 *
 * @package EB_Global_Widgets
 */

.eb-mindmap {
    padding: 60px 20px;
    overflow-x: auto;
}

.eb-mindmap__container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    min-width: 900px;
    position: relative;
}

/* Central Node */
.eb-mindmap__central {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 32px;
    background: #1E1B4B;
    color: #FFFFFF;
    border-radius: 12px;
    min-width: 160px;
    max-width: 220px;
    box-shadow: 0 8px 32px rgba(30, 27, 75, 0.2);
    z-index: 10;
    position: relative;
}
.eb-mindmap__central-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eb-mindmap__central-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.eb-mindmap__central-image {
    max-width: 48px;
    height: auto;
    margin-bottom: 8px;
}

.eb-mindmap__central-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: inherit;
}

.eb-mindmap__central-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 400;
    margin: 4px 0 0;
    opacity: 0.8;
    color: inherit;
}

/* Sides */
.eb-mindmap__side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.eb-mindmap__side--left {
    align-items: flex-end;
}

.eb-mindmap__side--right {
    align-items: flex-start;
}

/* SVG Connectors overlay */
.eb-mindmap__connectors {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.eb-mindmap__connectors path {
    fill: none;
    stroke: #E5E7EB;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Branch Row */
.eb-mindmap__branch {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.eb-mindmap__branch--left {
    flex-direction: row;
}

.eb-mindmap__branch--right {
    flex-direction: row;
}

/* Branch Node (the main label) */
.eb-mindmap__branch-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #E5E7EB;
    white-space: nowrap;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.eb-mindmap__branch-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.eb-mindmap__branch-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eb-mindmap__branch-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.eb-mindmap__branch-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.eb-mindmap__branch-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1E1B4B;
    line-height: 1.3;
}

.eb-mindmap__branch-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #6B7280;
    line-height: 1.2;
}

/* Branch Connector (line between node and central/leaves) */
.eb-mindmap__branch-connector {
    width: 40px;
    height: 2px;
    background: #E5E7EB;
    flex-shrink: 0;
}

/* Leaves (sub-items) */
.eb-mindmap__leaves {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.eb-mindmap__leaves--left {
    align-items: flex-end;
}

.eb-mindmap__leaves--right {
    align-items: flex-start;
}

.eb-mindmap__leaf {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #4B5563;
    padding: 6px 12px;
    background: #F8FAFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.eb-mindmap__leaf:hover {
    background: #FFFFFF;
    border-color: #B09360;
    color: #1E1B4B;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(176, 147, 96, 0.15);
}

.eb-mindmap__leaves--left .eb-mindmap__leaf:hover {
    transform: translateX(-2px);
}

/* Animation */
.eb-mindmap[data-animate="true"] .eb-mindmap__central {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.eb-mindmap[data-animate="true"].animated .eb-mindmap__central {
    opacity: 1;
    transform: scale(1);
}

.eb-mindmap[data-animate="true"] .eb-mindmap__branch {
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.eb-mindmap[data-animate="true"] .eb-mindmap__branch--left {
    transform: translateX(30px);
}

.eb-mindmap[data-animate="true"] .eb-mindmap__branch--right {
    transform: translateX(-30px);
}

.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger animation for branches */
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(1) { transition-delay: 0.2s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(2) { transition-delay: 0.35s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(3) { transition-delay: 0.5s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(4) { transition-delay: 0.65s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(5) { transition-delay: 0.8s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(6) { transition-delay: 0.95s; }

/* Leaves animation */
.eb-mindmap[data-animate="true"] .eb-mindmap__leaf {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.eb-mindmap[data-animate="true"] .eb-mindmap__leaves--left .eb-mindmap__leaf {
    transform: translateX(10px);
}

.eb-mindmap[data-animate="true"] .eb-mindmap__leaves--right .eb-mindmap__leaf {
    transform: translateX(-10px);
}

.eb-mindmap[data-animate="true"].animated .eb-mindmap__leaf {
    opacity: 1;
    transform: translateX(0);
}

.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(1) .eb-mindmap__leaf:nth-child(1) { transition-delay: 0.4s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(1) .eb-mindmap__leaf:nth-child(2) { transition-delay: 0.45s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(1) .eb-mindmap__leaf:nth-child(3) { transition-delay: 0.5s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(1) .eb-mindmap__leaf:nth-child(4) { transition-delay: 0.55s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(2) .eb-mindmap__leaf:nth-child(1) { transition-delay: 0.55s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(2) .eb-mindmap__leaf:nth-child(2) { transition-delay: 0.6s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(2) .eb-mindmap__leaf:nth-child(3) { transition-delay: 0.65s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(2) .eb-mindmap__leaf:nth-child(4) { transition-delay: 0.7s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(3) .eb-mindmap__leaf:nth-child(1) { transition-delay: 0.7s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(3) .eb-mindmap__leaf:nth-child(2) { transition-delay: 0.75s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(3) .eb-mindmap__leaf:nth-child(3) { transition-delay: 0.8s; }
.eb-mindmap[data-animate="true"].animated .eb-mindmap__branch:nth-child(3) .eb-mindmap__leaf:nth-child(4) { transition-delay: 0.85s; }

/* Layout mode adjustments */
.eb-mindmap[data-layout="right-only"] .eb-mindmap__container {
    justify-content: flex-start;
}

.eb-mindmap[data-layout="left-only"] .eb-mindmap__container {
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 1024px) {
    .eb-mindmap__container {
        min-width: 700px;
    }

    .eb-mindmap__branch-connector {
        width: 24px;
    }

    .eb-mindmap__branch-node {
        padding: 10px 12px;
    }

    .eb-mindmap__branch-title {
        font-size: 12px;
    }

    .eb-mindmap__leaf {
        font-size: 11px;
        padding: 5px 10px;
    }
}

@media (max-width: 768px) {
    .eb-mindmap__container {
        flex-direction: column;
        min-width: unset;
        gap: 16px;
    }

    .eb-mindmap__side {
        width: 100%;
    }

    .eb-mindmap__side--left,
    .eb-mindmap__side--right {
        align-items: stretch;
    }

    .eb-mindmap__side--left::after,
    .eb-mindmap__side--right::before {
        display: none;
    }

    .eb-mindmap__central::before,
    .eb-mindmap__central::after {
        display: none;
    }

    .eb-mindmap__branch--left::after,
    .eb-mindmap__branch--right::before {
        display: none;
    }

    .eb-mindmap__connectors {
        display: none;
    }
    .eb-mindmap__branch,
    .eb-mindmap__branch--left {
        flex-direction: row;
    }

    .eb-mindmap__leaves--left {
        align-items: flex-start;
    }

    .eb-mindmap__branch-connector {
        width: 20px;
    }

    .eb-mindmap__central {
        min-width: unset;
        max-width: 100%;
        width: 100%;
    }

    .eb-mindmap[data-animate="true"] .eb-mindmap__branch--left,
    .eb-mindmap[data-animate="true"] .eb-mindmap__branch--right {
        transform: translateY(20px);
    }

    .eb-mindmap[data-animate="true"].animated .eb-mindmap__branch--left,
    .eb-mindmap[data-animate="true"].animated .eb-mindmap__branch--right {
        transform: translateY(0);
    }
}
