/* ===================================
   Modern Admin Dashboard CSS
   =================================== */

/* Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.modern-dashboard {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f7fa;
    color: #2c3e50;
    overflow-x: hidden;
}

/* ===================================
   Top Navigation Bar
   =================================== */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid #e8ecef;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    padding: 0 24px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 10px;
    padding: 0 16px;
    height: 42px;
    width: 320px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box i {
    color: #94a3b8;
    font-size: 14px;
    margin-right: 10px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 14px;
    color: #1e293b;
}

.search-box input::placeholder {
    color: #94a3b8;
}

.notification-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-icon:hover {
    background: #ede9fe;
    color: #6366f1;
}

.badge-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-menu:hover {
    background: #f8fafc;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.user-role {
    font-size: 12px;
    color: #64748b;
}

.user-dropdown {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 8px;
    margin-top: 8px;
    min-width: 200px;
}

.user-dropdown .dropdown-item {
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.user-dropdown .dropdown-item:hover {
    background: #f1f5f9;
}

/* ===================================
   Sidebar
   =================================== */
.modern-sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    width: 280px;
    height: calc(100vh - 70px);
    background: #ffffff;
    border-right: 1px solid #e8ecef;
    padding: 24px 0;
    transition: all 0.3s ease;
    overflow-y: auto;
    z-index: 999;
}

.modern-sidebar::-webkit-scrollbar {
    width: 6px;
}

.modern-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.modern-sidebar.collapsed {
    width: 80px;
}

.modern-sidebar.collapsed .menu-text,
.modern-sidebar.collapsed .menu-badge,
.modern-sidebar.collapsed .sidebar-title,
.modern-sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar-header {
    padding: 0 24px 16px 24px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #94a3b8;
    text-transform: uppercase;
}

.sidebar-menu {
    list-style: none;
    padding: 0 12px;
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.menu-link:hover {
    background: #f8fafc;
    color: #1e293b;
    text-decoration: none;
}

.menu-item.active .menu-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.menu-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.menu-text {
    flex: 1;
}

.menu-badge {
    background: #ede9fe;
    color: #6366f1;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.menu-item.active .menu-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.sidebar-footer {
    padding: 24px;
    margin-top: 24px;
}

.sidebar-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: white;
}

.sidebar-card i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.sidebar-card h6 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.sidebar-card p {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 16px;
}

.sidebar-card .btn {
    background: white;
    color: #6366f1;
    border: none;
    font-weight: 600;
    padding: 8px 16px;
}

/* ===================================
   Main Content Area
   =================================== */
.main-content {
    margin-left: 280px;
    margin-top: 70px;
    min-height: calc(100vh - 70px);
    padding: 32px;
    transition: all 0.3s ease;
}

.main-content.expanded {
    margin-left: 80px;
}

.content-wrapper {
    max-width: 1400px;
}

/* ===================================
   Cards & Components
   =================================== */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    transition: all 0.3s ease;
    background: #ffffff;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #f1f5f9;
    padding: 20px 24px;
    font-weight: 700;
    font-size: 16px;
    color: #1e293b;
    border-radius: 16px 16px 0 0 !important;
}

.card-body {
    padding: 24px;
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    border: none;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-card h3 {
    font-size: 36px;
    font-weight: 800;
    margin: 0;
    line-height: 1;
}

.stat-card p {
    margin: 8px 0 0 0;
    opacity: 0.9;
    font-size: 14px;
    font-weight: 500;
}

.stat-card i {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 48px;
    opacity: 0.2;
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Tables */
.table {
    border-radius: 12px;
    overflow: hidden;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    color: #475569;
    font-size: 14px;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px;
    color: #94a3b8;
}

/* Responsive */
@media (max-width: 992px) {
    .modern-sidebar {
        transform: translateX(-100%);
    }
    
    .modern-sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .search-box {
        display: none;
    }
}

.loading i {
    font-size: 3rem;
    color: #007bff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.form-floating .form-control {
    border-radius: 8px;
}

.modal-content {
    border-radius: 15px;
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 15px 15px 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 15px 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stat-card {
        text-align: center;
    }
    
    .stat-card i {
        position: static;
        transform: none;
        display: block;
        margin-bottom: 1rem;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Chart Container Fix */
#auditTrendChart {
    max-height: 350px !important;
    height: 350px !important;
    width: 100% !important;
}

.card-body canvas {
    max-height: 350px !important;
    height: 350px !important;
}

/* Ensure chart parent has proper height */
.card-body > div[style*="height"] {
    height: 350px !important;
    max-height: 350px !important;
    min-height: 350px !important;
    overflow: hidden;
}

/* Fix card-body for chart */
.col-md-8 .card-body {
    padding: 20px !important;
    overflow: hidden !important;
}

.col-md-8 .card.h-100 {
    height: auto !important;
    max-height: 500px;
}