@import url("https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap");

/* ======================================================
   Global Reset & Typography
   ====================================================== */
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  font-family: "Roboto Condensed", sans-serif;
  font-optical-sizing: auto;
  font-weight: normal;
  font-style: normal;
}

/* ===============================
   Viewport Height Layout (ADDED)
   =============================== */
html,
body {
  height: 100%;
}

body {
  background-color: #f8f9fa;
  display: flex;
  flex-direction: column;
}

/* Wrapper used in index.php */
.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ======================================================
   Headings
   ====================================================== */
.page-title {
  font-weight: 600;
}

/* ======================================================
   Cards
   ====================================================== */
.card {
  border-radius: 16px;
  border: none;
}

/* ======================================================
   Form Controls
   ====================================================== */
.form-control,
.form-select {
  border-radius: 10px;
  height: 38px;
}

/* ======================================================
   Load Button (Icon Only)
   ====================================================== */
.load-btn {
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ======================================================
   Table Card (ENHANCED)
   ====================================================== */
.table-card {
  border-radius: 18px;
  overflow: hidden;
  flex: 1;                    /* 🔑 fill remaining height */
  display: flex;
  flex-direction: column;
}

/* ======================================================
   Scrollable Table Wrapper (FORCE X + Y SCROLL)
   ====================================================== */
.table-wrapper {
  display: block;
  width: 100%;
  flex: 1;                    /* 🔑 grow inside card */
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
}

/* ======================================================
   Modern Table
   ====================================================== */
.modern-table {
  width: 100%;
  min-width: 1000px;
  background-color: #fff;
  border-collapse: separate;
  border-spacing: 0;
}

/* ======================================================
   Table Header
   ====================================================== */
.modern-table thead {
  background: linear-gradient(135deg, #212529, #343a40);
  color: #fff;
}

.modern-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 16px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  white-space: nowrap;
}

/* Rounded header corners */
.modern-table thead th:first-child {
  border-top-left-radius: 18px;
}
.modern-table thead th:last-child {
  border-top-right-radius: 18px;
}

/* ======================================================
   Table Body
   ====================================================== */
.modern-table tbody td {
  padding: 14px 16px;
  font-size: 0.95rem;
  border-top: 1px solid #e9ecef;
  vertical-align: middle;
  white-space: nowrap;
}

/* Hover effect */
.modern-table tbody tr:hover {
  background-color: #f1f5ff;
}

/* Amount column */
.modern-table td.text-end {
  font-weight: 600;
  color: #0d6efd;
}

/* Empty state */
.modern-table tbody td.text-muted {
  font-style: italic;
}

/* ======================================================
   Responsive – Large Tablets & Below
   ====================================================== */
@media (max-width: 992px) {
  .modern-table thead th {
    font-size: 0.8rem;
    padding: 12px;
  }

  .modern-table tbody td {
    font-size: 0.9rem;
    padding: 12px;
  }
}

/* ======================================================
   Responsive – Tablets
   ====================================================== */
@media (max-width: 768px) {
  .page-title {
    font-size: 1.25rem;
  }

  .modern-table {
    font-size: 0.9rem;
  }
}

/* ======================================================
   Responsive – Mobile (CARD MODE)
   ====================================================== */
@media (max-width: 576px) {

  /* Disable scrolling on mobile (card layout instead) */
  .table-wrapper {
    max-height: none;
    overflow: visible;
  }

  .modern-table {
    min-width: 100%;
  }

  .modern-table thead {
    display: none;
  }

  .modern-table tbody tr {
    display: block;
    margin-bottom: 14px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
  }

  .modern-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    white-space: normal;
  }

  .modern-table tbody td:last-child {
    border-bottom: none;
  }

  /* Mobile labels */
  .modern-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
    margin-right: 10px;
  }

  /* Load button spacing */
  .load-btn {
    margin-top: 24px;
  }
}
