/* ========================================
   ENHANCED DASHBOARD DESIGN
   Compact, Attractive, User-Friendly
   ======================================== */

/* Root Variables */
:root {
    --primary-blue: #4a90e2;
    --primary-blue-dark: #357abd;
    --success-green: #28a745;
    --warning-orange: #ffa500;
    --danger-red: #dc3545;
    --info-teal: #17a2b8;
    --purple: #6f42c1;
    --light-bg: #f5f7fa;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --border-color: #e8eaed;
    --text-primary: #1a3a52;
    --text-secondary: #666;
    --text-light: #999;
}

/* Global Enhancements */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #eef0f5 100%);
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ==================== DASHBOARD WRAPPER ==================== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR IMPROVEMENTS ==================== */
.sidebar {
    width: 240px;
    background: linear-gradient(135deg, #1a3a52 0%, #2d5a7b 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    padding: 0;
    z-index: 1000;
    transition: width 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.sidebar-logo {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-logo i {
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    padding: 7px 10px;
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-logo h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.sidebar-menu {
    padding: 15px 0;
    flex: 1;
}

.sidebar-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--primary-blue);
    padding-left: 20px;
}

.sidebar-menu i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile:hover {
    opacity: 0.9;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-info h5 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info p {
    margin: 0;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.top-header {
    background: white;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    flex: 1;
    max-width: 380px;
    display: flex;
    align-items: center;
    background: var(--light-bg);
    border-radius: 8px;
    padding: 7px 12px;
    gap: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-light);
}

.search-box i {
    color: var(--text-light);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    position: relative;
    color: var(--text-primary);
    transition: all 0.3s ease;
    padding: 6px;
    border-radius: 6px;
}

.notification-btn:hover {
    background: var(--light-bg);
    color: var(--primary-blue);
}

.notification-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border: 2px solid white;
}

.profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.profile-menu:hover {
    background: var(--light-bg);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ==================== DASHBOARD CONTENT ==================== */
.dashboard-content {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
    background: linear-gradient(135deg, #f5f7fa 0%, #eef0f5 100%);
}

.dashboard-content::-webkit-scrollbar {
    width: 6px;
}

.dashboard-content::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.dashboard-content::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ==================== WELCOME SECTION ==================== */
.welcome-section {
    margin-bottom: 24px;
}

.welcome-section h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-section p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

.welcome-section strong {
    color: var(--text-primary);
}

/* ==================== FILTER SECTION ==================== */
.filter-section {
    background: white;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 22px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.filter-section > div {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-section label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
}

.filter-section input,
.filter-section select {
    padding: 7px 11px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    transition: all 0.3s ease;
    background: white !important;
}

.filter-section input:focus,
.filter-section select:focus {
    border-color: var(--primary-blue) !important;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1) !important;
}

.filter-section button {
    padding: 7px 16px !important;
    font-size: 13px !important;
    font-weight: 600;
    border-radius: 6px !important;
    border: 1px solid var(--border-color) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-section .btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark)) !important;
    border-color: var(--primary-blue) !important;
    color: white !important;
}

.filter-section .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.filter-section .btn-secondary {
    background: white !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.filter-section .btn-secondary:hover {
    background: var(--light-bg) !important;
    border-color: var(--primary-blue) !important;
    color: var(--primary-blue) !important;
}

/* ==================== STATS CARDS ==================== */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    border-left: 4px solid;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: rgba(74, 144, 226, 0.05);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-4px);
}

.stat-card.blue { border-left-color: var(--primary-blue); }
.stat-card.orange { border-left-color: var(--warning-orange); }
.stat-card.teal { border-left-color: var(--info-teal); }
.stat-card.green { border-left-color: var(--success-green); }
.stat-card.red { border-left-color: var(--danger-red); }
.stat-card.purple { border-left-color: var(--purple); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    margin-bottom: 12px;
    font-weight: bold;
}

.stat-card.blue .stat-icon { background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark)); }
.stat-card.orange .stat-icon { background: linear-gradient(135deg, var(--warning-orange), #e08700); }
.stat-card.teal .stat-icon { background: linear-gradient(135deg, var(--info-teal), #138496); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, var(--success-green), #218838); }
.stat-card.red .stat-icon { background: linear-gradient(135deg, var(--danger-red), #c82333); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, var(--purple), #5a32a3); }

.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.stat-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.stat-link:hover {
    color: var(--primary-blue-dark);
    text-decoration: underline;
}

/* ==================== CHARTS SECTION ==================== */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.chart-card {
    background: white;
    border-radius: 10px;
    padding: 22px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title i {
    font-size: 1.2rem;
}

.chart-wrapper {
    position: relative;
    height: 250px;
}

/* ==================== TABLES SECTION ==================== */
.tables-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.table-card {
    background: white;
    border-radius: 10px;
    padding: 22px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.table-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.table-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-title i {
    font-size: 1.1rem;
}

.table-custom {
    font-size: 0.85rem;
    margin: 0;
}

.table-custom thead th {
    background: linear-gradient(135deg, var(--light-bg), #eef0f5);
    color: var(--text-primary);
    font-weight: 700;
    border: none;
    padding: 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-custom tbody td {
    padding: 10px;
    border-color: #f0f0f0;
    vertical-align: middle;
    color: var(--text-secondary);
}

.table-custom tbody tr {
    transition: all 0.3s ease;
}

.table-custom tbody tr:hover {
    background: var(--light-bg);
}

/* ==================== STATUS & PRIORITY BADGES ==================== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-in-progress { background: #cfe2ff; color: #084298; }
.status-completed { background: #d1e7dd; color: #0f5132; }
.status-done { background: #e2e3e5; color: #383d41; }

.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-high { background: #f8d7da; color: #842029; }
.priority-medium { background: #fff3cd; color: #664d03; }
.priority-low { background: #d1e7dd; color: #0f5132; }

/* ==================== LINKS & BUTTONS ==================== */
.view-all-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.view-all-link:hover {
    color: var(--primary-blue-dark);
    text-decoration: underline;
}

.btn {
    border-radius: 6px !important;
    font-weight: 600;
    padding: 8px 16px !important;
    font-size: 13px !important;
    transition: all 0.3s ease;
    border: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark)) !important;
    color: white !important;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
    background: var(--light-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.btn-secondary:hover {
    background: white !important;
    border-color: var(--primary-blue) !important;
    color: var(--primary-blue) !important;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 1200px) {
    .charts-container,
    .tables-container {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-content {
        padding: 18px;
    }

    .top-header {
        padding: 10px 18px;
    }

    .search-box {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 220px;
    }

    .sidebar.active {
        transform: translateX(0);
        z-index: 1001;
    }

    .main-content {
        margin-left: 0;
    }

    .stats-container {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .top-header {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 10px;
    }

    .search-box {
        max-width: 100%;
        order: 3;
        flex-basis: 100%;
    }

    .header-actions {
        gap: 8px;
    }

    .charts-container,
    .tables-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .chart-card,
    .table-card {
        padding: 16px;
    }

    .chart-wrapper {
        height: 200px;
    }

    .welcome-section h1 {
        font-size: 1.4rem;
    }

    .filter-section {
        padding: 12px;
    }

    .dashboard-content {
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .stats-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-number {
        font-size: 1.3rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .welcome-section h1 {
        font-size: 1.2rem;
    }

    .welcome-section p {
        font-size: 0.9rem;
    }

    .table-custom {
        font-size: 0.8rem;
    }

    .table-custom thead th,
    .table-custom tbody td {
        padding: 8px 6px !important;
    }

    .chart-wrapper {
        height: 180px;
    }

    .filter-section > div {
        flex-direction: column;
        gap: 10px;
    }

    .filter-section > div > div {
        width: 100%;
    }

    .filter-section input,
    .filter-section select,
    .filter-section button {
        width: 100% !important;
    }

    .status-badge,
    .priority-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.chart-card,
.table-card {
    animation: slideIn 0.3s ease-out;
}

/* ==================== UTILITY CLASSES ==================== */
.text-center {
    text-align: center;
}

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 8px !important; }
.p-2 { padding: 16px !important; }
.p-3 { padding: 24px !important; }
