/* ================================
   Ledger Page - Independent Styles
================================ */
.ledger-page {
  font-family: Arial, sans-serif;
  background: #f4f6f9;
  color: #333;
  padding: 10px;
}

.ledger-page h3 {
  margin-bottom: 20px;
  color: #222;
  font-weight: 600;
}

.ledger-page form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  background: #fff;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.ledger-page input[type="date"],
.ledger-page input[type="submit"] {
  font-size: 14px;
}

.ledger-page input[type="date"] {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  flex: 1 1 150px;
  transition: border 0.18s ease;
}

.ledger-page input[type="date"]:focus {
  border-color: #007bff;
  outline: none;
}

.ledger-page input[type="submit"] {
  padding: 10px 20px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.18s ease;
}

.ledger-page input[type="submit"]:hover {
  background: #0056b3;
}

/* ===== Table Container ===== */
.ledger-page .table-container {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  background: #fff;
  overflow-x: hidden; /* prevent horizontal scroll */
}

/* ===== Table Base ===== */
.ledger-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
  word-wrap: break-word; /* allow wrapping */
}

.ledger-page thead th {
  padding: 12px 10px;
  text-align: left;
  background: linear-gradient(to right, #f8fafc, #eef2f7);
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #e8eef6;
  white-space: normal;
}

.ledger-page tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid #f0f3f6;
  vertical-align: middle;
  white-space: normal;
}

/* Align amounts (Debit, Credit, Balance) right */
.ledger-page th:nth-last-child(-n+3),
.ledger-page td:nth-last-child(-n+3) {
  text-align: right;
}

/* Zebra stripes */
.ledger-page tbody tr:nth-child(odd) {
  background: #fcfcfc;
}

.ledger-page tbody tr:nth-child(even) {
  background: #f7f9fb;
}

/* Special Rows */
.ledger-page .balance-row td {
  font-weight: 700;
  background: #f0f8ff;
}

.ledger-page .totals-row td {
  font-weight: 700;
  background: #e8fbe8;
}

/* Rounded corners for table */
.ledger-page thead th:first-child {
  border-top-left-radius: 12px;
}

.ledger-page thead th:last-child {
  border-top-right-radius: 12px;
}

.ledger-page tbody tr:last-of-type td:first-child {
  border-bottom-left-radius: 12px;
}

.ledger-page tbody tr:last-of-type td:last-child {
  border-bottom-right-radius: 12px;
}

/* ===== Mobile View ===== */
@media (max-width: 768px) {
  .ledger-page table,
  .ledger-page thead,
  .ledger-page tbody,
  .ledger-page th,
  .ledger-page td,
  .ledger-page tr {
    display: block;
  }

  .ledger-page thead {
    display: none;
  }

  .ledger-page tbody tr {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }

  .ledger-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    text-align: left;
  }

  .ledger-page tbody td:last-child {
    border-bottom: 0;
  }

  .ledger-page tbody td::before {
    content: attr(data-label);
    flex: 0 0 48%;
    font-weight: 600;
    color: #555;
    padding-right: 8px;
  }

  .ledger-page tbody td>* {
    flex: 1 0 52%;
    text-align: right;
  }

  @media (max-width: 400px) {
    .ledger-page tbody td::before {
      flex-basis: 46%;
      font-size: 13px;
    }
    .ledger-page tbody td>* {
      font-size: 13px;
    }
    .ledger-page form {
      padding: 12px;
    }
  }
}
