/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --secondary: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --success: #10B981;
    --dark: #1F2937;
    --light: #F9FAFB;
    --gray: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.navbar-menu a {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-menu a:hover {
    color: var(--primary);
}

.admin-link {
    color: var(--danger) !important;
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.navbar-toggle span {
    width: 25px;
    height: 3px;
    background: var(--dark);
    border-radius: 2px;
    transition: 0.3s;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 350px);
    padding: 2rem 0;
}

/* Flash Messages */
.flash-message {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.flash-success {
    background: var(--success);
    color: white;
}

.flash-danger,
.flash-error {
    background: var(--danger);
    color: white;
}

.flash-warning {
    background: var(--warning);
    color: white;
}

.flash-info {
    background: var(--info);
    color: white;
}

.flash-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-success {
    background: transparent;
    border: 2px solid var(--success);
    color: var(--success);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-link {
    background: none;
    color: var(--primary);
    text-decoration: underline;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

small {
    display: block;
    margin-top: 0.25rem;
    color: var(--gray);
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #EF4444;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #3B82F6;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

.demo-credentials {
    background: var(--light);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

/* Dashboard */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-header {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--gray);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-primary .stat-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.stat-success .stat-icon {
    background: linear-gradient(135deg, #10B981, #059669);
}

.stat-info .stat-icon {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
}

.stat-warning .stat-icon {
    background: linear-gradient(135deg, #F59E0B, #D97706);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    color: var(--gray);
    font-size: 0.875rem;
}

/* Bonus Tracker */
.bonus-tracker-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.bonus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.bonus-header h3 {
    color: var(--dark);
}

.bonus-amount {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
}

.bonus-days {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.bonus-day {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.bonus-day.received {
    background: linear-gradient(135deg, var(--success), #059669);
    border-color: var(--success);
    color: white;
}

.bonus-day.received i {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

.day-number {
    font-weight: 600;
    font-size: 0.875rem;
}

.bonus-info {
    display: flex;
    justify-content: space-around;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Action Cards */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
}

.action-card:hover:not(.disabled) {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.action-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.action-card:hover:not(.disabled) i {
    color: white;
}

.action-card h3 {
    margin-bottom: 0.5rem;
}

.action-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Transactions */
.recent-transactions-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.recent-transactions-card h3 {
    margin-bottom: 1.5rem;
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
    gap: 1rem;
}

.txn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.txn-purchase {
    background: var(--primary);
}

.txn-bonus {
    background: var(--success);
}

.txn-referral {
    background: var(--info);
}

.txn-withdrawal {
    background: var(--warning);
}

.txn-details {
    flex: 1;
}

.txn-description {
    font-weight: 600;
    color: var(--dark);
}

.txn-time {
    font-size: 0.875rem;
    color: var(--gray);
}

.txn-amount {
    font-size: 1.25rem;
    font-weight: 700;
}

.txn-amount.positive {
    color: var(--success);
}

.txn-amount.negative {
    color: var(--danger);
}

.no-data {
    text-align: center;
    color: var(--gray);
    padding: 2rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--light);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background: var(--light);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-danger {
    background: var(--danger);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: white;
}

.badge-info {
    background: var(--info);
    color: white;
}

/* MLM Tree */
.tree-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

#mlmTreeCanvas {
    width: 100%;
    height: 600px;
    cursor: grab;
}

#mlmTreeCanvas:active {
    cursor: grabbing;
}

.tree-header {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.tree-controls {
    display: flex;
    gap: 0.5rem;
}

.tree-legend {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.legend-box {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.node-info-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    z-index: 1000;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

/* Footer */
.footer {
    background: rgba(31, 41, 55, 0.95);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.disclaimer-text {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.5rem;
}

/* Utility Classes */
.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.py-4 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-6,
.col-md-8 {
    padding: 0 15px;
}

.col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
    }

    .navbar-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .bonus-days {
        grid-template-columns: repeat(5, 1fr);
    }

    .col-md-6,
    .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .tree-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .action-cards {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 2rem;
    }
}

/* Header Responsive - Show/Hide Desktop and Mobile Headers */
/* Desktop Header - Show only on desktop (>= 768px) */
.desktop-navbar {
    display: flex;
}

.mobile-header {
    display: none;
}

/* Mobile Screen - Hide desktop header, show mobile header */
@media (max-width: 768px) {
    .desktop-navbar {
        display: none !important;
    }

    .footer {
        display: none !important;
    }

    .mobile-header {
        display: flex !important;
    }
}

/* App-Like Bottom Navigation */
.landing-bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 0;
    margin: 0 auto;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    height: 70px;
    display: none;
    /* Default hidden on desktop */
}

@media (max-width: 768px) {
    .landing-bottom-nav {
        display: block;
    }

    body {
        padding-bottom: 100px;
    }
}

.landing-bottom-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
    position: relative;
}

.landing-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #9CA3AF;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.landing-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Active State */
.landing-nav-item.active {
    color: var(--primary);
}

.landing-nav-item.active i {
    transform: translateY(-4px);
}

/* Central FAB (Join) Button */
.landing-nav-item-main {
    transform: translateY(-30px);
    position: relative;
    z-index: 10;
    flex: 0 0 70px;
    /* Fixed width */
}

.landing-nav-item-main i {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
    border: 5px solid white;
    margin-bottom: 0;
}

.landing-nav-item-main span {
    position: absolute;
    bottom: -22px;
    color: #667eea;
    font-weight: 700;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s;
}

.landing-nav-item-main.active i {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.6);
}

.landing-nav-item-main:hover span {
    opacity: 1;
    transform: translateY(0);
}