/* =========================================================
   MCM Timesheet - custom styles
   Palette: brand #E63946, surface #F8F9FA
   ========================================================= */

* { -webkit-tap-highlight-color: transparent; }

body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

/* Scrollbar halus */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- Sidebar collapse (toggle di desktop) ---- */
@media (min-width: 1024px) {
  body.sidebar-collapsed #sidebar { transform: translateX(-100%) !important; }
  body.sidebar-collapsed #main-wrap { margin-left: 0 !important; }
}

/* =========================================================
   DataTables 2.x overrides  (DT2 pakai class .dt-*)
   Kartu tabel rapi: kontrol atas/bawah punya padding,
   tabel flush ke tepi, header ada tint.
   ========================================================= */

/* Layout rows: baris kontrol atas, tabel, baris kontrol bawah */
.dt-container, .dataTables_wrapper { width: 100%; }

/* Baris atas (length + search) */
.dt-layout-row:first-child {
    padding: 1.125rem 1.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
/* Baris bawah (info + paging) */
.dt-layout-row:last-child {
    padding: 1rem 1.5rem 1.125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-top: 1px solid #f1f5f9;
}
/* Baris tabel: tanpa padding, tabel menempel penuh */
.dt-layout-row.dt-layout-table { padding: 0; }
.dt-layout-cell { padding: 0; }

/* Label & teks kontrol */
.dt-length, .dt-search, .dt-info, .dt-paging {
    color: #475569;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Input search & select length */
.dt-search input,
.dt-length select {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.dt-search input { min-width: 15rem; }
.dt-search input:focus,
.dt-length select:focus {
    border-color: #E63946;
    box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
}

/* Tabel */
table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0;
    width: 100% !important;
    margin: 0 !important;
}
table.dataTable thead th {
    background: #f1f5f9;
    border-bottom: 1px solid #e5e7eb !important;
    border-top: 1px solid #e5e7eb;
    padding: 0.95rem 1.5rem !important;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}
table.dataTable thead th:first-child { border-top-left-radius: 0; }
table.dataTable tbody td {
    padding: 1rem 1.5rem !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #334155;
    vertical-align: middle;
}
table.dataTable tbody tr:last-child td { border-bottom: 0 !important; }
table.dataTable tbody tr:hover td { background-color: #fef2f3; }

/* Pagination (DT2.1.8: .dt-paging-button) — disamakan dgn pagination dashboard.
   Struktur DT2: <div class="dt-paging"><nav>…tombol…</nav></div>, jadi:
   - flex/gap ditanam di <nav> (bukan di .dt-paging) supaya jarak antar tombol rata.
   - selector diberi prefix "div.dt-container" agar specificity-nya SERI dgn rule
     bawaan DT2 (div.dt-container .dt-paging .dt-paging-button.current = 0,0,4,1,
     dengan color:inherit !important). app.css dimuat setelah CSS DT2, jadi pada
     seri, rule kita menang — warna font aktif jadi putih. */

/* <nav> jadi flex container: gap seragam, tombol rata kanan (sesuai posisi cell). */
.dt-paging nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

div.dt-container .dt-paging .dt-paging-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem !important;
    height: 2rem !important;
    padding: 0 0.5rem !important;
    margin: 0 !important;
    border-radius: 0.5rem !important;
    border: 1px solid #e5e7eb !important;
    background: #fff !important;
    color: #4b5563 !important;
    font-size: 0.8rem;
    line-height: 1;
    text-align: center;
    transition: background-color .15s, border-color .15s, color .15s;
}
div.dt-container .dt-paging .dt-paging-button:hover {
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
    color: #4b5563 !important;
}
div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
    background: #E63946 !important;
    border-color: #E63946 !important;
    color: #fff !important;
}
div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover {
    background: #f9fafb !important;
    border-color: #f1f5f9 !important;
    color: #d1d5db !important;
    cursor: not-allowed;
    opacity: 1;
}
/* Ellipsis (…): <span class="ellipsis"> — tanpa border/bg, teks pudar, sejajar dgn tombol. */
.dt-paging .ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    border: 0 !important;
    background: transparent !important;
    color: #9ca3af !important;
    cursor: default;
}

/* Sorting indicator warna saat aktif */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after { opacity: 0.5; }
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc { color: #E63946; }

/* ---- Loading skeleton ---- */
.skeleton {
    display: inline-block;
    background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 37%, #eef0f3 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: 6px;
    height: 12px;
    width: 100%;
}
@keyframes skeleton-loading {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* loading overlay global */
.loading-overlay {
    position: fixed; inset: 0; background: rgba(255,255,255,0.5);
    display: none; align-items: center; justify-content: center; z-index: 50;
}
.loading-overlay.show { display: flex; }

/* ---- Action dropdown (kolom Aksi tabel) ---- */
.action-toggle--open { background: #f1f5f9; color: #334155; }
.action-menu-panel {
    position: fixed; z-index: 35; min-width: 12rem;
    background: #fff; border: 1px solid #f1f5f9; border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,.12), 0 8px 10px -6px rgba(0,0,0,.08);
    padding: 0.25rem;
}
