/* ======================================================================
   CIO Framework Hierarchy – Elementor Widget  (Premium UI v2)
   ====================================================================== */

/* ── Reset & Container ── */
.cfw-wrap {
    --cfw-accent: #00c8ff;
    --cfw-accent-dim: rgba(0,200,255,0.12);
    --cfw-bg: #0b0b1a;
    --cfw-card-bg: #12122a;
    --cfw-radius: 16px;
    --cfw-transition: 0.4s cubic-bezier(.22,.68,0,1.1);
    background: var(--cfw-bg);
    color: #fff;
    font-family: inherit;
    padding: 48px 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}
.cfw-wrap *, .cfw-wrap *::before, .cfw-wrap *::after { box-sizing: border-box; }
.cfw-wrap a { text-decoration: none; color: inherit; }

/* Ambient background glow */
.cfw-wrap::before {
    content: '';
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,200,255,0.06) 0%, transparent 70%);
    top: -180px;
    left: -120px;
    pointer-events: none;
}
.cfw-wrap::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(100,60,255,0.05) 0%, transparent 70%);
    bottom: -140px;
    right: -80px;
    pointer-events: none;
}

/* ── Section Header ── */
.cfw-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 32px;
    margin-bottom: 36px;
    position: relative;
    z-index: 1;
}
.cfw-section-header h2 {
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    letter-spacing: -0.3px;
}
.cfw-title-accent {
    color: var(--cfw-accent);
}
.cfw-section-desc {
    color: rgba(255,255,255,0.55);
    font-size: 15px;
    line-height: 1.7;
    margin: 0;
    flex: 1 1 400px;
    max-width: 520px;
}
.cfw-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cfw-accent);
    color: #000;
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
    transition: background var(--cfw-transition), transform var(--cfw-transition), box-shadow 0.3s ease;
}
.cfw-plus:hover {
    background: #fff;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 0 18px rgba(0,200,255,0.35);
}

/* ── Layout ── */
.cfw-layout {
    display: flex;
    gap: 28px;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

/* ── Parent card (left) ── */
.cfw-parent-card {
    flex-shrink: 0;
    width: 320px;
    display: block;
    border-radius: var(--cfw-radius);
    overflow: hidden;
    position: relative;
    transition: transform var(--cfw-transition), box-shadow var(--cfw-transition);
}
.cfw-parent-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0,200,255,0.10), 0 4px 16px rgba(0,0,0,0.4);
}
.cfw-parent-banner {
    width: 100%;
    height: 100%;
    background: var(--cfw-card-bg);
    border: 1px solid var(--cfw-accent-dim);
    border-radius: var(--cfw-radius);
    overflow: hidden;
    position: relative;
}
.cfw-parent-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(.22,.68,0,1.1);
}
.cfw-parent-card:hover .cfw-parent-banner img {
    transform: scale(1.04);
}

/* Placeholder body */
.cfw-placeholder-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--cfw-accent);
    opacity: 0.18;
}
.cfw-placeholder-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--cfw-accent);
    opacity: 0.18;
}

/* ── Children grid ── */
.cfw-children {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    flex: 1;
    min-width: 0;
}
.cfw-card {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Card image block */
.cfw-card-link {
    display: block;
    border-radius: var(--cfw-radius);
    overflow: hidden;
    position: relative;
}
.cfw-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--cfw-radius);
    overflow: hidden;
    background: var(--cfw-card-bg);
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}
.cfw-card:hover .cfw-card-img {
    border-color: rgba(0,200,255,0.25);
    box-shadow: 0 8px 30px rgba(0,200,255,0.08), 0 2px 8px rgba(0,0,0,0.3);
}
.cfw-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(.22,.68,0,1.1);
}
.cfw-card:hover .cfw-card-img img {
    transform: scale(1.06);
}

/* Gradient overlay on child card image */
.cfw-card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.1) 40%, transparent 100%);
    pointer-events: none;
    border-radius: var(--cfw-radius);
    z-index: 1;
}

/* Child name overlay on image */
.cfw-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 14px 12px;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}
.cfw-card-overlay-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.cfw-card-overlay-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cfw-accent);
    color: #000;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.cfw-card:hover .cfw-card-overlay-plus {
    opacity: 1;
    transform: scale(1);
}
.cfw-card-overlay-plus:hover {
    background: #fff;
}



/* ── Toggle ── */
.cfw-toggle {
    padding: 4px 0 0;
}
.cfw-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    color: var(--cfw-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 14px;
    width: 100%;
    text-align: left;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    letter-spacing: 0.2px;
}
.cfw-toggle-btn:hover {
    background: rgba(0,200,255,0.08);
    border-color: rgba(0,200,255,0.2);
    color: #fff;
}
.cfw-toggle-btn:focus-visible {
    outline: 2px solid var(--cfw-accent);
    outline-offset: 2px;
}
.cfw-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,200,255,0.15);
    color: var(--cfw-accent);
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 6px;
    margin-left: auto;
}
.cfw-arrow {
    transition: transform 0.35s cubic-bezier(.22,.68,0,1.1);
    flex-shrink: 0;
    opacity: 0.7;
}
.cfw-btn-open .cfw-arrow {
    transform: rotate(180deg);
    opacity: 1;
}
.cfw-btn-open {
    background: rgba(0,200,255,0.08);
    border-color: rgba(0,200,255,0.18);
}

/* Grandchildren list */
.cfw-children-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
        max-height 0.45s cubic-bezier(.22,.68,0,1.1),
        opacity 0.35s ease,
        padding 0.35s ease;
}
.cfw-children-list.cfw-list-open {
    max-height: 600px;
    opacity: 1;
    padding: 8px 0 4px;
}
.cfw-children-list li {
    margin-bottom: 2px;
}
.cfw-children-list li a {
    color: rgba(255,255,255,0.72);
    font-size: 13px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    transition: color 0.2s ease, background 0.2s ease, padding-left 0.2s ease;
    line-height: 1.35;
    border-radius: 8px;
}
.cfw-children-list li a::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cfw-accent);
    opacity: 0.4;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.cfw-children-list li a:hover {
    color: #fff;
    background: rgba(0,200,255,0.06);
    padding-left: 16px;
}
.cfw-children-list li a:hover::before {
    opacity: 1;
    transform: scale(1.4);
}
.cfw-has-children {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--cfw-accent);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    margin-left: auto;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .cfw-layout {
        flex-direction: column;
    }
    .cfw-parent-card {
        width: 100%;
        max-width: 440px;
    }
    .cfw-parent-banner { height: auto; }
    .cfw-parent-banner img { height: auto; }
    .cfw-children {
        flex-wrap: wrap;
    }
    .cfw-card {
        flex: 1 1 calc(50% - 10px);
        min-width: 180px;
    }
}

@media (max-width: 768px) {
    .cfw-wrap { padding: 32px 0; }
    .cfw-section-header h2 { font-size: 26px; }
    .cfw-section-desc { flex: 1 1 100%; }
    .cfw-children { gap: 14px; }
    .cfw-parent-card { max-width: 100%; }
    .cfw-card { flex: 1 1 calc(50% - 7px); min-width: 150px; }
}

@media (max-width: 480px) {
    .cfw-wrap { padding: 24px 0; }
    .cfw-section-header h2 { font-size: 22px; }
    .cfw-layout { gap: 18px; }
    .cfw-children { flex-direction: column; gap: 14px; }
    .cfw-card { flex: 1 1 100%; }
    .cfw-card-img { aspect-ratio: 16 / 9; }
}
