/* Reusable Components Styles */

/* Onboarding Tutorial */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
}

.onboarding-overlay.active {
    display: flex;
}

.onboarding-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.4s ease;
}

.onboarding-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
}

.onboarding-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-light);
}

.onboarding-step-dot.active {
    background: var(--primary);
}

.onboarding-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 20px;
    border: 2px solid var(--gray-light);
    border-radius: 20px;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-tab.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Avatar */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

.avatar-sm {
    width: 36px;
    height: 36px;
}

/* Referral Link */
.referral-box {
    background: var(--light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.referral-link {
    flex: 1;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.875rem;
    word-break: break-all;
}

.copy-btn {
    padding: 12px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-light);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: var(--dark);
    color: var(--white);
    text-align: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
}

/* Scroll to Top */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transition: var(--transition);
}

.scroll-top.show {
    display: flex;
}

.scroll-top:hover {
    background: var(--primary-dark);
    transform: translateY(-4px);
}

/* ============================================ */
/* PROFILE PAGE COMPONENTS */
/* ============================================ */

/* Profile Picture Container */
.profile-pic-container {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.profile-pic-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-pic-wrapper:hover {
    transform: translateY(-4px);
}

/* Default Avatar (CSS-only, no image file needed) */
.avatar-default {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #e2e8f0;
    transition: all 0.3s ease;
}

.avatar-default i {
    font-size: 4rem;
    color: #94a3b8;
}

.profile-pic-wrapper:hover .avatar-default {
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
}

/* Uploaded Profile Image */
.profile-pic-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    display: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.profile-pic-wrapper:hover .profile-pic-img {
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

/* Hover Overlay for Profile Picture */
.profile-pic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.profile-pic-wrapper:hover .profile-pic-overlay {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    color: white;
}

.overlay-content i {
    font-size: 2rem;
    display: block;
    margin-bottom: 4px;
}

.overlay-content span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Upload Hint Badge */
.upload-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 0.8125rem;
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: 16px;
}

.upload-hint i {
    color: var(--primary);
    font-size: 0.875rem;
}

/* Upload Progress Wrapper */
.upload-progress-wrapper {
    max-width: 300px;
    margin: 16px auto 0;
}

/* Sidebar Avatar Container */
.sidebar-avatar-container {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

/* Sidebar Default Avatar */
.sidebar-avatar-default {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #475569, #334155);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #64748b;
}

.sidebar-avatar-default i {
    font-size: 1.25rem;
    color: #94a3b8;
}

/* Sidebar Uploaded Avatar Image */
.sidebar-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #64748b;
    display: none;
}

/* ============================================ */
/* DASHBOARD WELCOME CARD */
/* ============================================ */

.welcome-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.welcome-card h2 {
    color: white;
    margin-bottom: 8px;
}

.welcome-card p {
    opacity: 0.9;
}

/* ============================================ */
/* EMPTY STATE COMPONENT */
/* ============================================ */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: #64748b;
}

.empty-state p {
    font-size: 0.9375rem;
    margin-bottom: 16px;
}

/* ============================================ */
/* UPGRADE CARD HIGHLIGHT */
/* ============================================ */

.upgrade-highlight {
    position: relative;
    border: 2px solid var(--warning);
    overflow: hidden;
}

.upgrade-highlight::before {
    content: 'RECOMMENDED';
    position: absolute;
    top: 16px;
    right: -30px;
    background: var(--warning);
    color: white;
    padding: 4px 40px;
    font-size: 0.75rem;
    font-weight: 700;
    transform: rotate(45deg);
    z-index: 1;
}

/* ============================================ */
/* BINARY TREE NODE STYLES */
/* ============================================ */

.tree-container {
    overflow-x: auto;
    padding: 40px 0;
}

.tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 600px;
}

.tree-level {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    position: relative;
}

.tree-node {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    min-width: 140px;
    position: relative;
    transition: all 0.3s ease;
}

.tree-node:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.tree-node.you {
    border-color: var(--primary);
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
}

.tree-node.active {
    border-color: var(--success);
    background: #f0fdf4;
}

.tree-node.inactive {
    opacity: 0.5;
}

.tree-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto 8px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-avatar i {
    font-size: 1.5rem;
    color: #94a3b8;
}

.tree-username {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.tree-status {
    font-size: 0.75rem;
}

/* ============================================ */
/* NOTIFICATION BADGE */
/* ============================================ */

.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-badge[data-count="0"]::after {
    display: none;
}

/* ============================================ */
/* INCOME ANIMATION */
/* ============================================ */

.income-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 4000;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.income-popup .amount {
    font-size: 3rem;
    font-weight: 800;
    color: var(--success);
    margin: 16px 0;
}

.income-popup .confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confettiFall 1s ease-in-out forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(200px) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================ */
/* MOBILE BOTTOM NAVIGATION */
/* ============================================ */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 8px 0;
}

.mobile-bottom-nav .nav-items {
    display: flex;
    justify-content: space-around;
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.75rem;
    padding: 8px;
    transition: all 0.3s ease;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--primary);
}

@media screen and (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }
    
    .main-content {
        padding-bottom: 80px;
    }
}