/* ============================================================
   HATCHIKO LOAD VALIDATOR — Custom Stylesheet
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 60px;
    --primary: #4361ee;
    --primary-dark: #3451d1;
    --secondary: #6c757d;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #17a2b8;
    --sidebar-bg: #1a1f37;
    --sidebar-text: #a0aec0;
    --sidebar-active: #4361ee;
    --sidebar-hover: rgba(255,255,255,0.07);
    --card-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f8;
    color: #2d3748;
    overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

/* Brand / Logo */
.sidebar-brand {
    padding: 20px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 80px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.sidebar-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    max-height: 48px;
    object-fit: contain;
    object-position: left center;
    filter: brightness(1.1);
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-logo { max-width: 40px; }

/* User Info */
.sidebar-user {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar {
    font-size: 28px;
    color: var(--sidebar-text);
    min-width: 32px;
    text-align: center;
}

.user-info { overflow: hidden; transition: var(--transition); white-space: nowrap; }
.sidebar.collapsed .user-info { opacity: 0; width: 0; }

.user-name {
    display: block;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    background: rgba(67,97,238,0.3);
    color: #93c5fd;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-title {
    padding: 12px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(160,174,192,0.5);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
}

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

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin: 2px 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    min-width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link span {
    transition: var(--transition);
    opacity: 1;
}

.sidebar.collapsed .sidebar-nav .nav-link span {
    opacity: 0;
    width: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
    transform: translateX(3px);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--sidebar-active), #7c3aed);
    color: #fff;
    box-shadow: 0 4px 15px rgba(67,97,238,0.4);
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: #fff;
    border-radius: 0 3px 3px 0;
}

/* Footer */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #fc8181;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.btn-logout:hover {
    background: rgba(252,129,129,0.15);
    color: #fc8181;
}

.sidebar.collapsed .btn-logout span { opacity: 0; width: 0; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.main-wrapper.expanded { margin-left: var(--sidebar-collapsed); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    font-size: 22px;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    line-height: 1;
}

.btn-toggle-sidebar:hover {
    background: #f1f5f9;
    color: var(--primary);
}

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

.topbar-clock {
    font-size: 13px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.topbar-user {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
    flex: 1;
    padding: 28px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-hover); }

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    border-radius: var(--card-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    cursor: default;
    box-shadow: var(--shadow);
    color: #fff;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-card.stat-blue   { background: linear-gradient(135deg, #4361ee, #3a0ca3); }
.stat-card.stat-green  { background: linear-gradient(135deg, #27ae60, #1a7842); }
.stat-card.stat-purple { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.stat-card.stat-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card.stat-teal   { background: linear-gradient(135deg, #0891b2, #06b6d4); }

.stat-icon {
    font-size: 36px;
    opacity: 0.9;
    min-width: 48px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 4px;
}

.stat-bg-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 80px;
    opacity: 0.08;
    line-height: 1;
    pointer-events: none;
}

/* Mini stat cards */
.mini-stat-card {
    border-radius: var(--card-radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}

.mini-stat-card:hover { transform: translateY(-2px); }
.mini-stat-icon { font-size: 28px; }
.mini-stat-val { font-size: 22px; font-weight: 700; line-height: 1; }
.mini-stat-lbl { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ============================================================
   TABLES
   ============================================================ */
.table { font-size: 14px; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.btn-xs {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 6px;
}

/* ============================================================
   REPORT STATUS BADGES & ROW STYLES
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-pending {
    background: #fef9c3;
    color: #92400e;
    border: 1px solid #fde68a;
    animation: pulse-pending 2s ease-in-out infinite;
}

.status-done {
    background: #dcfce7;
    color: #14532d;
    border: 1px solid #86efac;
}

@keyframes pulse-pending {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,0.3); }
    50%       { box-shadow: 0 0 0 5px rgba(251,191,36,0); }
}

/* Row tint */
tr.row-pending td { border-left: 3px solid #f59e0b; }
tr.row-done   td  { border-left: 3px solid #22c55e; }

/* Done modal deduction table */
#doneModal .table td, #doneModal .table th { vertical-align: middle; }
#doneModal .deduction-input { font-weight: 700; }

/* Highlight negative remaining */
.text-danger { color: #dc2626 !important; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1f37 0%, #2d3561 50%, #1a1f37 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Animated particles */
.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    animation: float linear infinite;
}

.particle:nth-child(1)  { width:80px; height:80px; left:10%; top:20%; animation-duration:8s; animation-delay:0s; }
.particle:nth-child(2)  { width:120px; height:120px; left:30%; top:60%; animation-duration:12s; animation-delay:1s; }
.particle:nth-child(3)  { width:60px; height:60px; left:60%; top:10%; animation-duration:10s; animation-delay:2s; }
.particle:nth-child(4)  { width:200px; height:200px; left:70%; top:50%; animation-duration:15s; animation-delay:0.5s; }
.particle:nth-child(5)  { width:40px; height:40px; left:80%; top:20%; animation-duration:7s; animation-delay:3s; }
.particle:nth-child(6)  { width:100px; height:100px; left:5%; top:70%; animation-duration:11s; animation-delay:1.5s; }
.particle:nth-child(7)  { width:150px; height:150px; left:45%; top:30%; animation-duration:14s; animation-delay:0.3s; }
.particle:nth-child(8)  { width:50px; height:50px; left:90%; top:80%; animation-duration:9s; animation-delay:2.5s; }
.particle:nth-child(9)  { width:70px; height:70px; left:20%; top:40%; animation-duration:13s; animation-delay:4s; }

@keyframes float {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0.04; }
    50%  { opacity: 0.08; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.login-logo-wrap {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.login-logo {
    max-width: 200px;
    max-height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h4 {
    font-weight: 800;
    color: #1e293b;
    font-size: 20px;
    margin-bottom: 4px;
}

.login-header p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
}

.btn-login {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: var(--transition);
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(67,97,238,0.4); color: #fff; }
.btn-login:hover::before { opacity: 1; }
.btn-login:active { transform: translateY(0); }

.pwd-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    z-index: 10;
    font-size: 16px;
}

.login-time {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
    border: 2.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8fafc;
    position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(67,97,238,0.04);
}

.upload-zone.has-file {
    border-color: var(--success);
    background: rgba(39,174,96,0.04);
}

.upload-zone-icon { font-size: 48px; color: #94a3b8; margin-bottom: 12px; }
.upload-zone.drag-over .upload-zone-icon { color: var(--primary); }
.upload-zone.has-file .upload-zone-icon { color: var(--success); }

.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ============================================================
   VALIDATION RECEIPT
   ============================================================ */
.receipt-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid #4361ee;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.receipt-logo {
    max-width: 180px;
    max-height: 50px;
    object-fit: contain;
    margin-bottom: 8px;
}

.receipt-title {
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-size: 16px;
}

.receipt-subtitle {
    color: #64748b;
    font-size: 12px;
    margin: 0;
}

.receipt-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.receipt-stats {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.receipt-stat-item {
    flex: 1;
    min-width: 80px;
    max-width: 130px;
    text-align: center;
    padding: 12px 8px;
    border-radius: 10px;
}

.receipt-stat-item.total   { background: #eff6ff; border: 1px solid #bfdbfe; }
.receipt-stat-item.valid   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.receipt-stat-item.invalid { background: #fff5f5; border: 1px solid #fecaca; }
.receipt-stat-item.amount  { background: #fefce8; border: 1px solid #fde68a; }

.stat-n {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    color: #1e293b;
}

.stat-l {
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
}

.receipt-table { font-size: 12px; }
.receipt-table th { font-size: 11px; }

/* Balance rows */
.balance-row {
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.balance-row.balance-ok    { background: #f0fdf4; border: 1px solid #bbf7d0; }
.balance-row.balance-error { background: #fff5f5; border: 1px solid #fecaca; }

.balance-min { font-weight: 700; font-size: 13px; min-width: 130px; }
.balance-details { font-size: 13px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-illustration {
    font-size: 64px;
    color: #cbd5e1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.05); }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes shimmer {
    0%   { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}

.animate-slide-left  { animation: slideInLeft  0.4s ease forwards; }
.animate-slide-up    { animation: slideInUp    0.4s ease forwards; }
.animate-fade        { animation: fadeIn        0.4s ease forwards; }

/* Page transition */
.page-content { animation: fadeIn 0.3s ease; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .page-content { padding: 16px; }
    .topbar-clock { display: none; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.font-monospace { font-family: 'Courier New', Courier, monospace !important; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 4px 8px;
}

.page-link { border-radius: 6px !important; }

/* Toastr overrides */
#toast-container .toast { border-radius: 10px !important; }

/* SweetAlert2 */
.swal2-popup { border-radius: 16px !important; }
.swal2-confirm { border-radius: 8px !important; }
.swal2-cancel  { border-radius: 8px !important; }

/* Form floating */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}

/* Badges */
.badge { border-radius: 6px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active { display: block; }

/* ============================================================
   RECORDED OVERLAY (post-validation redirect animation)
   ============================================================ */
.recorded-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0);
    backdrop-filter: blur(0px);
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

.recorded-overlay--visible {
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
}

.recorded-box {
    background: #fff;
    border-radius: 20px;
    padding: 40px 48px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    max-width: 380px;
    width: 90%;
    transform: scale(0.75) translateY(30px);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity   0.35s ease;
}

.recorded-box--in {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* SVG checkmark */
.recorded-icon {
    margin-bottom: 18px;
}

.recorded-checkmark {
    width: 72px;
    height: 72px;
}

.checkmark-circle {
    stroke: #22c55e;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke-circle 0.5s cubic-bezier(0.65,0,0.45,1) 0.2s forwards;
}

.checkmark-check {
    stroke: #22c55e;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke-check 0.4s cubic-bezier(0.65,0,0.45,1) 0.65s forwards;
}

@keyframes stroke-circle {
    to { stroke-dashoffset: 0; }
}

@keyframes stroke-check {
    to { stroke-dashoffset: 0; }
}

.recorded-title {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 6px;
}

.recorded-sub {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Progress bar */
.recorded-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 14px;
}

.recorded-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #4361ee, #22c55e);
    border-radius: 99px;
}

.recorded-redirect {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
}

.recorded-redirect strong {
    color: #4361ee;
    font-size: 15px;
}
