/* ========================================================
   Tripsheet Records - V2 (modern dashboard layout)
   Loaded ONLY by tripsheetrecord.php so other pages
   that depend on the legacy tripsheetrecordstyle.css are
   not affected.
   ======================================================== */

body {
    margin: 0;
    padding: 0;
    background: #eef2f6;
    font-family: 'Inter', 'Segoe UI', 'PT Sans', 'Tahoma', sans-serif;
    color: #1f2933;
    font-size: 15px;
}

.tsr-wrap {
    width: 96%;
    margin: 24px auto;
}

/* ---------- Page header ---------- */
.tsr-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #16222A 100%);
    color: #fff;
    padding: 22px 28px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}
.tsr-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .4px;
}
.tsr-header .tsr-sub {
    font-size: 14px;
    color: #c7d5e0;
    margin-top: 6px;
}
.tsr-header .btn-new {
    background: #fbae17;
    color: #1f2933;
    border: 0;
    padding: 11px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    font-size: 15px;
}
.tsr-header .btn-new:hover { background: #ffc14d; transform: translateY(-1px); }

/* ---------- Filter / KPI card ---------- */
.tsr-card {
    background: #fff;
    padding: 18px 28px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    border-bottom: 1px solid #e6ebef;
}
.tsr-card.tsr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-end;
}
.tsr-field { display: flex; flex-direction: column; min-width: 160px; }
.tsr-field label {
    font-size: 13px;
    color: #607382;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    margin-bottom: 6px;
}
.tsr-field input[type="date"],
.tsr-field select {
    padding: 9px 12px;
    border: 1px solid #cdd5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2933;
    font-size: 15px;
    height: 42px;
    box-sizing: border-box;
}
.tsr-field input:focus, .tsr-field select:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30,136,229,.15);
}
.tsr-field .select2-container .select2-selection--single {
    height: 42px;
    border: 1px solid #cdd5db;
    border-radius: 6px;
}
.tsr-field .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
    padding-left: 12px;
    font-size: 15px;
}
.tsr-field .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

/* Status chips (filter row) */
.tsr-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}
.tsr-chip {
    padding: 9px 18px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e1e8ee;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
}
.tsr-chip:hover { background: #e2e8f0; }
.tsr-chip.active { background: #1e88e5; color: #fff; border-color: #1e88e5; }
.tsr-chip.active.warn { background: #f57c00; border-color: #f57c00; }
.tsr-chip.active.ok   { background: #2e7d32; border-color: #2e7d32; }
.tsr-chip.active.lock { background: #c62828; border-color: #c62828; }
.tsr-chip.active.lh   { background: #6a1b9a; border-color: #6a1b9a; }

/* ---------- KPI tiles ---------- */
.tsr-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    padding: 20px 28px;
    background: #fff;
    border-bottom: 1px solid #e6ebef;
}
.tsr-kpi {
    background: #f8fafc;
    border: 1px solid #e6ebef;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.tsr-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .06);
}
.tsr-kpi .ico {
    width: 48px; height: 48px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22px;
}
.tsr-kpi .lbl { font-size: 13px; color: #607382; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.tsr-kpi .val { font-size: 28px; color: #1f2933; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.tsr-kpi.k-total   .ico { background: #1e88e5; }
.tsr-kpi.k-ongoing .ico { background: #f57c00; }
.tsr-kpi.k-done    .ico { background: #2e7d32; }
.tsr-kpi.k-locked  .ico { background: #c62828; }
.tsr-kpi.k-lh      .ico { background: #6a1b9a; }
.tsr-kpi.k-avg     .ico { background: #00796b; }

/* ---------- Table ---------- */
.tsr-table-wrap {
    background: #fff;
    padding: 0;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    overflow: hidden;
}
.tsr-table-wrap .dataTables_wrapper {
    padding: 18px 28px 26px;
}
#abc {
    width: 100% !important;
    background: #fff;
    border-collapse: collapse;
}
#abc thead th {
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 14px 12px;
    border-bottom: 2px solid #cdd5db;
    text-align: left;
    font-weight: 700;
}
#abc tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #eef2f6;
    font-size: 15px;
    color: #1f2933;
    vertical-align: middle;
    transition: background .12s ease;
}
#abc tbody tr:hover td {
    background: #e0f2fe;                       /* sky-100 - clearly visible */
    box-shadow: inset 0 1px 0 #93c5fd,         /* subtle top/bottom tint */
                inset 0 -1px 0 #93c5fd;
}
#abc tbody tr:hover td:first-child {
    box-shadow: inset 4px 0 0 #1e88e5,         /* left accent bar */
                inset 0 1px 0 #93c5fd,
                inset 0 -1px 0 #93c5fd;
}

/* Cell content patterns */
.cell-gdm {
    display: inline-block;
    padding: 7px 14px;
    background: #eaf3fb;
    color: #0d47a1;
    font-weight: 700;
    border-radius: 6px;
    font-size: 16px;
    min-width: 60px;
    text-align: center;
}
.cell-fyear { font-size: 12px; color: #607382; margin-left: 8px; font-weight: 600; }

.cell-date    { font-weight: 600; color: #1f2933; font-size: 15px; }
.cell-subtext { font-size: 13px; color: #93a4b1; margin-top: 3px; }

.pill {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .3px;
}
.pill-ongoing { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.pill-done    { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.pill-warn    { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }
.pill-info    { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }
.pill-purple  { background: #f3e5f5; color: #4a148c; border: 1px solid #ce93d8; }
.pill-mute    { background: #f1f5f9; color: #607382; border: 1px solid #e1e8ee; }

.cell-vno { font-weight: 700; color: #1f2933; font-size: 15px; }
.cell-vno i { color: #1e88e5; margin-right: 8px; font-size: 16px; }

.cell-person { line-height: 1.35; }
.cell-person .nm { font-weight: 600; color: #1f2933; font-size: 15px; }
.cell-person .ph { font-size: 13px; color: #607382; margin-top: 2px; }

.stat-mini {
    display: inline-block;
    margin-right: 7px;
    padding: 5px 10px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #1f2933;
    font-size: 14px;
    font-weight: 600;
    min-width: 58px;
    text-align: center;
}
.stat-mini .u { color: #607382; font-size: 11px; margin-left: 4px; font-weight: 500; }
.stat-mini.lr  { background: #eaf3fb; color: #0d47a1; }
.stat-mini.pkg { background: #fff3e0; color: #e65100; }
.stat-mini.wt  { background: #e8f5e9; color: #1b5e20; }

.flags { display: flex; gap: 5px; flex-wrap: wrap; }

.act-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.act-btn {
    width: 38px; height: 38px;
    border: 1px solid #e1e8ee;
    background: #f8fafc;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #475569;
    font-size: 16px;
    transition: all .15s ease;
}
.act-btn:hover { background: #1e88e5; color: #fff; border-color: #1e88e5; }
.act-btn.disabled,
.act-btn[disabled] { background: #f1f5f9; color: #c0cad3; cursor: not-allowed; border-color: #e1e8ee; }
.act-btn.disabled:hover { background: #f1f5f9; color: #c0cad3; }
.act-btn.del:hover { background: #c62828; border-color: #c62828; }
.act-btn.lh:hover  { background: #6a1b9a; border-color: #6a1b9a; }
.act-btn.lock-on   { background: #ffebee; color: #c62828; border-color: #ef9a9a; }
.act-btn.lock-off  { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }

/* DataTables tweaks */
.dataTables_wrapper { font-size: 15px; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { font-size: 14px; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 8px 12px;
    border: 1px solid #cdd5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}
.dataTables_wrapper .dataTables_filter input { min-width: 260px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px !important;
    font-size: 14px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #1e88e5 !important;
    color: #fff !important;
    border-color: #1e88e5 !important;
}
.dataTables_wrapper .dt-buttons .btn,
.dataTables_wrapper .dt-buttons .dt-button {
    background: #2e7d32 !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 6px !important;
    padding: 8px 18px !important;
    margin-right: 6px !important;
    box-shadow: none !important;
    font-size: 14px !important;
}
.dataTables_wrapper .dt-buttons .btn:hover,
.dataTables_wrapper .dt-buttons .dt-button:hover { background: #1b5e20 !important; }

/* ---------- Modal (centered, card-style) ---------- */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    animation: fadeIn .2s ease;
}
.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 720px;
    margin: 80px auto;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
    animation: popIn .25s ease;
}
.modal-header {
    background: linear-gradient(135deg, #1e88e5, #0d47a1);
    color: #fff;
    padding: 16px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { margin: 0; font-size: 19px; font-weight: 700; }
.modal-body { padding: 26px; }
.modal-footer {
    padding: 14px 26px;
    background: #f1f5f9;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    letter-spacing: .4px;
}
.modal-close {
    cursor: pointer;
    color: #fff;
    font-size: 26px;
    background: transparent;
    border: 0;
    line-height: 1;
}
.modal-block {
    border: 1px solid #e6ebef;
    border-radius: 8px;
    padding: 16px 18px;
    background: #fafbfc;
}
.modal-block h4 {
    margin: 0 0 12px;
    font-size: 14px;
    text-transform: uppercase;
    color: #1e88e5;
    letter-spacing: .5px;
    font-weight: 700;
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 15px;
}
.modal-row .k { color: #607382; font-weight: 600; }
.modal-row .v { color: #1f2933; font-weight: 500; word-break: break-word; }

@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
@keyframes popIn  { from {opacity:0; transform: scale(.96) translateY(8px);} to {opacity:1; transform: scale(1) translateY(0);} }

/* Small screens */
@media (max-width: 900px) {
    .tsr-chips { margin-left: 0; }
    .modal-grid { grid-template-columns: 1fr; }
}
