/* 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) */
    }
}

/* --- Keyframe Animations --- */
@keyframes icon-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes arrow-move-left {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-8px); /* Move left 8 pixels */
    }
}

/* Header Styles */
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, transform 0.2s ease; /* Added transform */
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn:hover {
    background-color: #2980b9; /* Darker blue on hover */
    transform: translateY(-2px); /* Moving effect */
}

/* Apply bounce to header button icons on hover */
.header-btn:hover i {
    animation: icon-bounce 0.7s ease-in-out infinite;
    will-change: transform;
}

/* Specific animation for a dashboard back arrow icon */
.header-btn.dashboard-icon-arrow-left:hover i {
    animation: arrow-move-left 0.8s ease-in-out infinite;
    will-change: transform;
}


/* Bills Banner Section */
.bill-banner-section {
    grid-column: 1 / -1; /* Span full width in grid */
    display: flex;
    background: linear-gradient(135deg, #e0f2f7, #c7e9ee);
    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 */
    transition: transform 0.3s ease; /* Added for subtle banner hover effect */
}

.bill-banner-section:hover {
    transform: translateY(-5px); /* Banner subtle lift effect */
}

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

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

.bill-banner-text {
    flex: 2;
    padding: 20px 30px;
    color: #2c3e50;
    min-width: 300px; /* Minimum width for the text container */
}

.bill-banner-text h3 {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Animation for icons within bills banner heading */
.bill-banner-text h3:hover i {
    animation: icon-bounce 0.6s ease-in-out infinite;
    will-change: transform;
}


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

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

.bill-banner-text li i {
    color: #3498db; /* Blue icons */
    font-size: 18px;
}

/* Animation for icons within bills banner list items */
.bill-banner-text li:hover i {
    animation: icon-bounce 0.5s ease-in-out forwards;
    will-change: transform;
}


/* 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;
}

/* Animation for icons within form/list card headings */
.form-card h2:hover i,
.list-card h2:hover i {
    animation: icon-bounce 0.6s ease-in-out infinite;
    will-change: transform;
}


/* 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: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 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 */
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: #3498db; /* Highlight color for checkbox */
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}

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

.add-button:hover {
    background-color: #218838; /* Darker green on hover */
    transform: translateY(-2px); /* Moving effect */
}

/* Animation for add button icon */
.add-button:hover i {
    animation: icon-bounce 0.7s ease-in-out infinite;
    will-change: transform;
}


.custom-input {
    margin-top: 10px;
    background-color: #f8f8f8;
    border-left: 3px solid #3498db;
}

/* List Section Styles */
.filter-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: #555;
}

.filter-group select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    min-width: 120px;
}

.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, transform 0.2s ease; /* Added transform */
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-btn:hover {
    background-color: #dbe4e6;
    transform: translateY(-2px); /* Moving effect */
}

.toggle-btn.active-view {
    background-color: #3498db; /* Blue for active view */
    color: #fff;
    border-color: #3498db;
    transform: translateY(0); /* Reset transform for active state */
}

.toggle-btn.active-view:hover {
    background-color: #2980b9;
    transform: translateY(-2px); /* Moving effect even on active */
}

/* Animation for toggle button icons */
.toggle-btn:hover i {
    animation: icon-bounce 0.6s ease-in-out infinite;
    will-change: transform;
}


.info-message {
    text-align: center;
    padding: 30px;
    background-color: #eaf6ff;
    border: 1px dashed #aed9f7;
    border-radius: 8px;
    color: #3498db;
    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;
}

.bill-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; /* Added transform */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Push actions to bottom */
}

.bill-card:hover {
    transform: translateY(-3px); /* Moving effect */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.bill-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 */
}

.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, transform 0.2s ease; /* Added transform */
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-actions button:hover {
    background-color: #c82333;
    transform: translateY(-2px); /* Moving effect */
}

/* Animation for action button icons within cards */
.card-actions button:hover i {
    animation: icon-bounce 0.5s ease-in-out forwards; /* Bounce forward once */
    will-change: transform;
}


/* 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: #3498db; /* Blue 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 tbody tr:hover {
    background-color: #f1f7fc;
    transform: translateY(-2px); /* Subtle lift for table rows */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle shadow for table rows */
}


.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, transform 0.2s ease; /* Added transform */
}

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

.table-action-btn.delete-btn:hover {
    background-color: #ffe0e0;
    transform: translateY(-2px); /* Moving effect */
}

/* Animation for table action button icons */
.table-action-btn:hover i {
    animation: icon-bounce 0.5s ease-in-out forwards;
    will-change: transform;
}

/* Specific text colors */
.green-text {
    color: #28a745; /* Green for "Yes" or checkmark */
}

.red-text {
    color: #dc3545; /* Red for "No" or cross mark */
}

.expense-amount, .expense-amount-table {
    color: #dc3545; /* Red for expenses */
}

.income-amount, .income-amount-table {
    color: #28a745; /* Green for income */
}


/* Table Footer for Totals */
.notes-table tfoot {
    font-weight: 600;
    background-color: #eaf6ff; /* Light blue for footer */
    color: #2c3e50;
}

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

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

.table-total-amount {
    text-align: left;
    color: #dc3545; /* Red for total expenses */
}

/* 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, transform 0.2s ease; /* Added transform */
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-btn:hover {
    background-color: #5a6268;
    transform: translateY(-2px); /* Moving effect */
}

/* Animation for export button icons */
.export-btn:hover i {
    animation: icon-bounce 0.6s ease-in-out infinite;
    will-change: transform;
}


/* Footer Styles */
footer {
    margin-top: 30px;
    padding: 15px;
    background-color: #2c3e50;
    color: #f4f7f6;
    text-align: center;
    font-size: 14px;
}

/* 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;
    }
    .bills-main-content { /* Assuming you have a wrapper for main content */
        padding: 15px;
    }

    .bill-banner-section {
        flex-direction: column;
    }
    .bill-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;
    }
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
        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;
    }
}

@media (max-width: 480px) {
    .logo-title h1 {
        font-size: 20px;
    }
    .logo-title .subtitle {
        font-size: 16px;
    }
    .header-btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    .bill-banner-text h3 {
        font-size: 20px;
    }
    .bill-banner-text li {
        font-size: 14px;
    }
    .notes-table th, .notes-table td {
        padding: 10px;
        font-size: 13px;
    }
    .table-total-label, .table-total-amount {
        font-size: 14px;
    }
    .bill-card {
        padding: 15px;
    }
    .bill-card h4 {
        font-size: 16px;
    }
    .bill-card p, .card-amount {
        font-size: 13px;
    }
}
