/* General Body and Container Styles */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 20px auto;
    display: grid; /* Use grid for main content layout */
    gap: 30px; /* Space between form and list cards */
    grid-template-columns: 1fr; /* Default to single column on small screens */
}

/* Adjust grid for larger screens */
@media (min-width: 992px) {
    main {
        grid-template-columns: 1fr 2fr; /* Two columns: form (1 part) and list (2 parts) */
    }
}

/* Header Styles (Consistent with other NoteNest pages) */
header {
    background-color: #2c3e50; /* Dark blue/grey */
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.logo-title {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
}

.logo-title img {
    height: 40px;
    margin-right: 10px;
}

.logo-title h1 {
    font-size: 24px;
    margin: 0;
    font-weight: 600;
}

.logo-title .subtitle {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    margin: -5px 0 0 0;
    color: #a7d9f7; /* Lighter blue for subtitle */
}

.header-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap; /* Allow wrapping */
}

.header-btn {
    background-color: #3498db; /* Blue */
    color: #fff;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn:hover {
    background-color: #2980b9; /* Darker blue on hover */
}

/* Debts Banner Section */
.debts-banner-section {
    grid-column: 1 / -1; /* Span full width in grid */
    display: flex;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2); /* Light orange gradient */
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping */
}

.debts-banner-left {
    flex: 1;
    min-width: 250px; /* Minimum width for the image container */
}

.debts-banner-left img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.debts-banner-text {
    flex: 2;
    padding: 20px 30px;
    color: #5d4037; /* Dark brown text */
    min-width: 300px; /* Minimum width for the text container */
}

.debts-banner-text h3 {
    font-size: 24px;
    color: #d84315; /* Orange-red heading */
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.debts-banner-text ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.debts-banner-text li {
    font-size: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.debts-banner-text li i {
    color: #ff9800; /* Orange icons */
    font-size: 18px;
}

/* Card Styles (for form and list sections) */
.form-card,
.list-card {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-card h2,
.list-card h2 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Styles */
form .form-group {
    margin-bottom: 20px;
}

form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

form input[type="text"],
form input[type="number"],
form input[type="date"],
form select,
form textarea {
    width: calc(100% - 20px); /* Adjust for padding */
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    color: #333;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="text"]:focus,
form input[type="number"]:focus,
form input[type="date"]:focus,
form select:focus,
form textarea:focus {
    border-color: #ff9800; /* Orange focus color */
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
    outline: none;
}

form textarea {
    resize: vertical;
    min-height: 80px;
}

.inline-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping */
}

.inline-group .input-with-label {
    flex: 1;
    min-width: 150px; /* Minimum width for each input in inline group */
}

.add-button {
    background-color: #ff5722; /* Deep orange for add button */
    color: #fff;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.add-button:hover {
    background-color: #e64a19; /* Darker orange on hover */
}

/* List Section Styles */
.view-toggle-buttons {
    display: flex;
    justify-content: flex-end; /* Align to right */
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-btn {
    background-color: #ecf0f1; /* Light grey */
    color: #2c3e50;
    padding: 10px 15px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-btn:hover {
    background-color: #dbe4e6;
}

.toggle-btn.active-view {
    background-color: #ff9800; /* Orange for active view */
    color: #fff;
    border-color: #ff9800;
}

.toggle-btn.active-view:hover {
    background-color: #fb8c00;
}

.info-message {
    text-align: center;
    padding: 30px;
    background-color: #fff8e1; /* Very light yellow for info */
    border: 1px dashed #ffecb3;
    border-radius: 8px;
    color: #ff8f00; /* Darker yellow for text */
    font-size: 16px;
    margin-top: 20px;
}

.card-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.debt-card {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Push actions to bottom */
    border-left: 5px solid #ff9800; /* Orange left border */
}

.debt-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.debt-card h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
    word-break: break-word; /* Prevent long titles from overflowing */
}

.debt-card p {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.card-amount {
    font-size: 20px;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 15px; /* Space before actions */
    color: #d84315; /* Orange-red for amounts */
}

.card-actions {
    display: flex;
    justify-content: flex-end; /* Align delete button to the right */
    margin-top: 10px;
}

.card-actions button {
    background-color: #dc3545; /* Red for delete */
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-actions button:hover {
    background-color: #c82333;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto; /* Enable horizontal scrolling for tables on small screens */
    margin-top: 20px;
}

.notes-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.notes-table th,
.notes-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle; /* Align content vertically */
}

.notes-table th {
    background-color: #ff9800; /* Orange header for table */
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap; /* Prevent headers from wrapping */
}

.notes-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.notes-table tr:hover {
    background-color: #fff8e1; /* Lighter yellow on hover */
}

.table-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin: 0 5px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.table-action-btn.delete-btn {
    color: #dc3545; /* Red */
}

.table-action-btn.delete-btn:hover {
    background-color: #ffe0e0;
}

/* Table Footer for Totals */
.notes-table tfoot {
    font-weight: 600;
    background-color: #fff3e0; /* Light orange for footer */
    color: #5d4037;
}

.notes-table tfoot td {
    padding: 15px;
    border-top: 2px solid #ff9800; /* Stronger border for separation */
    font-size: 16px;
}

.table-total-label {
    text-align: right;
    padding-right: 15px;
}

.table-total-amount {
    text-align: left;
    color: #d84315; /* Orange-red for total amount */
}

/* Utility Class */
.hidden-view {
    display: none;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.export-btn {
    background-color: #6c757d; /* Grey */
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-btn:hover {
    background-color: #5a6268;
}

/* Footer Styles */
footer {
    margin-top: 30px;
    padding: 15px;
    background-color: #2c3e50;
    color: #f4f7f6;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .header-buttons {
        justify-content: center;
        width: 100%;
    }
    .header-btn {
        flex-grow: 1; /* Allow buttons to expand */
        justify-content: center;
    }
    .debts-main-content {
        padding: 15px;
    }

    .debts-banner-section {
        flex-direction: column;
    }
    .debts-banner-text {
        padding: 15px;
    }
    .form-card, .list-card {
        padding: 20px;
    }
    .form-card h2, .list-card h2 {
        font-size: 20px;
    }
    form input[type="text"],
    form input[type="number"],
    form input[type="date"],
    form select,
    form textarea {
        width: calc(100% - 24px); /* Adjust for padding and border */
    }
    .inline-group {
        flex-direction: column;
        gap: 15px;
    }
    .view-toggle-buttons {
        justify-content: center;
        width: 100%;
    }
    .toggle-btn {
        flex-grow: 1;
        justify-content: center;
    }
    .export-buttons {
        flex-direction: column;
        align-items: center;
    }
    .export-btn {
        width: 100%;
        justify-content: center;
    }
    .notes-table th, .notes-table td {
        padding: 10px;
        font-size: 13px;
    }
    .table-total-label, .table-total-amount {
        font-size: 14px;
    }
    .debt-card {
        padding: 15px;
    }
    .debt-card h4 {
        font-size: 16px;
    }
    .debt-card p, .card-amount {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .logo-title h1 {
        font-size: 20px;
    }
    .logo-title .subtitle {
        font-size: 16px;
    }
    .header-btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    .debts-banner-text h3 {
        font-size: 20px;
    }
    .debts-banner-text li {
        font-size: 14px;
    }
}