/* === Global Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f7fc;
    color: #1e293b;
    line-height: 1.6;
    display: flex;
}

a {
    text-decoration: none;
    color: #2563eb;
}

/* === Sidebar Styles === */
.sidebar {
    width: 260px;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 24px 16px;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #1e293b;
}

.sidebar-brand i {
    font-size: 28px;
    color: #38bdf8;
}

.sidebar-brand span {
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.5px;
}

.sidebar-brand small {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.sidebar-nav a i {
    width: 22px;
    text-align: center;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #1e293b;
    color: #f8fafc;
}

.sidebar-nav a.active {
    color: #38bdf8;
}

.sidebar-footer {
    border-top: 1px solid #1e293b;
    padding-top: 20px;
    margin-top: 8px;
}

.sidebar-footer a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    transition: background 0.2s;
    cursor: pointer;
}

.sidebar-footer a:hover {
    background: #1e293b;
    color: #e2e8f0;
}

/* === Main Content === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    overflow-y: auto;
    background: #f4f7fc;
}

/* === Header (Top Bar) === */
.header {
    background: #ffffff;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9edf2;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(4px);
    background: rgba(255,255,255,0.92);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left .menu-toggle {
    display: none;
    font-size: 22px;
    background: none;
    border: none;
    color: #1e293b;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.2s;
}

.header-left .menu-toggle:hover {
    transform: scale(1.1);
}

.header-left .menu-toggle:focus {
    outline: none;
}

.header-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
}

.header-left h2 i {
    margin-right: 10px;
    color: #38bdf8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-right .notification {
    position: relative;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
}

.header-right .notification .badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

.header-right .user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.header-right .user .avatar {
    width: 36px;
    height: 36px;
    background: #38bdf8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.header-right .user .name {
    font-weight: 500;
    font-size: 14px;
}


/* Analytics-specific styles */
.analytics-page .btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.analytics-page .btn-outline:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.analytics-page .btn-primary {
    background: #2563eb;
    border: 1px solid #2563eb;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.analytics-page .btn-primary:hover {
    background: #1d4ed8;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge.in_progress {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.submitted {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.approved {
    background: #d1fae5;
    color: #059669;
}

.status-badge.rejected {
    background: #fecaca;
    color: #dc2626;
}


/* Role Badge */
.role-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 40px;
    font-weight: 600;
}

/* === Content Area === */
.content {
    padding: 28px 32px;
    flex: 1;
    width: 100%;
}

/* === Stats Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e9edf2;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.stat-card .stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.stat-card .stat-icon {
    float: right;
    font-size: 28px;
    color: #94a3b8;
    opacity: 0.5;
}

/* === Charts Row === */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    border: 1px solid #e9edf2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chart-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1e293b;
}

.chart-container {
    position: relative;
    height: 220px;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* === Recent Projects === */
.projects-section {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    border: 1px solid #e9edf2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 24px;
}

.projects-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.projects-section .section-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.projects-section .section-header a {
    font-size: 14px;
    color: #38bdf8;
    text-decoration: none;
    font-weight: 500;
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.projects-table th {
    text-align: left;
    padding: 10px 8px 8px 0;
    color: #64748b;
    font-weight: 500;
    border-bottom: 1px solid #e9edf2;
}

.projects-table td {
    padding: 12px 8px 12px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.projects-table tr:last-child td {
    border-bottom: none;
}

/* === Status Badges === */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.status-badge.active {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.completed {
    background: #dcfce7;
    color: #15803d;
}

.status-badge.draft {
    background: #fef9c3;
    color: #854d0e;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #0f172a;
    color: white;
}

.btn-primary:hover {
    background: #1e293b;
}

.btn-outline {
    background: transparent;
    border: 1px solid #e9edf2;
    color: #1e293b;
}

.btn-outline:hover {
    background: #f1f5f9;
}

/* === Forms === */
input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e9edf2;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 14px;
}

/* === Overlay (mobile sidebar) === */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    cursor: pointer;
}

.overlay.active {
    display: block;
}

/* === Mobile Menu Fixes - ADDED === */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #1e293b;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.2s;
}

.menu-toggle:hover {
    transform: scale(1.1);
}

.menu-toggle:focus {
    outline: none;
}

/* === Responsive === */
/* On large screens (≥ 992px): hide top bar, show sidebar */
@media (min-width: 992px) {
    .header {
        display: none !important;
    }
    .content {
        padding-top: 20px;
    }
    body {
        display: flex !important;
    }
    .sidebar {
        transform: translateX(0) !important;
        position: sticky !important;
        top: 0;
        height: 100vh;
        display: flex !important;
    }
    .overlay {
        display: none !important;
    }
    .menu-toggle {
        display: none !important;
    }
}

/* On small screens (< 992px): show top bar, hide sidebar by default */
@media (max-width: 991.98px) {
    .menu-toggle {
        display: block !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 2000;
        width: 280px;
        background: #0f172a;
        color: #e2e8f0;
        display: flex !important;
        flex-direction: column;
        padding: 24px 16px;
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }
    
    .overlay {
        display: none !important;
        position: fixed !important;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1500;
    }
    
    .overlay.active {
        display: block !important;
    }
    
    .header {
        display: flex !important;
    }
    
    .main-content {
        width: 100%;
    }
    
    body {
        display: block !important;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .header {
        padding: 12px 16px;
    }
    .content {
        padding: 16px;
    }
    .header-right .user .name {
        display: none;
    }
}

/* === Utility Classes === */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* === Sidebar Close Button === */
.sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s, transform 0.2s;
}

.sidebar-close:hover {
    color: #f8fafc;
    transform: rotate(90deg);
}

@media (max-width: 991.98px) {
    .sidebar-close {
        display: block;
    }
}

/* === User Dropdown Styles === */
.user-dropdown {
    position: relative;
    cursor: pointer;
}

.user-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid #e9edf2;
    padding: 8px 0;
    z-index: 9999;
    overflow: hidden;
}

.user-dropdown .dropdown-menu.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: #1e293b;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
}

.user-dropdown .dropdown-menu .dropdown-item:hover {
    background: #f1f5f9;
}

.user-dropdown .dropdown-menu .dropdown-item i {
    width: 18px;
    color: #64748b;
    text-align: center;
}

.user-dropdown .dropdown-menu .dropdown-divider {
    height: 1px;
    background: #e9edf2;
    margin: 4px 12px;
}

.user-dropdown .dropdown-menu .dropdown-item.text-danger {
    color: #ef4444;
}

.user-dropdown .dropdown-menu .dropdown-item.text-danger i {
    color: #ef4444;
}

.user-dropdown .dropdown-menu .dropdown-item.text-danger:hover {
    background: #fef2f2;
}

.user-dropdown .dropdown-menu .user-info {
    padding: 12px 18px;
    border-bottom: 1px solid #e9edf2;
    margin-bottom: 4px;
}

.user-dropdown .dropdown-menu .user-info .user-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 14px;
}

.user-dropdown .dropdown-menu .user-info .user-email {
    font-size: 12px;
    color: #64748b;
}

.user-dropdown .dropdown-menu .user-info .user-role {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.user-dropdown .dropdown-menu .user-info .user-role .role-badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 40px;
    font-size: 10px;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .user-dropdown .dropdown-menu {
        right: -60px;
        min-width: 220px;
    }
}

/* ==========================================
   DASHBOARD MOBILE RESPONSIVE
========================================== */

@media (max-width: 991px){

    /* Content */
    .content{
        padding:15px !important;
    }

    /* ===========================
       Statistics Cards
    =========================== */

    .stats-grid{
        display:grid;
        grid-template-columns:repeat(2,1fr);
        gap:12px;
        margin-bottom:20px;
    }

    .stat-card{
        padding:16px;
        border-radius:14px;
        min-height:110px;
    }

    .stat-value{
        font-size:26px !important;
        line-height:1.2;
    }

    .stat-label{
        font-size:13px;
    }

    .stat-icon{
        font-size:22px !important;
        margin-bottom:10px;
        float:none !important;
        opacity:.35;
    }


    /* ===========================
       Charts
    =========================== */

    .charts-row{
        display:flex;
        flex-direction:column;
        gap:16px;
    }

    .chart-card{
        padding:16px;
    }

    .chart-card h4{
        font-size:15px;
        margin-bottom:15px;
    }

    .chart-container{
        height:280px !important;
    }


    /* ===========================
       Projects Section
    =========================== */

    .projects-section{
        padding:16px;
        border-radius:14px;
        overflow:hidden;
    }

    .section-header{
        flex-direction:column;
        align-items:flex-start;
        gap:8px;
    }

    .section-header a{
        font-size:13px;
    }


    /* ===========================
       Responsive Table
    =========================== */

    .projects-table{
        display:block;
        width:100%;
        overflow-x:auto;
        white-space:nowrap;
    }

    .projects-table thead th{
        font-size:13px;
    }

    .projects-table td{
        font-size:13px;
        padding:12px 8px;
    }


    /* ===========================
       Opportunities
    =========================== */

    .opportunity-item{
        display:flex;
        flex-direction:column;
        align-items:flex-start;
        gap:8px;
    }

    .opportunity-score{
        align-self:flex-start;
    }

}


/* Small Phones */

@media (max-width:600px){

    .stats-grid{
        grid-template-columns:1fr;
    }

    .stat-card{
        display:flex;
        align-items:center;
        gap:15px;
        min-height:auto;
    }

    .stat-icon{
        width:50px;
        height:50px;
        display:flex;
        align-items:center;
        justify-content:center;
        background:#f8fafc;
        border-radius:12px;
        font-size:24px !important;
        margin:0;
    }

    .chart-container{
        height:240px !important;
    }

    .projects-section{
        padding:14px;
    }

}