﻿/*.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    max-width: 15em;
    max-height: 10em;
}

.logo img {
    width: 100%;
    height: 100%;
}

.stock-container 
{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-container 
{
    height: 15vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;

}

.card-container div, .card-container button 
{
    margin: 0 1em;
}

.card-container button
{
    margin-top: 1.5em;
}

.table-container{
    max-width: 95vw;
    height: 50vh;
    overflow-y: auto;
}

.ledger-table 
{
    width: 95vw;
    margin: 0 auto;
    
}

.ledger-table th, .ledger-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.ledger-table th {
    background-color: #f2f2f2;
}

.ledger-table tr{
    width: fit-content;
}

.ledger-table td:nth-child(4), .ledger-table th:nth-child(4) {
    min-width: 50px;
}

.btn-fetch-ledger {
    margin-top: 1em;
}

.is_inValid{*/
    /* date is invalid */
    /*border: 1px solid red;
}

.total-container{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1em;
}

.total{
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-cr{
    margin-right: 1em;
}

.total-dr{
    margin-left: 1em;
}

.balance{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 1em;
}

.balance-label{
    margin-right: 1em;
}

.balance-value{
    margin-left: 1em;
}



th:nth-child(4), th:nth-child(5) {
    width: 100px;
}

@media (max-width: 768px) {
    .card-container {
        flex-direction: column;
        height: auto;
    }

    .card-container div, .card-container button {
        margin: 0.5em 0;
    }

    .total-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .total, .balance {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .total-cr, .total-dr, .balance-label, .balance-value {
        margin: 0;
    }

    .ledger-table th, .ledger-table td {
        font-size: 0.8em;
        padding: 5px;
    }

    th:nth-child(4), th:nth-child(5) {
        width: 70px;
    }
}

.img-container {
    max-width: 90vw;
    height: auto;
    margin: 0 auto;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.title {
    display: flex;
    justify-content: center;
    align-items: center;
}

.customer-info {
    max-width: 70vw;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ledger-table {
    max-width: 90vw;
    margin: 0 auto;
}*/
/* Apply styles to the entire table */
/*table {
    border-collapse: collapse;*/ /* Combine cell borders */
    /*width: 100%;*/ /* Make the table fill its container */
/*}*/

/* Style table headers */
/*th {
    background-color: #f2f2f2;*/ /* Gray background for headers */
    /*text-align: center;*/ /* Align text to the left */
    /*padding: 8px;*/ /* Add some padding for readability */
    /*border-bottom: 1px solid #ddd;*/ /* Add a bottom border */
/*}*/

/* Style table cells */
/*td {
    padding: 8px;*/ /* Add padding to cells */
    /*border-bottom: 1px solid #ddd;*/ /* Add a bottom border to cells */
/*}

tr {
    padding: 10px;
}*/

    /* Apply a different background color to even rows */
/*tr:last-child {
    background-color: #f2f2f2;
}*/


/* General Ledger Styles */
.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    max-width: 15em;
    max-height: 10em;
}

    .logo img {
        width: 100%;
        height: 100%;
    }

.stock-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-container {
    height: 15vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

    .card-container div, .card-container button {
        margin: 0 1em;
    }

    .card-container button {
        margin-top: 1.5em;
    }

.table-container {
    max-width: 95vw;
    height: 50vh;
    overflow-y: auto;
}

.ledger-table {
    width: 95vw;
    margin: 0 auto;
}

    .ledger-table th, .ledger-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }

    .ledger-table th {
        background-color: #f2f2f2;
    }

    .ledger-table tr {
        width: fit-content;
    }

    .ledger-table td:nth-child(4), .ledger-table th:nth-child(4) {
        min-width: 50px;
    }

.btn-fetch-ledger {
    margin-top: 1em;
}

.is_inValid {
    /* date is invalid */
    border: 1px solid red;
}

/* --- TOTALS AND BALANCE STYLES --- */

/* 1. Main container aligns all three columns to the bottom line */
.total-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* CRITICAL: Aligns all column bottoms */
    margin-top: 1em;
    width: 95vw; /* Ensure it spans the width of the table */
    max-width: 95vw;
}

.total {
    /* Group CR and DR together */
    display: flex;
}

/* 2. Define all three blocks as vertical columns, aligned right */
.total-cr, .total-dr, .closing-balance-col {
    display: flex;
    flex-direction: column; /* Stacks the label/header and the value vertically */
    align-items: flex-end; /* Right-aligns all text and numbers */
    text-align: right;
    min-width: 120px; /* Gives enough space for the numbers */
}

/* Spacing between the Total Credit and Total Debit columns */
.total-cr {
    margin-right: 2em;
}

.total-dr {
    margin-left: 0;
    margin-right: 2em; /* Add margin to separate from closing balance */
}

/* 3. Closing Balance Header (Label + Indicator Dr./Cr.) */
.balance-header {
    display: flex;
    justify-content: space-between; /* Pushes "Closing Balance" and "Dr./Cr." apart */
    width: 100%; /* Ensure it spans the full width of its column */
    align-items: center;
}

/* Ensure only the actual amount is on the bottom line */
#closing-balance-amount {
    margin-top: 0;
    width: 100%;
}

/* 4. Ensure all column labels are bold for emphasis, matching the values below */
.total-cr label,
.total-dr label,
.closing-balance-label {
    font-weight: bold;
}

/* Style for the Total Debit and Credit labels to ensure they are also spread out */
.total-cr div, .total-dr div {
    display: flex;
    justify-content: flex-end; /* Aligns contents of cr/dr labels to the right */
    width: 100%;
}

/* --- General Table Styles --- */

th:nth-child(4), th:nth-child(5) {
    width: 100px;
}

.img-container {
    max-width: 90vw;
    height: auto;
    margin: 0 auto;
}

    .img-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.title {
    display: flex;
    justify-content: center;
    align-items: center;
}

.customer-info {
    max-width: 70vw;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ledger-table {
    max-width: 90vw;
    margin: 0 auto;
}
/* Apply styles to the entire table */
table {
    border-collapse: collapse; /* Combine cell borders */
    width: 100%; /* Make the table fill its container */
}

/* Style table headers */
th {
    background-color: #f2f2f2; /* Gray background for headers */
    text-align: center; /* Align text to the left */
    padding: 8px; /* Add some padding for readability */
    border-bottom: 1px solid #ddd; /* Add a bottom border */
}

/* Style table cells */
td {
    padding: 8px; /* Add padding to cells */
    border-bottom: 1px solid #ddd; /* Add a bottom border to cells */
}

tr {
    padding: 10px;
}

    /* Apply a different background color to last row (total row if added) */
    tr:last-child {
        background-color: #f2f2f2;
    }

/* --- CARD INPUT STYLES (moved from inline style block) --- */
.customer-input-wrapper {
    position: relative;
    flex-grow: 2;
    min-width: 250px;
}

.card-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

    .card-container > div:nth-child(2),
    .card-container > div:nth-child(3) {
        flex-grow: 1;
        min-width: 150px;
    }

.stock-container {
    padding-left: 0;
}

.btn-fetch-ledger,
.btn-save-ledger {
    white-space: nowrap;
    min-width: 100px;
    flex-shrink: 0;
}

/* --- MEDIA QUERY STYLES (for responsiveness) --- */
@media (max-width: 768px) {
    .card-container {
        flex-direction: column;
        height: auto;
        align-items: stretch; /* Added from inline style block */
        gap: 10px; /* Added from inline style block */
    }

        .customer-input-wrapper,
        .card-container > div:nth-child(2),
        .card-container > div:nth-child(3) {
            min-width: unset; /* Added from inline style block */
        }

    .btn-fetch-ledger,
    .btn-save-ledger {
        min-width: 100%; /* Added from inline style block */
        flex-shrink: 1; /* Added from inline style block */
    }

    .card-container div, .card-container button {
        margin: 0.5em 0;
    }

    .total-container {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        max-width: 100%;
    }

    .total {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .total-cr, .total-dr, .closing-balance-col {
        width: 100%;
        align-items: flex-start;
        margin: 0 0 10px 0;
    }

    .balance-header {
        justify-content: flex-start;
    }

    .total-cr, .total-dr, .balance-label, .balance-value {
        margin: 0;
    }

    .ledger-table th, .ledger-table td {
        font-size: 0.8em;
        padding: 5px;
    }

    th:nth-child(4), th:nth-child(5) {
        width: 70px;
    }
}