:root {
    --primary: #4a6fa5;
    --secondary: #166088;
    --accent: #4fc3a1;
    --light: #f8f9fa;
    --dark: #343a40;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --gray: #6c757d;
    --light-gray: #e9ecef;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    background-color: #f5f7fa;
    color: var(--dark);
}

.dashboard {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 20px;
}

.sidebar-header h3 {
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
}

.sidebar-header h3 i {
    margin-right: 10px;
    color: var(--accent);
}

.sidebar-menu {
    padding: 0 15px;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--gray);
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(74, 111, 165, 0.1);
    color: var(--primary);
}

.sidebar-menu a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    transition: all 0.3s;
    width: calc(100% - 250px);
    max-width: 100%;
    overflow-x: hidden;
}

/* Top Navigation */
.top-nav {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
}

.search-bar {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--light-gray);
    border-radius: 30px;
    outline: none;
    transition: all 0.3s;
}

.search-bar input:focus {
    border-color: var(--primary);
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info .notifications {
    position: relative;
    margin-right: 20px;
    cursor: pointer;
}

.user-info .notifications i {
    font-size: 1.2rem;
    color: var(--gray);
}

.user-info .notifications .badge {
    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;
}

.user-info .user {
    display: flex;
    align-items: center;
}

.user-info .user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.user-info .user .user-name {
    font-weight: 600;
    margin-right: 5px;
}

/* Dashboard Content */
.content {
    padding: 25px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h2 {
    color: var(--primary);
    font-weight: 700;
}

.btn {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    min-width: 0; /* Fix for flexbox overflow */
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.stat-card.primary::before {
    background: var(--primary);
}

.stat-card.success::before {
    background: var(--success);
}

.stat-card.warning::before {
    background: var(--warning);
}

.stat-card.danger::before {
    background: var(--danger);
}

.stat-card .stat-title {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    word-break: break-word;
}

.stat-card .stat-change {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.stat-card .stat-change.positive {
    color: var(--success);
}

.stat-card .stat-change.negative {
    color: var(--danger);
}

.stat-card .stat-icon {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2.5rem;
    opacity: 0.2;
}

/* Charts Section */
.charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

@media (max-width: 1200px) {
    .charts {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    width: 100%;
    min-width: 0; /* Fix for chart overflow */
}

.chart-card .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-card .chart-title {
    font-weight: 600;
    color: var(--dark);
}

.chart-card .chart-actions select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid var(--light-gray);
    outline: none;
    background: white;
}

.chart-container {
    height: 300px;
    position: relative;
    width: 100%;
    min-width: 0;
}

/* Recent Donations */
.recent-donations {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    width: 100%;
    overflow-x: auto;
}

.recent-donations .donations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.recent-donations .donations-title {
    font-weight: 600;
    color: var(--dark);
}

.donations-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Minimum width before scrolling */
}

.donations-table thead th {
    text-align: left;
    padding: 12px 15px;
    background: var(--light);
    color: var(--gray);
    font-weight: 600;
    border-bottom: 2px solid var(--light-gray);
}

.donations-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--light-gray);
}

.donations-table tbody tr:last-child td {
    border-bottom: none;
}

.donor-info {
    display: flex;
    align-items: center;
    min-width: 200px;
}

.donor-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.donor-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.donor-email {
    font-size: 0.8rem;
    color: var(--gray);
}

.donation-amount {
    font-weight: 700;
    color: var(--success);
}

.donation-status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-completed {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.status-pending {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning);
}

.status-failed {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.view-more {
    text-align: center;
    margin-top: 20px;
}

.view-more a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.view-more a i {
    margin-left: 5px;
    transition: all 0.3s;
}

.view-more a:hover i {
    transform: translateX(3px);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        margin-left: -250px;
    }
    .sidebar.active {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .top-nav {
        padding-left: 15px;
    }
}

@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    .user-info .user .user-name {
        display: none;
    }
    .search-bar {
        width: 200px;
    }
    .donations-table {
        min-width: 100%;
    }
}

@media (max-width: 576px) {
    .search-bar {
        width: 150px;
    }
    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    .content {
        padding: 15px;
    }
}
