:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --info: #4895ef;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --sidebar-width: 250px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f5f7fb;
    color: var(--dark);
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    height: 100vh;
    position: fixed;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border-left: 4px solid var(--success);
}

.sidebar-menu i {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
}

/* Header */
.header {
    height: var(--header-height);
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 40px;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.user-profile {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

.user-profile:hover {
    background-color: var(--light);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 10px;
}

.user-info {
    line-height: 1.2;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--gray);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px 0;
    min-width: 150px;
    display: none;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.3s;
}

.user-dropdown a:hover {
    background-color: var(--light);
}

.user-dropdown i {
    margin-right: 8px;
    width: 16px;
}

.notifications {
    position: relative;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

.notifications:hover {
    background-color: var(--light);
}

.notification-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Area */
.content {
    padding: 30px;
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    padding: 20px;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.card-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray);
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.card-growth {
    font-size: 0.9rem;
    color: var(--success);
}

.card-growth.negative {
    color: var(--danger);
}

/* Tabs */
.tabs {
    display: flex;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tab {
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    flex: 1;
    font-weight: 500;
}

.tab.active {
    background-color: var(--primary);
    color: white;
}

.tab:hover:not(.active) {
    background-color: var(--light-gray);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--light-gray);
    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(67, 97, 238, 0.2);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #3aa8d4;
}

.btn-secondary {
    background-color: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #e00b6f;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Table Styles */
.table-container {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.table th {
    background-color: var(--light);
    font-weight: 600;
    color: var(--dark);
}

.table tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active {
    background-color: rgba(76, 201, 240, 0.2);
    color: var(--success);
}

.status-pending {
    background-color: rgba(248, 150, 30, 0.2);
    color: var(--warning);
}

.status-completed {
    background-color: rgba(67, 97, 238, 0.2);
    color: var(--primary);
}

/* Table Actions */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.table-actions .search-box {
    margin-left: auto;
}

/* Pipeline Visualization */
.pipeline {
    display: flex;
    overflow-x: auto;
    padding: 20px 0;
    gap: 15px;
}

.pipeline-stage {
    min-width: 250px;
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
}

.stage-title {
    font-weight: 600;
    color: var(--dark);
}

.stage-count {
    background-color: var(--light-gray);
    color: var(--gray);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.pipeline-item {
    background-color: var(--light);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.pipeline-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.item-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.item-details {
    font-size: 0.8rem;
    color: var(--gray);
}

/* Charts */
.chart-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark);
}

/* Referral Tree */
.tree-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    overflow: auto;
}

.tree {
    display: flex;
    justify-content: center;
    min-height: 400px;
}

.tree-node {
    text-align: center;
    margin: 0 20px;
    position: relative;
}

.node-content {
    background-color: var(--primary);
    color: white;
    width: 120px;
    padding: 10px;
    border-radius: 8px;
    margin: 0 auto 20px;
    position: relative;
    z-index: 2;
}

.node-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.node-role {
    font-size: 0.8rem;
    opacity: 0.8;
}

.node-highlight {
    background-color: var(--success);
}

.node-gray {
    background-color: var(--gray);
}

/* Login/Register Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: var(--dark);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--gray);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background-color: rgba(247, 37, 133, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.form-links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.form-links a {
    color: var(--primary);
    text-decoration: none;
}

.form-links a:hover {
    text-decoration: underline;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 15px;
    border: 1px solid var(--light-gray);
    background: white;
    border-radius: 5px;
    cursor: pointer;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:hover:not(.active) {
    background: var(--light);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
        overflow: visible;
    }
    .sidebar-header h2, .sidebar-menu span {
        display: none;
    }
    .sidebar-menu a {
        justify-content: center;
        padding: 15px;
    }
    .sidebar-menu i {
        margin-right: 0;
        font-size: 1.5rem;
    }
    .main-content {
        margin-left: 70px;
    }
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    .header-right {
        gap: 10px;
    }
    .user-info {
        display: none;
    }
    .search-box .form-control {
        width: 200px;
    }
    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .table-actions .search-box {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    .content {
        padding: 15px;
    }
    .header {
        padding: 0 15px;
    }
    .search-box .form-control {
        width: 150px;
    }
    .tabs {
        flex-direction: column;
    }
}