/* ===================================
   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;
}

#sessionIndicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0fdf4;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
}

#sessionIndicator i {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.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;
}

/* ===================================
   MODERN SIDEBAR DESIGN
   =================================== */
.modern-sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    width: 280px;
    height: calc(100vh - 70px);
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right: 1px solid #e8ecef;
    padding: 24px 0;
    transition: all 0.3s ease;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

.modern-sidebar::-webkit-scrollbar {
    width: 6px;
}

.modern-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.modern-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.modern-sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.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;
}

.modern-sidebar.collapsed .menu-icon {
    margin: 0 auto;
}

.sidebar-header {
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid #e8ecef;
    margin-bottom: 20px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #94a3b8;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title::before {
    content: '';
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, transparent 100%);
}

.sidebar-menu {
    list-style: none;
    padding: 0 16px;
}

.menu-item {
    margin-bottom: 6px;
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.menu-link:hover {
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
    text-decoration: none;
    transform: translateX(4px);
}

.menu-link:hover::before {
    transform: scaleY(1);
}

.menu-item.active .menu-link {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    font-weight: 600;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.menu-item.active .menu-link::before {
    transform: scaleY(1);
}

.menu-item.active .menu-icon {
    animation: iconPop 0.5s ease;
}

@keyframes iconPop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.menu-text {
    flex: 1;
    font-size: 14px;
}

.menu-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.menu-item.active .menu-badge {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.sidebar-footer {
    padding: 20px;
    margin-top: 32px;
}

.sidebar-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

.sidebar-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30%, -30%); }
}

.sidebar-card i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.95;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.sidebar-card h6 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
}

.sidebar-card p {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 16px;
    line-height: 1.5;
    position: relative;
}

.sidebar-card .btn {
    background: white;
    color: #667eea;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar-card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    background: #f8f9fa;
}

/* ===================================
   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;
}

/* ===================================
   CLEAN DASHBOARD DESIGN
   =================================== */

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 20px 0;
}

/* Clean Stat Cards */
.stat-card-clean {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid #e8ecef;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-card-clean:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #dde1e6;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-details {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Clean Card Component */
.card-clean {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e8ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card-clean:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card-clean-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e8ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.card-clean-header h5 {
    margin: 0;
    font-size: 16px;
    color: #1a1a1a;
}

.card-clean-body {
    padding: 24px;
}

/* Action Cards */
.btn-action-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e8ecef;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: #dde1e6;
}

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.btn-action-card h6 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.btn-action-card p {
    font-size: 13px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stat-card-clean {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ===================================
   CHECKLIST MANAGEMENT MODERN DESIGN
   =================================== */

/* Division Cards */
.division-card-modern {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 1px solid #e8ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.division-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    border-color: #dde1e6;
}

.division-card-modern:hover .division-arrow {
    transform: translateX(8px);
    opacity: 1;
}

.division-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 28px;
}

.division-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.division-subtitle {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 0;
}

.division-arrow {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    color: #495057;
}

/* Category Cards */
.category-header {
    background: #ffffff;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8ecef;
}

.category-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.category-info {
    text-align: left;
}

.category-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.category-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-body {
    padding: 24px;
    background: #fafbfc;
}

/* Checklist Items */
.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-item {
    background: #ffffff;
    border: 1px solid #e8ecef;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.checklist-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: #dde1e6;
}

.checklist-number {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.checklist-content {
    flex: 1;
}

.checklist-content p {
    font-size: 15px;
    color: #2c3e50;
}

.checklist-actions {
    display: flex;
    gap: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fafbfc;
    border-radius: 12px;
    border: 2px dashed #e8ecef;
}

.empty-state i {
    opacity: 0.3;
}

.empty-state h5 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .category-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .checklist-item {
        flex-wrap: wrap;
    }
    
    .checklist-actions {
        width: 100%;
        justify-content: flex-end;
    }
}