/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #1f2937;
    --light-bg: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo i {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    color: white;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: 0.3s;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Section */
.section {
    display: none;
    animation: fadeIn 0.5s;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.stat-change {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    display: inline-block;
}

.stat-change.positive {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.withdraw-quick-btn {
    background: var(--warning-color);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: 0.3s;
}

.withdraw-quick-btn:hover {
    background: #d97706;
}

/* Referral Box */
.referral-box {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.referral-box h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.referral-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.referral-input-group input {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
}

.copy-btn, .share-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.copy-btn {
    background: white;
    color: var(--primary-color);
}

.share-btn {
    background: #10b981;
    color: white;
}

.copy-btn:hover {
    background: #f3f4f6;
}

.share-btn:hover {
    background: #059669;
}

.referral-note {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Activity Section */
.activity-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.activity-section h3 {
    margin-bottom: 1rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-content {
    flex: 1;
}

.activity-content p {
    margin-bottom: 0.2rem;
}

.activity-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Network Stats */
.network-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.network-stat-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.network-stat-item h4 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.level-count {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Network Tree */
.network-tree {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.tree {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.tree-node {
    text-align: center;
    padding: 1rem;
}

.node-card {
    background: var(--light-bg);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 1rem;
    min-width: 120px;
    cursor: pointer;
    transition: 0.3s;
}

.node-card:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.node-card strong {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--primary-color);
}

/* Table */
.table-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.table-container h3 {
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--primary-color);
    color: white;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--light-bg);
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

/* Earnings */
.earnings-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.earnings-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.earnings-card h4 {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.earnings-amount {
    font-size: 1.8rem;
    font-weight: bold;
}

.chart-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.chart-container h3 {
    margin-bottom: 1rem;
}

/* Products */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

.product-content {
    padding: 1.5rem;
}

.product-content h3 {
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.product-commission {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    padding: 0.5rem;
    border-radius: 5px;
    font-weight: bold;
    margin-bottom: 1rem;
    display: inline-block;
}

.buy-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.buy-btn:hover {
    background: var(--secondary-color);
}

/* Withdraw */
.withdraw-container {
    max-width: 800px;
    margin: 0 auto;
}

.withdraw-info {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 2rem;
}

.balance-display {
    font-size: 3rem;
    font-weight: bold;
    margin: 1rem 0;
}

.min-withdraw {
    opacity: 0.9;
}

.withdraw-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.submit-btn:hover {
    background: var(--secondary-color);
}

.withdrawal-history {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Profile */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.profile-avatar {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.profile-header h2 {
    margin-bottom: 0.5rem;
}

.member-id {
    opacity: 0.9;
    margin-bottom: 1rem;
}

.level-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
    font-weight: bold;
}

.profile-form {
    padding: 2rem;
}

/* Footer */
.footer {
    background: var(--dark-bg);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: 0.3s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--dark-bg);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    animation: slideIn 0.3s;
    z-index: 2000;
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
    }
    to {
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 968px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 1rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .user-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .referral-input-group {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}
