/* app/static/css/app.css */

/* ---------- Global page polish ---------- */
:root{
  --card-radius: 0.75rem;
  --card-border: rgba(0,0,0,.08);
}

body.bg-light{
  background: #f6f7fb !important;
}

.card{
  border-radius: var(--card-radius);
  border-color: var(--card-border);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.card .card-body{
  padding: 1rem;
}

h1.h4{
  letter-spacing: -0.2px;
}

/* Buttons: consistent compact look */
.btn.btn-sm{
  border-radius: 0.6rem;
}

/* Form controls: subtle consistency */
.form-control, .form-select{
  border-radius: 0.65rem;
}
.form-control:focus, .form-select:focus{
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.12);
}

/* ---------- DataTables Bootstrap polish ---------- */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input{
  border-radius: 0.65rem;
}

.dataTables_wrapper .dataTables_filter input{
  margin-left: .5rem !important;
  width: 220px;
}

table.dataTable.table{
  margin-top: .75rem !important;
  margin-bottom: .75rem !important;
}

table.dataTable thead th{
  font-size: .82rem;
  text-transform: none;
  color: #475569;
  border-bottom: 1px solid rgba(0,0,0,.08) !important;
}

table.dataTable tbody td{
  vertical-align: middle;
}

.dataTables_wrapper .dataTables_info{
  font-size: .85rem;
  color: #64748b;
  padding-top: .35rem;
}

.dataTables_wrapper .dataTables_paginate .pagination{
  margin: .25rem 0 0 0;
}

.dataTables_wrapper .dataTables_paginate .page-link{
  border-radius: 0.6rem !important;
}

/* Make the table feel less cramped on wide screens */
@media (min-width: 992px){
  table.dataTable td, table.dataTable th{
    padding-top: .55rem;
    padding-bottom: .55rem;
  }
}

/* ---------- Toast polish ---------- */
.toast{
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
}

/* ---------- Empty state component ---------- */
.empty-state{
  border: 1px dashed rgba(2, 6, 23, 0.18);
  background: rgba(255,255,255,0.7);
  border-radius: 0.9rem;
  padding: 1rem;
}

.empty-state .empty-icon{
  width: 44px;
  height: 44px;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(13,110,253,0.08);
  color: #0d6efd;
  font-size: 1.2rem;
}

.empty-state .empty-title{
  font-weight: 700;
  letter-spacing: -0.2px;
}

.empty-state .empty-desc{
  color: #64748b;
  font-size: .92rem;
}

.badge{
  border-radius: 0.6rem;
}

/* Transactions: sticky totals + pager footer */
.tx-sticky-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;

  /* ensure it looks like part of the card */
  background: var(--bs-body-bg);
  padding-top: .5rem;

  /* subtle separation from table rows */
  border-top: 1px solid rgba(0,0,0,.1);
}

/* If you use dark mode, border should still be visible */
[data-bs-theme="dark"] .tx-sticky-footer {
  border-top-color: rgba(255,255,255,.15);
}

/* Make the table scroll so the footer sticks within the card */
.tx-table-scroll {
  max-height: 60vh;       /* adjust if you want */
  overflow: auto;
}


/* =========================
   PETTY CASH PRINT STYLES
   ========================= */

.petty-print-container {
  background: #fff;
  padding: 1rem;
  color: #000;
}

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.report-meta {
  text-align: right;
}

.petty-table th,
.petty-table td {
  font-size: 12px;
  vertical-align: middle;
}

.totals-wrap {
  margin-top: 1rem;
}

.signature-row {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
}

.sig-line {
  width: 240px;
  border-bottom: 1px solid #000;
  margin-bottom: 0.25rem;
}

/* Print behavior */
@media print {
  nav,
  .btn,
  .alert,
  .tx-sticky-footer,
  footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .petty-print-container {
    padding: 0;
  }

  table {
    page-break-inside: avoid;
  }
}


/* =========================================================
   Dashboard KPI – Professional Polish
   Mini KPI box inside KPI cards
   ========================================================= */

/* Base KPI card refinement */
.kpi-card {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

/* KPI header row (title + mini KPI) */
.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.kpi-title {
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Mini KPI box (percentage) */
.mini-kpi {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0.35rem 0.6rem;
  min-width: 92px;

  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.035);

  line-height: 1.05;
}

.mini-kpi .mini-val {
  font-weight: 700;
  font-size: 0.95rem;
}

.mini-kpi .mini-cap {
  font-size: 0.7rem;
  opacity: 0.75;
  margin-top: 0.15rem;
  white-space: nowrap;
}


/* Dark mode support (Bootstrap 5 theme-aware) */
[data-bs-theme="dark"] .kpi-card {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

[data-bs-theme="dark"] .mini-kpi {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
/* =========================================================
   KPI Mini Pill: thresholds + animation + spacing
   ========================================================= */

:root {
  --kpi-pill-good-bg: rgba(25, 135, 84, 0.10);
  --kpi-pill-good-br: rgba(25, 135, 84, 0.28);
  --kpi-pill-warn-bg: rgba(255, 193, 7, 0.14);
  --kpi-pill-warn-br: rgba(255, 193, 7, 0.36);
  --kpi-pill-bad-bg:  rgba(220, 53, 69, 0.12);
  --kpi-pill-bad-br:  rgba(220, 53, 69, 0.35);
}

[data-bs-theme="dark"] {
  --kpi-pill-good-bg: rgba(25, 135, 84, 0.20);
  --kpi-pill-warn-bg: rgba(255, 193, 7, 0.22);
  --kpi-pill-bad-bg:  rgba(220, 53, 69, 0.22);
}

/* consistent padding + height */
.kpi-card .card-body {
  padding: 1.05rem 1.1rem;
  min-height: 116px;
}

.kpi-card .fs-4,
.kpi-card .fs-5 {
  letter-spacing: -0.2px;
}

.mini-kpi {
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
  will-change: background-color, border-color, transform;
}

.mini-kpi.good { background: var(--kpi-pill-good-bg); border-color: var(--kpi-pill-good-br); }
.mini-kpi.warn { background: var(--kpi-pill-warn-bg); border-color: var(--kpi-pill-warn-br); }
.mini-kpi.bad  { background: var(--kpi-pill-bad-bg);  border-color: var(--kpi-pill-bad-br);  }

/* subtle “pop” when value changes */
.mini-kpi.pulse {
  transform: scale(1.03);
}

/* smoother compare text spacing */
.kpi-card .small.text-muted {
  margin-top: .2rem;
}

/* TomSelect optgroup headers (Posting Category) */
.ts-dropdown .optgroup-header {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #6c757d;              /* muted gray */
  padding: 6px 10px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

/* Add spacing between groups */
.ts-dropdown .optgroup {
  margin-bottom: 4px;
}


/* Subtotal row styling */
.subtotal-row td {
  background: rgba(0,0,0,.035);
  font-weight: 600;
}
.subtotal-row .subtotal-label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: rgba(0,0,0,.035);
}

.section-subtotal-row td {
  background: rgba(0,0,0,.06);
  font-weight: 700;
  border-top: 2px solid rgba(0,0,0,.10);
}
.section-subtotal-row td:first-child {
  white-space: nowrap;
}


