/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header h1 {
    color: #1e3c72;
    font-size: 2.5em;
    font-weight: 700;
}

.wallet-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

#walletAddress {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #495057;
}

/* Contract Address Copy Button Styles */
.contract-address-container {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.copy-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    color: white;
    min-width: 40px;
}

.copy-btn:hover {
    background: linear-gradient(135deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.copy-btn:active {
    transform: translateY(0);
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #d39e00);
    color: #212529;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Section Styles */
.section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.section h2 {
    color: #1e3c72;
    font-size: 1.8em;
    margin-bottom: 20px;
    border-bottom: 3px solid #007bff;
    padding-bottom: 10px;
}

.section h3 {
    color: #495057;
    font-size: 1.2em;
    margin-bottom: 15px;
    margin-top: 20px;
}

/* Financial Summary Styles */
.financial-summary {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.summary-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #28a745);
}

.summary-card.pending::before {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.summary-card.total-earnings::before {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.summary-card.withdrawn::before {
    background: linear-gradient(90deg, #6f42c1, #e83e8c);
}

.summary-card.efficiency::before {
    background: linear-gradient(90deg, #17a2b8, #6610f2);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.summary-card h3 {
    color: #495057;
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 600;
}

.summary-card p {
    font-size: 2em;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 10px;
    word-break: break-word;
}

.summary-card small {
    color: #6c757d;
    font-size: 0.85em;
    line-height: 1.4;
    display: block;
}

.refresh-section {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

#refreshFinancials, #refreshRoyaltyPeriod {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    touch-action: manipulation;
}

#refreshFinancials:hover, #refreshRoyaltyPeriod:hover {
    background: linear-gradient(135deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

/* Grid Layouts */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Card Styles */
.status-card, .stat-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.status-card:hover, .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.status-card h3, .stat-card h3 {
    color: #6c757d;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.status-card p, .stat-card p {
    font-size: 1.5em;
    font-weight: 700;
    color: #1e3c72;
    word-break: break-all;
}

/* Board Styles */
.board-overview {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.board-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.board-controls label {
    font-weight: 600;
    color: #495057;
}

.board-dropdown {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.board-info {
    margin-top: 20px;
}

.board-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.board-members {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 2px solid #e9ecef;
}

.board-members h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* Referral Lookup Styles */
.referral-lookup {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

/* User Lookup Styles */
.user-lookup {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.user-details {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid #e9ecef;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.detail-label {
    font-weight: 600;
    color: #495057;
}

.detail-value {
    color: #1e3c72;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.reward-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.reward-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.reward-item span {
    font-size: 0.9em;
    color: #495057;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Wallet Connection Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    color: #1e3c72;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 30px;
}

.wallet-options {
    display: grid;
    gap: 15px;
}

.wallet-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.wallet-option:hover {
    background: linear-gradient(135deg, #e9ecef, #f8f9fa);
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.wallet-option img {
    width: 32px;
    height: 32px;
}

/* Admin Functions */
.admin-functions {
    display: grid;
    gap: 30px;
}

.function-group {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
}

.function-group h3 {
    color: #1e3c72;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Eligible Users */
.eligible-users {
    background: linear-gradient(135deg, #e8f5e8, #ffffff);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid #28a745;
}

#eligibleUsersContent, #royaltyEligibleUsersContent, #blacklistedUsersContent, 
#zeroReferralsContent, #oneReferralContent, #emergencyHistoryContent {
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}

.eligible-user-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.reward-lookup {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

/* Transaction Log */
.transaction-log {
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 2px solid #e9ecef;
    -webkit-overflow-scrolling: touch;
}

.log-entry {
    background: white;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.log-entry.pending {
    border-left-color: #ffc107;
}

.log-entry.success {
    border-left-color: #28a745;
}

.log-entry.error {
    border-left-color: #dc3545;
}

.log-time {
    color: #6c757d;
    font-size: 0.85em;
    min-width: 80px;
}

.log-action {
    flex: 1;
    font-weight: 600;
    color: #495057;
}

.log-status {
    text-transform: uppercase;
    font-size: 0.75em;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f8f9fa;
}

.log-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.log-link:hover {
    text-decoration: underline;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    font-size: 1.2em;
    font-weight: 600;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 5px solid #007bff;
}

.notification.success {
    border-left-color: #28a745;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.warning {
    border-left-color: #ffc107;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #495057;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .wallet-section {
        flex-direction: column;
        width: 100%;
    }
    
    .wallet-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    #walletAddress {
        font-size: 12px;
        word-break: break-all;
    }
    
    .status-grid, .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-card {
        padding: 20px;
    }
    
    .summary-card p {
        font-size: 1.5em;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .detail-item span {
        text-align: left;
    }
    
    .section {
        padding: 15px;
    }
    
    .function-group {
        padding: 15px;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 10px;
    }

    .board-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .board-stats {
        grid-template-columns: 1fr;
    }

    .reward-status {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .wallet-option {
        padding: 15px;
        font-size: 14px;
    }

    .contract-address-container {
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .section h2 {
        font-size: 1.4em;
    }
    
    .status-card p, .stat-card p {
        font-size: 1.2em;
    }
    
    .form-group input,
    .form-group select {
        padding: 15px;
        font-size: 16px;
        min-height: 48px;
    }

    .container {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .log-entry {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Hover effects for mobile - disable on touch devices */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .status-card:hover,
    .stat-card:hover,
    .summary-card:hover,
    .wallet-option:hover {
        transform: none;
        box-shadow: initial;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .section {
        border: 1px solid #333;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wallet-option {
        background: #2d3748;
        color: white;
        border-color: #4a5568;
    }
    
    .wallet-option:hover {
        background: #4a5568;
    }
}

/* Focus styles for better accessibility */
.btn:focus,
.wallet-option:focus,
input:focus,
select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Better scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
/* ADD THESE STYLES TO admin-panel.css */

/* Board Tree View Styles */
.board-tree-section {
    background: linear-gradient(135deg, #f0f4f8, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.tree-info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.tree-info-box p {
    margin: 5px 0;
    color: #1565c0;
    font-size: 0.9em;
}

.tree-view {
    overflow-x: auto;
    overflow-y: visible;
    padding: 20px;
    background: white;
    border-radius: 8px;
    min-height: 200px;
    -webkit-overflow-scrolling: touch;
}

.tree-view-container {
    min-width: 1200px;
    width: max-content;
}

.tree-level {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    position: relative;
}

.tree-level-label {
    text-align: center;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 10px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tree-nodes {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.tree-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.node-card {
    background: white;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 8px;
    min-width: 110px;
    max-width: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    font-size: 0.85em;
}

.node-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.node-card.active {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9, #ffffff);
}

.node-card.completed {
    border-color: #2196f3;
    background: linear-gradient(135deg, #e3f2fd, #ffffff);
}

.node-card.empty {
    border-color: #e0e0e0;
    background: #fafafa;
    border-style: dashed;
    min-height: 80px;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

.node-header strong {
    color: #1e3c72;
    font-size: 0.75em;
}

.badge-completed {
    background: #2196f3;
    color: white;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 0.6em;
    font-weight: 600;
}

.badge-active {
    background: #4caf50;
    color: white;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 0.6em;
    font-weight: 600;
}

.node-body {
    text-align: center;
}

.node-name {
    font-weight: 600;
    color: #495057;
    font-size: 0.7em;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.65em;
    color: #6c757d;
    margin-top: 4px;
}

.node-stats span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.empty-node {
    text-align: center;
    color: #9e9e9e;
    font-style: italic;
    padding: 10px;
    font-size: 0.7em;
}

.tree-connector {
    position: absolute;
    height: 2px;
    background: #cbd5e0;
    top: -20px;
    left: 50%;
}

.tree-connector.left {
    width: 50%;
    left: 0;
}

.tree-connector.right {
    width: 50%;
    left: 50%;
}

.tree-branch-label {
    position: absolute;
    top: -30px;
    font-size: 0.65em;
    font-weight: 600;
    color: #7c3aed;
    background: white;
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid #7c3aed;
    white-space: nowrap;
}

.tree-branch-label.left {
    left: 25%;
}

.tree-branch-label.right {
    right: 25%;
}

/* Responsive tree view */
@media (max-width: 768px) {
    .tree-view {
        padding: 10px;
        overflow-x: scroll;
    }
    
    .tree-view-container {
        min-width: 1000px;
    }
    
    .tree-nodes {
        gap: 10px;
        flex-wrap: nowrap;
    }
    
    .node-card {
        min-width: 95px;
        max-width: 105px;
        padding: 6px;
    }
    
    .node-header strong {
        font-size: 0.7em;
    }
    
    .node-name {
        font-size: 0.65em;
    }
    
    .node-stats {
        font-size: 0.6em;
        gap: 2px;
    }
    
    .badge-completed,
    .badge-active {
        font-size: 0.55em;
        padding: 1px 3px;
    }
    
    .tree-branch-label {
        font-size: 0.6em;
        padding: 1px 4px;
    }
    
    .tree-level-label {
        font-size: 0.7em;
    }
    
    .tree-level {
        margin-bottom: 20px;
    }
}

/* Loading animation for tree */
.tree-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.tree-loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Tree Navigation Styles */
.tree-navigation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tree-nav-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tree-nav-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tree-nav-btn:active {
    transform: translateY(0);
}

.tree-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    font-weight: 500;
}

.breadcrumb-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.breadcrumb-current {
    color: white;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.breadcrumb-arrow {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
}

/* Clickable Node Card Styles */
.node-card.clickable {
    transition: all 0.3s ease;
    position: relative;
}

.node-card.clickable:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border-width: 4px;
}

.node-card.clickable::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.node-card.clickable:hover::after {
    opacity: 1;
}

.click-hint {
    text-align: center;
    font-size: 0.6em;
    color: #667eea;
    font-weight: 600;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #e0e0e0;
}

.tree-level {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    position: relative;
}

.tree-level-label {
    text-align: center;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 12px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tree-nodes {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tree-branch-label {
    position: static;
    display: block;
    font-size: 0.7em;
    font-weight: 600;
    color: #7c3aed;
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #7c3aed;
    margin-bottom: 8px;
    text-align: center;
}

/* Mobile responsive navigation */
@media (max-width: 768px) {
    .tree-navigation {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tree-nav-btn {
        width: 100%;
        text-align: center;
    }
    
    .tree-breadcrumb {
        justify-content: center;
        width: 100%;
    }
}

/* Enhanced empty node for better UX */
.node-card.empty {
    opacity: 0.6;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-node {
    font-size: 1.1em;
}

/* Pagination Styles */
.pagination-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pagination-info {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
}

.pagination-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 40px;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: #e9ecef;
    border-color: #adb5bd;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    border-color: #1e3c72;
    cursor: default;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.pagination-ellipsis {
    padding: 8px 5px;
    color: #6c757d;
}

/* Mobile responsive pagination */
@media (max-width: 576px) {
    .pagination-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 35px;
    }
    
    .pagination-buttons {
        gap: 3px;
    }
    
    .pagination-info {
        font-size: 13px;
    }
}

/* Date Range Styles */
.date-range-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.date-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-input-wrapper label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.date-input {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    min-width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-input:hover {
    border-color: #007bff;
}

.date-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

@media (max-width: 768px) {
    .date-range-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input-wrapper {
        width: 100%;
    }
    
    .date-input {
        width: 100%;
        min-width: auto;
    }
    
    .date-range-group .btn {
        width: 100%;
    }
}