/* =====================================================
   SEIKWA NMTC - GLOBAL UI SYSTEM
===================================================== */

/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar-bg: #0f172a;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--content-bg);
    color: var(--text-dark);
}

/* ========== LAYOUT ========== */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 230px;
    min-width: 230px;
    background: var(--sidebar-bg);
    color: white;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, min-width 0.25s ease;
}
/* Active Exam Status in Sidebar */
.sidebar-exam-status {
    margin: 0 12px 16px;
}
.sidebar-exam-active {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px 12px;
}
.exam-dot {
    width: 10px;
    height: 10px;
    background: #16a34a;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
.exam-label { font-size: 10px; font-weight: 700; color: #16a34a; text-transform: uppercase; letter-spacing: 0.5px; }
.exam-title { font-size: 12px; font-weight: 700; color: #166534; margin-top: 2px; }
.exam-date  { font-size: 11px; color: #4ade80; margin-top: 1px; }
.sidebar-exam-none {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #854d0e;
}
/* Hide exam status text when sidebar is collapsed */
.sidebar.collapsed .sidebar-exam-status { display: none; }

/* Collapsed - icon strip only */
.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

/* Collapse toggle button inside sidebar */
#sidebarCollapseBtn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 16px 18px;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

#sidebarCollapseBtn:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
}

/* Sidebar title */
.sidebar-title {
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 18px 14px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    flex-shrink: 0;
    transition: opacity 0.15s ease, height 0.25s ease, padding 0.25s ease;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    height: 0;
    padding-bottom: 0;
}

.sidebar h2 {
    margin-bottom: 30px;
    font-size: 20px;
}

/* Nav list */
.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0 0 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.sidebar ul li {
    margin: 0;
}

/* Nav links */
.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    position: relative;
    border-left: 3px solid transparent;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left-color: var(--primary);
}

/* Icon */
.nav-icon {
    font-size: 17px;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* Label - fades out when collapsed */
.nav-label {
    overflow: hidden;
    white-space: nowrap;
    opacity: 1;
    max-width: 160px;
    transition: opacity 0.15s ease, max-width 0.25s ease;
}

.sidebar.collapsed .nav-label {
    opacity: 0;
    max-width: 0;
}

/* Flex link for badge rows */
.nav-link-flex {
    justify-content: space-between;
}

/* Badge */
.nav-badge {
    background: #dc2626;
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.sidebar.collapsed .nav-badge {
    opacity: 0;
}

/* Tooltip - only when collapsed */
.sidebar ul li a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #334155;
    transition: opacity 0.15s ease;
}

.sidebar.collapsed ul li a[data-tooltip]:hover::after {
    opacity: 1;
}

/* ========== CONTENT ========== */
.content {
    margin-left: 230px;
    padding: 35px;
    width: 100%;
    transition: margin-left 0.25s ease;
}

body.sidebar-collapsed .content {
    margin-left: 60px;
}

/* ========== TOPBAR ========== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
}

.topbar-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

/* ========== CARDS ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}

.card h3 {
    margin-bottom: 12px;
}

.card p {
    font-size: 26px;
    font-weight: bold;
    color: var(--primary);
}

/* Cohort checkbox grid in exam management */
.cohort-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px 16px;
    margin: 8px 0 12px;
}

.cohort-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ========== BADGES ========== */
.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background:#dcfce7; color:#166534; }
.badge-danger { background:#fee2e2; color:#7f1d1d; }
.badge-warning { background:#fef9c3; color:#854d0e; }

/* Map dashboard-specific badges to semantic ones */
.badge-active { background:#dcfce7; color:#166534; }
.badge-draft { background:#fef9c3; color:#854d0e; }

/* ========== TABLES ========== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.04);
}

table th {
    background: var(--sidebar-bg);
    color: white;
    padding: 14px;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

table td {
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
}

table tr:hover {
    background: #f8fafc;
}
/* ===============================
   TABLE
================================ */
.table-responsive {
    overflow-x: auto;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}

.styled-table th {
    background: #1f2937;
    color: white;
    padding: 14px;
    text-align: left;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.styled-table td {
    padding: 14px;
    vertical-align: top;
    border-bottom: 1px solid #f1f1f1;
}

.styled-table tr:hover {
    background: #f9fafb;
}

/* ===============================
   BUTTONS
================================ */
.btn {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    display: inline-block;
    margin-bottom: 6px;
    transition: 0.2s ease;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* ===============================
   FORM INLINE
================================ */
.form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-inline input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* ===============================
   ACTION AREA
================================ */
.action-buttons {
    margin-bottom: 10px;
}

/* ===============================
   ENROLL SECTION
================================ */
.enroll-section {
    background: #f9fafb;
    padding: 10px;
    border-radius: 8px;
}

.cohort-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 10px;
}

.cohort-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    background: #eef2ff;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s ease;
}

.cohort-checkbox-item:hover {
    background: #dbeafe;
}

/* ========== DATATABLES ========== */
.dataTables_wrapper {
    margin-top: 15px;
    overflow-x: auto;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    width: auto;
    min-width: 120px;
}

/* Care plan checkbox emphasis on cohorts page */
.care-plan-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.care-plan-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #1d4ed8;
}

.care-plan-text {
    font-size: 14px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

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

.btn-danger {
    background: var(--danger);
    color: white;
}

/* ========== FORMS ========== */
input, select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    margin-bottom: 15px;
    transition: var(--transition);
}

input:focus, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

/* ========== DARK MODE ========== */
body.dark {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark .card,
body.dark table,
body.dark .topbar {
    background: #1e293b;
    color: white;
}

body.dark table th {
    background: #334155;
}

/* Mobile sidebar toggle button (hamburger in header) */
.sidebar-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    /* Sidebar slides in from left on mobile */
    .sidebar {
        left: -230px;
        width: 230px !important;
        min-width: 230px !important;
        transition: left 0.25s ease !important;
    }

    .sidebar.active {
        left: 0;
    }

    /* Always show labels and title on mobile */
    .sidebar .nav-label {
        opacity: 1 !important;
        max-width: 160px !important;
    }

    .sidebar .sidebar-title {
        opacity: 1 !important;
        height: auto !important;
        padding: 0 18px 14px !important;
    }

    /* Hide in-sidebar collapse button on mobile */
    #sidebarCollapseBtn {
        display: none;
    }

    /* Content always full-width on mobile */
    .content,
    body.sidebar-collapsed .content {
        margin-left: 0 !important;
        padding: 20px;
    }

    /* Show hamburger toggle button */
    .sidebar-toggle {
        display: block;
    }
}
.requirement-list {
    padding-left: 18px;
    margin-bottom: 8px;
}

.requirement-list li {
    font-size: 13px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-req {
    color: red;
    text-decoration: none;
    font-size: 12px;
    margin-left: 10px;
}

.requirement-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.requirement-form input {
    flex: 1;
    padding: 4px 6px;
    font-size: 13px;
}
/* ========== STICKY TABLE HEADERS ========== */
/* Works with DataTables scrollX - header stays fixed while body scrolls */

/* Force scroll wrapper to full width */
.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
    width: 100% !important;
}

/* Sticky header container - pins to top of viewport */
.dataTables_scrollHead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--sidebar-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Header cells */
.dataTables_scrollHeadInner table thead th {
    background: var(--sidebar-bg);
    color: white;
    white-space: nowrap;
    padding: 14px;
}

/* Length menu + filter row above table */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_length select {
    width: auto;
    min-width: 80px;
    margin-bottom: 0;
    padding: 6px 10px;
    display: inline-block;
}

.dataTables_wrapper .dataTables_filter input {
    width: auto;
    min-width: 180px;
    margin-bottom: 0;
    padding: 6px 10px;
    display: inline-block;
}

/* Info and pagination row below table */
.dataTables_wrapper .dataTables_info {
    font-size: 13px;
    color: #64748b;
    padding-top: 8px;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary);
    color: white !important;
    border-color: var(--primary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Non-DataTables tables - plain overflow-x containers */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.table-scroll-wrapper table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--sidebar-bg);
    color: white;
}

/* ========== SIDEBAR LOGO ========== */
.sidebar-logo-wrap {
    padding: 0 12px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    overflow: hidden;
}

/* Full logo - visible when expanded */
.sidebar-logo-full {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    transition: opacity 0.15s ease, max-width 0.25s ease;
    opacity: 1;
}

/* Small icon - hidden when expanded */
.sidebar-logo-icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

/* When collapsed - hide full logo, show icon */
.sidebar.collapsed .sidebar-logo-full {
    display: none;
}

.sidebar.collapsed .sidebar-logo-icon {
    display: flex;
}

/* ========== FADE ANIMATION ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, table {
    animation: fadeIn 0.4s ease;
}