/* ================================================================
   MTI Attendance — Custom overrides on top of Bootstrap 5
   Sidebar, topbar, and component tweaks only.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --sidebar-width:    230px;
    --sidebar-bg:       #1e2d5a;
    --sidebar-active:   #4361ee;
    --topbar-height:    56px;
    --accent:           #4361ee;
}

/* ── Global ─────────────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #f0f2f8;
    font-size: 14px;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.25s ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: 64px;
}
.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-link span {
    display: none;
}
.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 16px 8px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; color: #fff;
    flex-shrink: 0;
}

.brand-name {
    font-size: 16px; font-weight: 700; color: #fff; line-height: 1.1;
}
.brand-sub {
    font-size: 10px; color: rgba(255,255,255,0.5);
    text-transform: uppercase; letter-spacing: 0.8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 8px;
    gap: 2px;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    color: rgba(255,255,255,0.70);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav .nav-link i {
    font-size: 15px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.sidebar-nav .nav-link.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 3px 10px rgba(67,97,238,0.4);
}
.nav-logout:hover {
    background: rgba(220,53,69,0.15) !important;
    color: #ff7a90 !important;
}
.sidebar-divider {
    border-color: rgba(255,255,255,0.08);
    margin: 6px 4px;
}

/* ── Main Wrapper ───────────────────────────────────────────── */
.main-wrapper {
    min-height: 100vh;
    overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle-btn {
    border: 1px solid #e2e8f0;
}

/* ── Content ────────────────────────────────────────────────── */
.content {
    padding-top: 20px;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}
.stat-icon-box {
    width: 52px; height: 52px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.card-header {
    background: #f8faff;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0 !important;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 14px;
}

/* ── Avatar/initials ────────────────────────────────────────── */
.emp-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.emp-initials {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #eef1fd;
    color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}

/* ── Activity feed ──────────────────────────────────────────── */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #eef1fd;
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e2d5a 0%, #4361ee 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    max-width: 420px;
    width: 100%;
}
.login-icon-wrap {
    width: 52px; height: 52px;
    background: var(--accent);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
}

/* ── Table enhancements ─────────────────────────────────────── */
.table thead th {
    background: #f8faff;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7a99;
    white-space: nowrap;
    vertical-align: middle;
}
.table tbody td {
    vertical-align: middle;
}
.table-hover tbody tr:hover > td {
    background: #f6f8ff;
}

/* ── Pulse/live badge ───────────────────────────────────────── */
.pulse-dot {
    display: inline-block;
    width: 7px; height: 7px;
    background: #0da564;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.5; transform:scale(.75); }
}

/* ── Map heights ────────────────────────────────────────────── */
#dashboard-map  { height: 380px; border-radius: 10px; }
#qr-map         { height: 300px; border-radius: 10px; }
#picker-map     { height: 300px; border-radius: 10px; }
#live-map       { height: calc(100vh - 76px); min-height: 500px; }

/* ── QR show page ───────────────────────────────────────────── */
.qr-img { max-width: 240px; width: 100%; }

/* ── Responsive sidebar ─────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: 64px;
    }
    .brand-name, .brand-sub, .nav-link span { display: none; }
    .sidebar-brand { justify-content: center; padding: 14px 8px; }
}

/* ================================================================
   DataTables — Full UI overrides (Bootstrap 5 skin fix)
   ================================================================ */

/* ── Toolbar & Footer containers ───────────────────────────── */
.dt-toolbar {
    border-bottom: 1px solid #e9ecef;
    background: #fafbff;
    border-radius: 12px 12px 0 0;
}
.dt-footer {
    border-top: 1px solid #e9ecef;
    background: #fafbff;
    border-radius: 0 0 12px 12px;
    min-height: 52px;
}

/* ── Export Buttons (CSV & Print) ──────────────────────────── */
/* Reset all DataTables default button styles */
/* Buttons group gap */
.dt-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dt-buttons .dt-export-btn,
.dt-buttons .dt-export-btn:hover,
.dt-buttons .dt-export-btn:focus,
.dt-buttons .dt-export-btn:active {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    line-height: 1.5;
}
/* PDF button — subtle red accent */
.dt-buttons .dt-export-pdf {
    border-color: #fca5a5;
    color: #dc2626;
}
.dt-buttons .dt-export-pdf:hover {
    background: #fff5f5 !important;
    border-color: #f87171 !important;
    color: #b91c1c !important;
}
.dt-buttons .dt-export-btn:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08) !important;
}
.dt-buttons .dt-export-btn:active {
    background: #e2e8f0 !important;
    transform: translateY(1px) !important;
}
/* Ensure Bootstrap Icons render inside buttons */
.dt-buttons .dt-export-btn i {
    font-size: 14px;
    line-height: 1;
}

/* ── Show entries (length) select ──────────────────────────── */
div.dataTables_length select {
    display: inline-block;
    padding: 4px 28px 4px 10px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #374151;
    appearance: auto;
    cursor: pointer;
    height: 34px;
    min-width: 70px;
}
div.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

/* ── Search input ───────────────────────────────────────────── */
div.dataTables_filter input {
    display: inline-block;
    padding: 5px 12px 5px 34px;   /* left pad for icon */
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 11px center;
    background-size: 14px;
    color: #374151;
    width: 220px;
    height: 34px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
div.dataTables_filter input:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}
div.dataTables_filter label {
    display: flex;
    align-items: center;
    margin: 0;
    /* hide the 'Search:' text label — the placeholder does this */
    font-size: 0;
}

/* ── Info text ──────────────────────────────────────────────── */
div.dataTables_info {
    font-size: 13px;
    color: #64748b;
    padding: 0;
    line-height: 1.5;
}

/* ── Pagination ─────────────────────────────────────────────── */

/* Wrapper: align right, small gap between buttons */
div.dataTables_paginate {
    margin: 0;
}
div.dataTables_paginate .pagination {
    margin: 0;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
}

/* Every page button — reset Bootstrap defaults, apply custom style */
div.dataTables_paginate .pagination .page-item .page-link,
div.dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* Hover state */
div.dataTables_paginate .pagination .page-item:not(.active):not(.disabled) .page-link:hover,
div.dataTables_paginate .paginate_button:not(.current):not(.disabled):hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #1e293b !important;
}

/* Active / current page */
div.dataTables_paginate .pagination .page-item.active .page-link,
div.dataTables_paginate .paginate_button.current,
div.dataTables_paginate .paginate_button.current:hover {
    background: #4361ee !important;
    border-color: #4361ee !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(67,97,238,0.30) !important;
}

/* Disabled prev/next */
div.dataTables_paginate .pagination .page-item.disabled .page-link,
div.dataTables_paginate .paginate_button.disabled,
div.dataTables_paginate .paginate_button.disabled:hover {
    background: #f8fafc !important;
    border-color: #e9ecef !important;
    color: #c4c9d4 !important;
    cursor: default !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

/* Chevron icon buttons — slightly smaller text */
div.dataTables_paginate .paginate_button.previous,
div.dataTables_paginate .paginate_button.next {
    font-size: 12px !important;
}

/* Ensure <span> page numbers inside .paginate_button render correctly */
.dataTables_paginate span {
    display: flex;
    align-items: center;
    gap: 4px;
}


/* ── Table wrapper (remove extra padding DataTables adds) ───── */
div.dataTables_wrapper div.row {
    margin: 0;
}
div.dataTables_wrapper div.row > div {
    padding: 0;
}
