/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray: #6b7280;
    --border: #e5e7eb;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand i {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: var(--primary);
    color: white;
}

.wallet-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wallet-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.wallet-btn:hover {
    background: var(--primary-dark);
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wallet-address {
    background: var(--light);
    padding: 5px 10px;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.9rem;
}

.network-badge {
    background: var(--secondary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Network Selector */
.network-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.network-btn {
    padding: 12px 24px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.network-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Sections */
.section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 2rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-subtitle {
    color: var(--gray);
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    background: var(--light);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.card-body {
    padding: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Info Rows */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--gray);
}

.info-value {
    font-weight: 600;
    color: var(--dark);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    display: block;
    color: var(--gray);
    font-size: 0.9rem;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-warning, .btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    width: 100%;
    margin: 5px 0;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tiers */
.tiers-container {
    margin: 2rem 0;
}

.tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.tier-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tier-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.tier-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.tier-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.tier-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tier-price {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tier-weight {
    font-size: 0.9rem;
    color: var(--gray);
    background: var(--light);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* Community Pool */
.community-card {
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    border: 2px solid #667eea30;
    border-radius: 16px;
    padding: 2rem;
}

.pool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.pool-header h3 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.pool-subtitle {
    color: var(--gray);
    font-size: 1.1rem;
}

.pool-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.pool-stat {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.stat-label {
    display: block;
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.earnings {
    color: var(--secondary);
    font-weight: 700;
    font-size: 1.2rem;
}

.tier-comparison {
    margin: 2rem 0;
}

.comparison-bars {
    margin-top: 1rem;
}

.comparison-bar {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bar-label {
    width: 100px;
    font-weight: 600;
}

.bar-container {
    flex: 1;
    height: 30px;
    background: var(--light);
    border-radius: 15px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 15px;
}

.bronze .bar-fill { background: #cd7f32; width: 10%; }
.silver .bar-fill { background: #c0c0c0; width: 25%; }
.gold .bar-fill { background: #ffd700; width: 60%; }
.platinum .bar-fill { background: #e5e4e2; width: 150%; }
.diamond .bar-fill { background: #b9f2ff; width: 300%; }

.pool-info ul {
    list-style: none;
    margin: 1.5rem 0;
}

.pool-info li {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pool-info i {
    color: var(--secondary);
}

/* Admin Panel */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.admin-stat {
    background: var(--light);
    padding: 15px;
    border-radius: 8px;
}

.admin-label {
    display: block;
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.admin-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.commission-display {
    margin-bottom: 2rem;
}

.commission-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.commission-value {
    font-weight: 600;
    color: var(--primary);
}

.commission-form .form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-note, .emergency-note {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 10px;
    font-style: italic;
}

.emergency-card {
    border: 2px solid var(--danger);
}

.emergency-card .card-header {
    background: #fee2e2;
    color: var(--danger);
}

/* Referral Section */
.referral-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.referral-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.referral-stat {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.referral-link {
    margin: 2rem 0;
}

.link-container {
    display: flex;
    gap: 10px;
    margin: 1rem 0;
}

.link-input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
}

.referrals-table {
    overflow-x: auto;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
}

/* Status Message */
.status-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
    display: none;
}

.status-message.success {
    background: var(--secondary);
    color: white;
    display: block;
}

.status-message.error {
    background: var(--danger);
    color: white;
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .commission-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .network-selector {
        flex-direction: column;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section {
    animation: fadeIn 0.5s ease-out;
}

/* Tier Colors */
.tier-bronze {
    color: #cd7f32;
    border-color: #cd7f32;
}

.tier-silver {
    color: #c0c0c0;
    border-color: #c0c0c0;
}

.tier-gold {
    color: #ffd700;
    border-color: #ffd700;
}

.tier-platinum {
    color: #e5e4e2;
    border-color: #e5e4e2;
}

.tier-diamond {
    color: #b9f2ff;
    border-color: #b9f2ff;
}

/* Tier Comparison Bars */
.tier-bar {
    margin: 15px 0;
}

.tier-bar-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.tier-name {
    font-weight: 600;
    color: #333;
}

.tier-weight {
    color: #666;
    font-size: 0.9rem;
}

.bar-container {
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.tier-estimate {
    text-align: right;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

/* Upgrade Options */
.upgrade-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    transition: all 0.3s;
}

.upgrade-option:hover {
    border-color: #3b82f6;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.1);
}

.upgrade-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.upgrade-header i {
    font-size: 1.5rem;
}

.upgrade-details p {
    margin: 8px 0;
    color: #666;
}

.upgrade-details i {
    width: 20px;
    margin-right: 10px;
}

.btn-upgrade {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-upgrade:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
}

.no-upgrade {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    color: #666;
}

.withdrawal-info {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.withdrawal-details {
    font-size: 0.9rem;
}

.withdrawal-details p {
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
}

.withdrawal-details p strong {
    color: var(--dark);
}

.wallet-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.warning-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    text-align: center;
}

.warning-content h3 {
    color: var(--warning);
    margin-bottom: 1rem;
}

.wallet-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.wallet-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
}

.wallet-option:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.wallet-option img {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}

.btn-secondary.copied {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* Notes and Messages */
.join-note, .approve-note, .link-note, .form-note, .emergency-note {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 10px 0;
    font-style: italic;
}

/* Action containers */
.join-action, .fund-actions, .emergency-actions {
    margin-top: 1.5rem;
}

/* Form group styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}