@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
/**
 * Binary MLM Software - Responsive CSS Framework
 * Mobile-First Design with Flexbox
 */

/* ==================== CSS Reset & Variables ==================== */
:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    --success-color: #10B981;
    --dark-bg: #1F2937;
    --light-bg: #F9FAFB;
    --text-dark: #111827;
    --text-light: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #f3f4f6;
}

/* ==================== Typography ==================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 {
    font-size: 2.25rem;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.875rem;
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1.5rem;
    letter-spacing: -0.025em;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== Flexbox Container System ==================== */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.flex-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-start {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.flex-3 {
    flex: 3;
}

/* ==================== Grid System ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.col {
    flex: 1;
    padding: 0 0.5rem;
    min-width: 0;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 0.5rem;
}

.col-11 {
    flex: 0 0 91.66%;
    max-width: 91.66%;
    padding: 0 0.5rem;
}

.col-10 {
    flex: 0 0 83.33%;
    max-width: 83.33%;
    padding: 0 0.5rem;
}

.col-9 {
    flex: 0 0 75%;
    max-width: 75%;
    padding: 0 0.5rem;
}

.col-8 {
    flex: 0 0 66.66%;
    max-width: 66.66%;
    padding: 0 0.5rem;
}

.col-7 {
    flex: 0 0 58.33%;
    max-width: 58.33%;
    padding: 0 0.5rem;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 0.5rem;
}

.col-5 {
    flex: 0 0 41.66%;
    max-width: 41.66%;
    padding: 0 0.5rem;
}

.col-4 {
    flex: 0 0 33.33%;
    max-width: 33.33%;
    padding: 0 0.5rem;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 0.5rem;
}

.col-2 {
    flex: 0 0 16.66%;
    max-width: 16.66%;
    padding: 0 0.5rem;
}

.col-1 {
    flex: 0 0 8.33%;
    max-width: 8.33%;
    padding: 0 0.5rem;
}

/* ==================== Cards ==================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 0;
}

.card-footer {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #D97706;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #2563EB;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

.btn-group .btn {
    margin: 0;
}

/* ==================== Forms ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.form-check-input {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ==================== Tables ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

.table thead {
    background-color: var(--primary-color);
    color: white;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: var(--light-bg);
}

.table-responsive {
    overflow-x: auto;
}

/* ==================== Badges & Labels ==================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 20px;
    line-height: 1;
}

.badge-primary {
    background-color: var(--primary-color);
    color: white;
}

.badge-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: white;
}

.badge-info {
    background-color: var(--info-color);
    color: white;
}

/* ==================== Alerts ==================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid var(--info-color);
}

/* ==================== Dashboard Layout ==================== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--dark-bg);
    color: white;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: white;
    text-align: center;
}

.sidebar-menu {
    list-style: none;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar-menu .menu-icon {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

/* Notification Badge */
.badge-notification {
    background-color: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.main-content {
    flex: 1;
    margin-left: 260px;
    transition: var(--transition);
}

.topbar {
    background-color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content-wrapper {
    padding: 2rem;
}

/* ==================== Stats Cards ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.stat-card:hover {
    transform: translateY(-4px);
    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;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
}


/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.charts-grid .card {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.charts-grid .card-header {
    flex-shrink: 0;
}

.charts-grid .card-header p {
    margin: 0.25rem 0 0 0;
    font-size: 0.875rem;
}

.charts-grid .card-body {
    flex: 1;
    min-height: 0;
    position: relative;
    padding: 1.5rem;
}

.charts-grid canvas {
    max-height: 100%;
}

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid .card {
        height: 350px;
    }
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.primary {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-icon.danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: var(--text-dark);
}

.stat-content p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==================== Utility Classes ==================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary-color);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-muted {
    color: var(--text-light);
}

.bg-primary {
    background-color: var(--primary-color);
}

.bg-success {
    background-color: var(--success-color);
}

.bg-danger {
    background-color: var(--danger-color);
}

.bg-warning {
    background-color: var(--warning-color);
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

/* ==================== Modal Styles ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background-color: white;
    margin: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h4 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-header .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-header .close:hover {
    background-color: var(--light-bg);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 992px) {
    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-4 {
        flex: 0 0 33.33%;
        max-width: 33.33%;
    }

    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .col-sm-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .col-xs-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .topbar {
        padding: 0.75rem 1rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9375rem;
        min-height: 44px;
        /* Touch-friendly minimum height */
    }

    /* Touch-friendly form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    /* Larger tap targets for links */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Mobile-optimized table */
    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    /* Stack cards vertically on very small screens */
    .card {
        margin-bottom: 1rem;
    }

    /* Improved stat cards for mobile */
    .stat-card {
        padding: 1.25rem;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }

    /* Mobile-friendly modal */
    .modal {
        padding: 1rem;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
    }
}

/* ==================== Touch Device Optimizations ==================== */
@media (hover: none) and (pointer: coarse) {

    /* Larger clickable areas for touch devices */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.625rem 1.25rem;
    }

    /* Increase sidebar menu item size */
    .sidebar-menu a {
        padding: 1rem 1.25rem;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover {
        transform: none;
    }

    /* Better spacing for dropdowns */
    .dropdown-menu a {
        padding: 0.875rem 1rem;
    }
}

/* ==================== Binary Tree Visualization ==================== */
.binary-tree-container {
    padding: 2rem;
    background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
    border-radius: 8px;
    overflow-x: auto;
}

.tree-level {
    margin-bottom: 3rem;
    text-align: center;
}

.tree-level.level-0 {
    display: flex;
    justify-content: center;
    margin-bottom: 4rem;
}

.tree-level.level-1 {
    position: relative;
}

.tree-node {
    display: inline-block;
    margin: 0 1rem;
    position: relative;
}

.node-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    min-width: 280px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.node-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.root-node .node-card {
    border-color: var(--primary-color);
    border-width: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.root-node .node-header strong,
.root-node .node-body {
    color: white;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.root-node .node-header {
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.node-header strong {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.node-name {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.root-node .node-name {
    color: white;
    font-weight: 500;
}

.node-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 6px;
}

.root-node .stat-item {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.root-node .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

.stat-value {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
}

.root-node .stat-value {
    color: white;
}

.stat-item small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.root-node .stat-item small {
    color: rgba(255, 255, 255, 0.8);
}

.node-stats-compact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.node-stats-compact span {
    padding: 0.25rem 0.5rem;
    background: #f3f4f6;
    border-radius: 4px;
}

.node-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.tree-branches {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    position: relative;
}

.tree-branches::before {
    content: '';
    position: absolute;
    top: -3rem;
    left: 50%;
    width: 2px;
    height: 3rem;
    background: var(--primary-color);
    transform: translateX(-50%);
}

.tree-branches::after {
    content: '';
    position: absolute;
    top: -3rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.branch-left,
.branch-right {
    position: relative;
}

.branch-left::before,
.branch-right::before {
    content: '';
    position: absolute;
    top: -3rem;
    width: 2px;
    height: 3rem;
    background: var(--primary-color);
}

.branch-left::before {
    left: 50%;
    transform: translateX(-50%);
}

.branch-right::before {
    right: 50%;
    transform: translateX(50%);
}

.empty-position {
    border: 2px dashed #d1d5db;
    background: #f9fafb;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--text-light);
    font-style: italic;
}

.leg-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.leg-label.left-leg {
    background: #10b981;
}

.leg-label.right-leg {
    background: #f59e0b;
}

@media (max-width: 1200px) {
    .tree-branches {
        gap: 2rem;
    }

    .node-card {
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .binary-tree-container {
        padding: 1rem;
    }

    .tree-branches {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .tree-branches::before,
    .tree-branches::after {
        display: none;
    }

    .branch-left::before,
    .branch-right::before {
        display: none;
    }

    .node-card {
        min-width: 100%;
    }

    .tree-node {
        margin: 0.5rem 0;
    }
}

/* ==================== Dashboard Real-Time Updates ==================== */
.dashboard-update-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.dashboard-update-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.dashboard-update-indicator.updating {
    background: var(--warning-color);
    animation: none;
}

[data-stat] {
    transition: background-color 0.5s ease;
}

[data-stat].updated {
    background-color: rgba(245, 158, 11, 0.2);
    border-radius: 4px;
    padding: 0.25rem;
    animation: flash 0.8s ease-out;
}

@keyframes flash {
    0% {
        background-color: rgba(245, 158, 11, 0.3);
    }

    100% {
        background-color: transparent;
    }
}

/* Mobile optimization for update indicator */
@media (max-width: 576px) {
    .dashboard-update-indicator {
        bottom: 10px;
        right: 10px;
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
}

/* ==================== Dashboard Specific Styles ==================== */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-welcome h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.dashboard-welcome p {
    color: var(--text-light);
    font-size: 1rem;
}

.user-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-badges .badge {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 50px;
}

/* Binary Tree Dashboard Widget */
.binary-widget-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
}

.binary-node-root {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.binary-connector-vertical {
    width: 2px;
    height: 30px;
    background: var(--border-color);
}

.binary-children-container {
    display: flex;
    gap: 2rem;
    position: relative;
    padding-top: 2px;
    /* For the horizontal line */
}

.binary-connector-horizontal {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    /* Adjust based on gap */
    height: 2px;
    background: var(--border-color);
    z-index: 1;
}

.binary-node-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.binary-node-card {
    background: white;
    border: 2px solid transparent;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    min-width: 140px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    margin-top: 0;
    /* Connector handles spacing */
}

.binary-node-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.binary-node-card.left {
    border-color: var(--primary-color);
}

.binary-node-card.right {
    border-color: var(--success-color);
}

.binary-node-card.empty {
    background: #f9fafb;
    border: 2px dashed var(--border-color);
    box-shadow: none;
}

/* Tab Navigation Modern */
.nav-tabs-modern {
    display: flex;
    gap: 1rem;
    border-bottom: none;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.nav-tabs-modern .nav-link {
    border: none;
    background: white;
    color: var(--text-light);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    transition: var(--transition);
}

.nav-tabs-modern .nav-link:hover {
    color: var(--primary-color);
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nav-tabs-modern .nav-link.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

/* ==================== New Utility Classes ==================== */
.card-border-primary {
    border-left: 4px solid var(--primary-color);
}

.card-border-success {
    border-left: 4px solid var(--success-color);
}

.card-border-info {
    border-left: 4px solid var(--info-color);
}

.card-border-warning {
    border-left: 4px solid var(--warning-color);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.bg-gradient-info {
    background: linear-gradient(135deg, var(--info-color), #2563EB);
    color: white;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, var(--warning-color), #D97706);
    color: white;
}

.stat-box {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: var(--transition);
}

.stat-box:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
}

.stat-box-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-box-label {
    color: var(--text-light);
    font-size: 0.875rem;
}

.topbar-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    color: var(--text-light);
    transition: var(--transition);
}

.notification-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.notification-badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
}

.user-id {
    font-size: 0.75rem;
    color: var(--text-light);
}