/* BIDA BEE Downline Tree Viewer Styles */

.bida-bee-downline-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.bida-error {
    background: #fee;
    border-left: 4px solid #c33;
    padding: 15px 20px;
    border-radius: 4px;
    color: #c33;
    margin: 20px 0;
}

/* Header */
.downline-header {
    margin-bottom: 30px;
}

.downline-header h2 {
    font-size: 32px;
    color: #1a1a1a;
    margin-bottom: 20px;
    text-align: center;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #ffb800;
    color: #1a1a1a;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 184, 0, 0.4);
}

.stat-value {
    font-size: 48px;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Tree Controls */
.tree-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.btn-control {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #90ff56;
    color: #73cc44;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-control:hover {
    background: #90ff56;
    color: white;
}

/* Tree Container */
.tree-container {
    background: transparent;
    border-radius: 12px;
    padding: 30px;
    overflow-x: auto;
}

.bee-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bee-tree ul {
    list-style: none;
    padding-left: 60px;
    margin: 15px 0;
    position: relative;
}

/* Connecting Lines */
.bee-tree ul::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 30px;
    width: 2px;
    height: calc(100% + 15px);
    background: #d1d5db;
}

.bee-tree li {
    position: relative;
    padding: 10px 0;
}

.bee-tree li::before {
    content: '';
    position: absolute;
    top: 35px;
    left: -30px;
    width: 30px;
    height: 2px;
    background: #d1d5db;
}

.bee-tree li:last-child::after {
    content: '';
    position: absolute;
    top: 35px;
    left: -30px;
    width: 2px;
    height: calc(100% - 35px);
    background: transparent;
}

/* BEE Card */
.bee-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    position: relative;
    max-width: 450px;
    border-left: 4px solid #90ff56;
}

.bee-card:hover {
    box-shadow: 0 4px 16px rgba(144, 255, 86, 0.3);
    transform: translateY(-2px);
}

.bee-card.root-bee {
    border-left-color: #f59e0b;
    background: linear-gradient(to right, #fffbeb 0%, white 10%);
}

/* Avatar */
.bee-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #90ff56 0%, #73cc44 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.root-bee .bee-avatar {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    width: 60px;
    height: 60px;
    font-size: 22px;
}

/* BEE Info */
.bee-info {
    flex: 1;
    min-width: 0;
}

.bee-name {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 600;
}

.bee-code {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #6b7280;
    font-family: 'Courier New', monospace;
}

.bee-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.bee-stats .stat {
    font-size: 12px;
    color: #6b7280;
}

.bee-stats .stat strong {
    color: #73cc44;
    font-weight: 700;
}

.bee-stats .stat.level {
    background: #90ff56;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

/* Toggle Button */
.toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #90ff56;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.toggle-btn:hover {
    background: #73cc44;
    transform: scale(1.1);
}

.toggle-btn .arrow {
    transition: transform 0.3s;
    font-size: 12px;
}

/* Collapsed State */
.bee-tree li.collapsed > ul {
    display: none;
}

.bee-tree li.collapsed .toggle-btn .arrow {
    transform: rotate(-90deg);
}

/* Empty State */
.bee-card.no-children {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .bida-bee-downline-container {
        padding: 15px 10px;
    }
    
    .downline-header h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 20px 15px;
    }
    
    .stat-value {
        font-size: 32px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .tree-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-control {
        width: 100%;
        padding: 12px;
        font-size: 15px;
    }
    
    .tree-container {
        padding: 15px 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .bee-tree ul {
        padding-left: 40px;
        margin: 10px 0;
    }
    
    .bee-tree ul::before {
        left: 20px;
        top: -10px;
        height: calc(100% + 10px);
    }
    
    .bee-tree li {
        padding: 8px 0;
    }
    
    .bee-tree li::before {
        left: -20px;
        width: 20px;
        top: 30px;
    }
    
    .bee-tree li:last-child::after {
        left: -20px;
        top: 30px;
        height: calc(100% - 30px);
    }
    
    .bee-card {
        max-width: 100%;
        padding: 12px 15px;
        gap: 12px;
        font-size: 14px;
    }
    
    .bee-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .root-bee .bee-avatar {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .bee-name {
        font-size: 15px;
    }
    
    .bee-code {
        font-size: 11px;
    }
    
    .bee-stats {
        gap: 10px;
        font-size: 11px;
    }
    
    .bee-stats .stat.level {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .toggle-btn {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }
}

/* Extra small devices (phones < 375px) */
@media (max-width: 375px) {
    .bida-bee-downline-container {
        padding: 10px 5px;
    }
    
    .downline-header h2 {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .bee-card {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .bee-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .root-bee .bee-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .bee-name {
        font-size: 14px;
    }
    
    .bee-code {
        font-size: 10px;
    }
    
    .bee-stats {
        font-size: 10px;
        gap: 8px;
    }
    
    .bee-tree ul {
        padding-left: 35px;
        margin: 8px 0;
    }
    
    .bee-tree ul::before {
        left: 18px;
        top: -8px;
        height: calc(100% + 8px);
    }
    
    .bee-tree li {
        padding: 6px 0;
    }
    
    .bee-tree li::before {
        left: -17px;
        width: 17px;
        top: 28px;
    }
    
    .bee-tree li:last-child::after {
        left: -17px;
        top: 28px;
        height: calc(100% - 28px);
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-tree {
    animation: pulse 1.5s ease-in-out infinite;
}
