@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

body {
    font-family: 'Montserrat', sans-serif !important;
}

.header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
#search {
    flex: 1 1 350px;
    max-width: 400px;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1.1em;
    margin-right: 16px;
}
.sheet-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.summary-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 18px;
}
.summary-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 18px 28px;
    min-width: 180px;
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.summary-label {
    font-size: 1em;
    color: #888;
    margin-bottom: 6px;
}
.summary-value {
    font-size: 2em;
    font-weight: 600;
}
.cash-in .summary-label { color: #2e7d32; }
.cash-in .summary-value { color: #2e7d32; }
.cash-out .summary-label { color: #c62828; }
.cash-out .summary-value { color: #c62828; }
.net-balance .summary-label { color: #3f51b5; }
.net-balance .summary-value { color: #3f51b5; }
.summary-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}
.summary-buttons button {
    font-size: 1.1em;
    padding: 10px 24px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 4px;
}
.add-in { background: #2e7d32; color: #fff; border: 2px solid #2e7d32; }
.add-in:focus, .add-in:hover { background: #fff; color: #2e7d32; }
.add-out { background: red !important; color: #fff !important; border: 2px solid red !important; }
.add-out:focus, .add-out:hover { background: #fff !important; color: red !important; }

.table-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 10px 0 0 0;
}
.table-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px 8px 18px;
    font-size: 1em;
    color: #666;
}
.table-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}
.table-pagination button {
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 1.1em;
    cursor: pointer;
}
.table-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

table#transactions-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: 1.05em;
    table-layout: fixed;
}

/* Hide checkbox column in all views */
table#transactions-table th:first-child,
table#transactions-table td:first-child {
    display: none !important;
}

/* Fixed column widths */
table#transactions-table th:nth-child(2),
table#transactions-table td:nth-child(2) {
    width: 120px;
}

table#transactions-table th:nth-child(3),
table#transactions-table td:nth-child(3) {
    width: auto;
    min-width: 200px;
}

table#transactions-table th:nth-child(4),
table#transactions-table td:nth-child(4) {
    width: 120px;
    text-align: right;
}

table#transactions-table th:nth-child(5),
table#transactions-table td:nth-child(5) {
    width: 120px;
    text-align: right;
}

table#transactions-table th:nth-child(6),
table#transactions-table td:nth-child(6) {
    width: 150px;
    text-align: center;
}

table#transactions-table th, table#transactions-table td {
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 8px;
    text-align: left;
}
table#transactions-table th {
    background: #fafbfc;
    color: #222;
    font-weight: 600;
    font-size: 1em;
}
table#transactions-table tr:hover {
    background: #f7f7f7;
}
table#transactions-table td {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

table#transactions-table td:nth-child(3) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table#transactions-table td .amount-in { color: #2e7d32; font-weight: 600; }
table#transactions-table td .amount-out { color: #c62828; font-weight: 600; }
table#transactions-table td .balance { color: #3f51b5; font-weight: 600; }
table#transactions-table td .edited { font-size: 0.9em; color: #888; margin-left: 4px; }

/* Hide edit and delete buttons by default */
#transactions-table tbody tr td .edit-button,
#transactions-table tbody tr td .delete-button {
    display: none;
}

/* Show buttons on row hover */
#transactions-table tbody tr:hover td .edit-button,
#transactions-table tbody tr:hover td .delete-button {
    display: inline-block;
}

/* Align balance column to the right */
#transactions-table tbody tr td:nth-child(5),
#transactions-table thead th:nth-child(5) {
    text-align: right;
}

/* Remove the line of columns */
#transactions-table thead th {
    border-bottom: none;
}

#transaction-form {
    margin: 18px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 18px;
    align-items: center;
}
#transaction-form.hidden { display: none; }
#transaction-form input, #transaction-form select {
    flex: 1 1 180px;
    min-width: 0;
    padding: 8px;
    font-size: 1em;
}
#transaction-form button {
    padding: 8px 16px;
    font-size: 1em;
    flex: 1 1 100px;
}

.landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: #f4f4f4;
}

.auth-options {
    display: flex;
    gap: 20px;
}

.auth-link {
    padding: 10px 20px;
    background-color: #2e7d32;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.2em;
}

.logout-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: orange !important;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f4f4f4;
}

.auth-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 300px;
    text-align: center;
}

.auth-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.auth-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.auth-button {
    width: 100%;
    padding: 10px;
    background-color: blue !important;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.auth-button:hover {
    background-color: #1b5e20;
}

/* Overlay styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.overlay.hidden {
    display: none;
}
.overlay-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
}
.overlay-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}
.overlay-content form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 900px) {
    .container {
        max-width: 98vw;
        padding: 8px;
    }
    .summary-cards { flex-direction: column; gap: 10px; }
    .summary-card { min-width: 120px; padding: 12px 10px; }
    table#transactions-table th, table#transactions-table td { padding: 6px 2px; font-size: 0.98em; }
}
@media (max-width: 600px) {
    .container {
        max-width: 100vw;
        padding: 2px;
        border-radius: 0;
        box-shadow: none;
    }
    .header-bar, .summary-cards, .table-meta { flex-direction: column; align-items: stretch; }
    .summary-card, .summary-buttons { width: 100%; }
    table#transactions-table, table#transactions-table thead, table#transactions-table tbody, table#transactions-table th, table#transactions-table td, table#transactions-table tr {
        display: block;
        width: 100%;
    }
    table#transactions-table thead { display: none; }
    table#transactions-table tr { margin-bottom: 10px; border-bottom: 2px solid #eee; }
    table#transactions-table td { text-align: right; padding-left: 50%; position: relative; min-height: 32px; border: none; border-bottom: 1px solid #eee; }
    table#transactions-table td:before { position: absolute; left: 8px; top: 8px; width: 45%; white-space: nowrap; font-weight: bold; text-align: left; }
    table#transactions-table td:nth-child(2):before { content: 'Date & Time'; }
    table#transactions-table td:nth-child(3):before { content: 'Details'; }
    table#transactions-table td:nth-child(4):before { content: 'Bill'; }
    table#transactions-table td:nth-child(5):before { content: 'Amount'; }
    table#transactions-table td:nth-child(6):before { content: 'Balance'; }
}
@media (max-width: 900px) {
    .container {
        max-width: 98vw;
        padding: 8px;
    }
    table#transactions-table th, table#transactions-table td {
        padding: 4px 2px;
        font-size: 0.95em;
    }
}

@media (max-width: 600px) {
    .container {
        max-width: 100vw;
        padding: 2px;
        border-radius: 0;
        box-shadow: none;
    }
    table#transactions-table, table#transactions-table thead, table#transactions-table tbody, table#transactions-table th, table#transactions-table td, table#transactions-table tr {
        display: block;
        width: 100%;
    }
    table#transactions-table thead {
        display: none;
    }
    table#transactions-table tr {
        margin-bottom: 10px;
        border-bottom: 2px solid #eee;
    }
    table#transactions-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        min-height: 32px;
        border: none;
        border-bottom: 1px solid #eee;
    }
    table#transactions-table td:before {
        position: absolute;
        left: 8px;
        top: 8px;
        width: 45%;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
    }
    table#transactions-table td:nth-child(1):before { content: 'Date'; }
    table#transactions-table td:nth-child(2):before { content: 'Description'; }
    table#transactions-table td:nth-child(3):before { content: 'Cash In'; }
    table#transactions-table td:nth-child(4):before { content: 'Cash Out'; }
    table#transactions-table td:nth-child(5):before { content: 'Balance'; }
    table#transactions-table td:nth-child(6):before { content: 'Edit'; }
    table#transactions-table td:nth-child(7):before { content: 'Delete'; }
}
table#transactions-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
table#transactions-table th, table#transactions-table td {
    border: 1px solid #eee;
    padding: 8px 6px;
    text-align: left;
}
table#transactions-table th {
    background: #f5f5f5;
}
table#transactions-table td button {
    padding: 2px 8px;
    font-size: 0.9em;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}
table#transactions-table td button:hover {
    background: #e0e0e0;
}
body {
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    margin: 0;
    padding: 0;
}
.container {
    width: 70vw;
    max-width: 70vw;
    margin: 24px auto;
    background: #fff;
    padding: 24px 24px 20px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (max-width: 900px) {
    .container {
        width: 98vw;
        max-width: 98vw;
        padding: 8px 2vw 12px 2vw;
        border-radius: 8px;
    }
}

@media (max-width: 600px) {
    .container {
        width: 100vw;
        max-width: 100vw;
        padding: 2px 0 8px 0;
        border-radius: 0;
        box-shadow: none;
    }
    .table-section, .summary-cards, .header-bar {
        padding-left: 0;
        padding-right: 0;
    }
    table#transactions-table {
        display: block;
        width: 100vw;
        overflow-x: auto;
    }
    table#transactions-table thead, table#transactions-table tbody, table#transactions-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    table#transactions-table th, table#transactions-table td {
        font-size: 0.98em;
        padding: 6px 2px;
        word-break: break-word;
    }
}
h1, h2 {
    text-align: center;
}
form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
input[type="date"], input[type="text"], input[type="number"], select {
    flex: 1 1 100%;
    min-width: 0;
    padding: 8px;
    font-size: 1em;
}
button {
    padding: 8px 16px;
    font-size: 1em;
    flex: 1 1 100%;
}
ul {
    list-style: none;
    padding: 0;
}
li {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
li button {
    margin-left: 4px;
    padding: 2px 8px;
    font-size: 0.9em;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}
li button:hover {
    background: #e0e0e0;
}
#balance {
    color: #2e7d32;
    font-weight: bold;
}

/* Styling for Cash Out button */
.add-out {
    background-color: red;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
}

/* Styling for Login button */
button[type="submit"] {
    background-color: blue;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
}

/* Styling for Logout button */
.logout-button {
    background-color: orange;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
}
