/* =====================================================
   Bank LMS - Custom Stylesheet
   Professional Banking Learning Management System
   ===================================================== */

:root {
    --primary: #1a56db;
    --primary-light: #e8edfb;
    --primary-dark: #1241a8;
    --secondary: #6b7280;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --dark: #111827;
    --light: #f8fafc;
    --sidebar-width: 270px;
    --sidebar-collapsed: 0px;
    --navbar-height: 64px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --border-color: #e5e7eb;
    --radius: 0.5rem;
    --gradient-primary: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background-color: #f1f5f9;
    color: #334155;
    font-size: 0.875rem;
    overflow-x: hidden;
}

/* =====================================================
   NAVBAR
   ===================================================== */
.navbar-main {
    background: var(--gradient-dark);
    height: var(--navbar-height);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    z-index: 1040;
    padding: 0 1rem;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
}

.brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    color: white;
    letter-spacing: -0.02em;
}

.navbar-search {
    max-width: 400px;
    width: 100%;
}

.navbar-search .input-group {
    background: rgba(255,255,255,.1);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s;
}

.navbar-search .input-group:focus-within {
    background: rgba(255,255,255,.2);
}

.navbar-search .input-group-text {
    background: transparent;
    color: rgba(255,255,255,.5);
}

.navbar-search .form-control {
    background: transparent;
    color: white;
}

.navbar-search .form-control::placeholder {
    color: rgba(255,255,255,.4);
}

.navbar-search .form-control:focus {
    box-shadow: none;
    color: white;
}

.notification-badge {
    font-size: 10px;
    padding: 2px 5px;
    transform: translate(-25%, -25%) !important;
}

.notification-dropdown {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
}

.notification-item.unread {
    background-color: var(--primary-light);
}

.notification-item:hover {
    background-color: #f8fafc;
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.3);
}

.user-avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: white;
    border-right: 1px solid var(--border-color);
    z-index: 1050;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    min-height: var(--navbar-height);
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.brand-info h5 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.brand-info small {
    font-size: 0.7rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 8px 24px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 24px;
    color: #4b5563;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 0;
    margin: 1px 8px;
    border-radius: 6px;
}

.sidebar-nav .nav-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.sidebar-nav .nav-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 600;
}

.sidebar-nav .nav-link.active .nav-icon {
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1045;
    backdrop-filter: blur(2px);
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left 0.3s ease;
}

.main-footer {
    margin-left: var(--sidebar-width);
    padding: 16px 24px;
    background: white;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    transition: margin-left 0.3s ease;
}

/* =====================================================
   CARDS & COMPONENTS
   ===================================================== */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark);
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--secondary);
    font-weight: 500;
}

.stat-card .stat-change {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Info Cards */
.info-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 20px;
}

/* Course Cards */
.course-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s;
    height: 100%;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.course-card .card-img-top {
    height: 160px;
    object-fit: cover;
    background: var(--gradient-primary);
}

.course-card .course-category {
    position: absolute;
    top: 12px;
    left: 12px;
}

.course-card .course-type {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* =====================================================
   TABLES
   ===================================================== */
.table {
    font-size: 0.82rem;
}

.table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background-color: #fafbfc;
}

.table .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* DataTables Overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 0.82rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 4px 8px;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
    padding: 8px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #374151;
    margin-bottom: 4px;
}

.input-group-text {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    font-size: 0.82rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(26, 86, 219, 0.3);
}

.btn-gradient {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.btn-gradient:hover {
    color: white;
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.35);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.76rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
}

/* =====================================================
   PAGE HEADER
   ===================================================== */
.page-header {
    margin-bottom: 24px;
}

.page-header .page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.page-header .page-subtitle {
    color: var(--secondary);
    font-size: 0.85rem;
}

.breadcrumb {
    font-size: 0.78rem;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
    min-height: 100vh;
    background: var(--gradient-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(26, 86, 219, 0.2) 0%, transparent 70%);
    top: -200px;
    right: -200px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
    position: relative;
    z-index: 1;
}

.login-header {
    text-align: center;
    padding: 32px 32px 0;
}

.login-header .login-logo {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 16px;
}

.login-body {
    padding: 24px 32px 32px;
}

.login-footer {
    text-align: center;
    padding: 0 32px 32px;
}

/* =====================================================
   DASHBOARD WIDGETS
   ===================================================== */
.welcome-card {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    overflow: hidden;
    position: relative;
}

.welcome-card::after {
    content: '';
    position: absolute;
    right: -50px;
    bottom: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,.05);
    border-radius: 50%;
}

.welcome-card::before {
    content: '';
    position: absolute;
    right: 30px;
    top: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,.05);
    border-radius: 50%;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
}

/* =====================================================
   PROGRESS BARS
   ===================================================== */
.progress {
    background-color: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-footer {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
    
    .page-header .page-title {
        font-size: 1.15rem;
    }
    
    .card-body {
        padding: 16px;
    }
}

@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* =====================================================
   UTILITIES & OTHER
   ===================================================== */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary { background: var(--gradient-primary); }
.bg-gradient-dark { background: var(--gradient-dark); }

.border-start-primary { border-left: 3px solid var(--primary) !important; }
.border-start-success { border-left: 3px solid var(--success) !important; }
.border-start-warning { border-left: 3px solid var(--warning) !important; }
.border-start-danger { border-left: 3px solid var(--danger) !important; }
.border-start-info { border-left: 3px solid var(--info) !important; }

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state .empty-icon {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 16px;
}

.empty-state h5 {
    color: #6b7280;
    font-weight: 600;
}

.empty-state p {
    color: #9ca3af;
    max-width: 400px;
    margin: 0 auto;
}

/* Heatmap styles */
.heatmap-cell {
    width: 100%;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.heatmap-low { background: #fecaca; color: #991b1b; }
.heatmap-medium { background: #fef3c7; color: #92400e; }
.heatmap-high { background: #bbf7d0; color: #166534; }
.heatmap-full { background: #86efac; color: #14532d; }

/* Smooth transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Select2 override */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    font-size: 0.85rem !important;
    min-height: 38px !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Print styles */
@media print {
    .sidebar, .navbar-main, .main-footer, .sidebar-overlay {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
}
