/* ==========================================
 * DECISION TREE SECTION STYLES
 * ========================================== */

.decision-tree-section {
    padding: 4rem 0;
    /* background: var(--darker-bg); */
    position: relative;
}

/* Tab Container */
.tab-container {
    width: 100%;
    /* background: var(--primary-color); */
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0;
    margin-bottom: 2rem;
    border-radius: 10px;
}

.tabs {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 20px;
    background: transparent;
    border: 1px solid transparent;
}

.tab-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.tab-link.active {
    background: var(--secondary-color);
    color: var(--text-primary);
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    border-color: var(--secondary-color);
}

/* Content Block (Intro) */
.content-block {
    position: relative;
    width: 100%;
    max-width: 960px;
    margin: 0 auto 2rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.content-block #intro-text {
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease;
    max-height: 1000px;
    padding-bottom: 2rem;
    color: var(--text-secondary);
}

.content-block.collapsed {
    padding: 0.5rem 2rem;
}

.content-block.collapsed #intro-text {
    max-height: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.content-block #intro-title {
    display: none;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0;
}

.content-block.collapsed #intro-title {
    display: block;
}

.expand-button-tree {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(140, 159, 241, 0.3);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
    transition: all 0.2s ease;
    z-index: 3;
}

.expand-button-tree:hover {
    background: rgba(140, 159, 241, 0.5);
    transform: scale(1.1);
}

/* Path Navigation */
.path-nav-tree {
    display: flex;
    justify-content: center;
    margin: 0 0 2rem 0;
    flex-wrap: wrap;
    background: rgba(140, 159, 241, 0.1);
    padding: 0.75rem;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.path-item {
    background: rgba(140, 159, 241, 0.2);
    color: var(--text-primary);
    padding: 0.5rem 1.2rem;
    margin: 0 0.25rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    border: 1px solid rgba(140, 159, 241, 0.3);
}

.path-item:hover {
    background: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(140, 159, 241, 0.3);
}

.path-item::after {
    content: "›";
    margin-left: 0.5rem;
    font-size: 1.2rem;
}

.path-item:last-child::after {
    content: "";
}

/* Tree Container */
.tree {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
}

.level {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
    position: relative;
    width: 100%;
    opacity: 1;
    transform: translateY(0);
    gap: 20px;
    padding: 0 10px;
}

/* Tiles */
.tile {
    /* background: linear-gradient(135deg, var(--primary-color), rgba(140, 159, 241, 0.8)); */
    border-radius: 15px;
    padding: 2rem;
    width: 280px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tile::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 50%);
    pointer-events: none;
}

.tile.size-small {
    width: 220px;
    min-height: 150px;
    padding: 1.5rem;
}

.tile.size-medium {
    width: 280px;
    min-height: 180px;
}

.tile.size-large {
    width: 350px;
    min-height: 200px;
}

.tile.size-xlarge {
    width: 450px;
    min-height: 250px;
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(140, 159, 241, 0.4);
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--secondary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tile:hover::before {
    transform: scaleX(1);
}

.tile.leaf {
    background: linear-gradient(135deg, var(--secondary-color), rgba(139, 92, 246, 0.8));
}

.tile.leaf:hover {
    transform: translateY(-3px);
}

/* Boolean Tiles */
.tile.tile-boolean {
    background: linear-gradient(135deg, #442850, #372041);
}

.tile.tile-boolean:hover {
    background: #4D4D4D;
    transform: translateY(-5px);
}

.boolean-options {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
    width: 100%;
    justify-content: center;
}

.boolean-option {
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    border: none;
    color: var(--text-primary);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.boolean-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.boolean-option-yes {
    background: linear-gradient(135deg, #27ae60, #219653);
}

.boolean-option-no {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

/* Tile Content */
.tile-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    opacity: 0.9;
    z-index: 2;
}

.tile-title {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.8rem;
    z-index: 2;
}

.tile-description {
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.9;
    max-width: 100%;
    z-index: 2;
}

.tile-content {
    margin-top: 1rem;
    width: 100%;
    display: none;
    overflow: hidden;
    transition: max-height 0.5s ease;
    max-height: 0;
}

.tile.expanded {
    min-height: auto;
}

.tile.expanded .tile-content {
    display: block;
    max-height: 600px;
    opacity: 1;
}

.tile-details {
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: left;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
}

.tile-details p {
    margin-bottom: 0.8rem;
}

.tile-details img {
    max-width: 100%;
    height: auto;
    margin: 0.8rem 0;
}

.tile-details ul {
    list-style-type: disc;
    margin-left: 1.5rem;
    padding-left: 0.5rem;
    margin-bottom: 1rem;
}

.tile-details li {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tile-details ul ul {
    margin-left: 1rem;
    margin-top: 0.5rem;
}

.tile-details h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Expand Button on Tiles */
.tile .expand-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 3;
}

.tile .expand-button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* SVG Connectors */
svg.connector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    transition: height 0.3s ease;
}

.connector-path {
    stroke: var(--primary-color);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 3px rgba(140, 159, 241, 0.3));
    fill: none;
}

/* Toggle Section Button */
.toggle-section-btn {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: auto;
}

.toggle-section-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Hidden Section */
.decision-tree-section.section-hidden .content-block,
.decision-tree-section.section-hidden .path-nav-tree,
.decision-tree-section.section-hidden .tree {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .level {
        flex-direction: column;
        align-items: center;
    }

    .path-nav-tree {
        flex-direction: column;
        align-items: center;
    }

    .path-item {
        margin: 0.25rem 0;
    }

    .tile.size-large,
    .tile.size-xlarge {
        width: 280px;
        min-height: 180px;
    }
}
