:root {
    --bs-primary: #E31E24;
    --bs-primary-rgb: 227, 30, 36;
    --bs-primary-dark: #D40F15;
    --bs-primary-light: #F22D33;
    --bs-secondary: #111111;
}

body {
    font-family: system-ui, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f7fa;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    background-color: var(--bs-primary) !important;
    height: 56px;
    z-index: 1030;
}

/* Desktop Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    padding-top: 56px;
    background-color: #fff;
    border-right: 1px solid #e9ecef;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1020;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1 1 auto;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid #e9ecef;
    font-size: 11px;
    color: #6c757d;
    line-height: 1.6;
}

.sidebar-footer div:first-child {
    font-weight: 600;
    color: #495057;
}

.sidebar-nav .nav-link {
    padding: 12px 20px;
    color: #495057;
    border-left: 3px solid transparent;
    font-size: 14px;
}

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

.sidebar-nav .nav-link.active {
    background-color: #fef2f2;
    color: var(--bs-primary);
    border-left-color: var(--bs-primary);
    font-weight: 600;
}

/* Offcanvas sidebar on mobile */
.offcanvas {
    --bs-offcanvas-width: 260px;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 240px;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
    .sidebar {
        display: none;
    }
}

/* Stat cards */
.stat-card {
    transition: transform 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

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

/* Card headers */
.card-header {
    border-bottom: 1px solid #f0f0f0;
}

/* Buttons */
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--bs-primary-dark);
    border-color: var(--bs-primary-dark);
}

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

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

/* Links */
a {
    color: var(--bs-primary);
}

a:hover {
    color: var(--bs-primary-dark);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
}

.breadcrumb-item a {
    text-decoration: none;
}

/* Badge */
.badge {
    font-weight: 500;
}

/* Table */
.table > thead {
    background-color: #f8f9fa;
}

/* Pagination active */
.page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.page-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(227, 30, 36, 0.25);
}

/* Form focus */
.form-control:focus,
.form-select:focus {
    border-color: #E31E24;
    box-shadow: 0 0 0 0.2rem rgba(227, 30, 36, 0.25);
}

/* Flash messages */
.alert-dismissible .btn-close {
    padding: 0.75rem;
}



/* Login page */
.bg-light {
    background-color: #f5f7fa !important;
}

/* Certificate */
.certificate-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}

.certificate {
    width: 800px;
    max-width: 100%;
}

.cert-border {
    border: 8px solid #E31E24;
    position: relative;
    background: #fff;
}

.cert-inner {
    border: 2px solid #E31E24;
    margin: 12px;
    padding: 40px 50px;
    text-align: center;
    position: relative;
    background: #fff;
}

.cert-ornament {
    position: absolute;
    left: 30px;
    right: 30px;
    height: 4px;
    background: linear-gradient(90deg, transparent, #E31E24, transparent);
}

.top-ornament {
    top: 20px;
}

.bottom-ornament {
    bottom: 20px;
}

.cert-logo {
    margin-bottom: 12px;
}

.cert-logo img {
    max-height: 60px;
    width: auto;
}

.cert-suptitle {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #E31E24;
    font-weight: 600;
    margin-bottom: 4px;
}

.cert-title {
    font-size: 32px;
    font-weight: 800;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.cert-subtitle {
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.cert-name {
    font-size: 28px;
    font-weight: 700;
    color: #E31E24;
    letter-spacing: 3px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.cert-details {
    font-size: 15px;
    color: #444;
    line-height: 1.8;
    margin-bottom: 24px;
}

.cert-details p {
    margin-bottom: 4px;
}

.cert-course {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    padding: 8px 30px;
    display: inline-block;
    border: 2px solid #E31E24;
    border-radius: 6px;
    margin: 8px 0;
    background: #fff5f5;
}

.cert-info-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.cert-info-item {
    text-align: center;
    min-width: 160px;
}

.cert-info-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 2px;
}

.cert-info-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #111;
}

.cert-signatures {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin-top: 100px;
    margin-bottom: 24px;
}

.cert-signature-box {
    text-align: center;
    min-width: 180px;
}

.cert-sign-line {
    width: 180px;
    height: 1px;
    border-top: 2px solid #111;
    margin-bottom: 8px;
}

.cert-sign-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cert-footer-text {
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

/* Generic admin print â€” hide chrome, show content */
@media print {
    @page {
        margin: 0;
        size: A4 portrait;
    }

    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .topbar,
    .sidebar,
    #sidebarDesktop,
    #sidebarOffcanvas,
    .offcanvas,
    .breadcrumb,
    .alert {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .container-fluid {
        padding: 0 !important;
    }
}

@media print {
    body.cert-print-mode {
        background: #fff !important;
    }

    body.cert-print-mode .main-content > .container-fluid > *:not(.certificate-wrapper) {
        display: none !important;
    }

    body.cert-print-mode .main-content,
    body.cert-print-mode .container-fluid,
    body.cert-print-mode .certificate-wrapper {
        display: block !important;
    }

    .certificate-wrapper {
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }

    .certificate {
        width: 750px;
        max-width: 100%;
    }

    .cert-inner {
        padding: 50px 60px;
    }

    .cert-border {
        border-width: 6px;
    }
}
