/* General Styling */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: #f4f7f6; /* Light gray background */
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensures footer sticks to bottom */
}

/* Header */
header {
    background-color: #2c3e50; /* Changed: Dark blue/grey header */
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 15px; /* Space between items when wrapped */
}

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

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

.logo-title h1 {
    margin: 0;
    font-size: 1.8em;
    font-family: 'Caveat', cursive; /* Playful font for brand */
    font-weight: 600;
}

.logo-title .subtitle {
    margin: 0;
    font-size: 0.8em;
    opacity: 0.8;
}

.header-buttons {
    display: flex;
    gap: 15px;
}

.header-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
}

.header-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

/* --- Application of Animations --- */

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

/* Main Content Layout */
.expense-main-content {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Form on left (1 part), List on right (2 parts) */
    gap: 30px;
    padding: 30px;
    max-width: 1200px;
    margin: 30px auto; /* Center the main content */
    flex-grow: 1; /* Allows main content to fill available space */
}

/* Card Styling for Sections */
.form-card, .list-card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.form-card h2, .list-card h2 {
    color: #D32F2F; /* Red for expense sections */
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Style for icons within Expense section headings */
.form-card h2 i, .list-card h2 i {
    color: #D32F2F; /* Red color for icons in expense headings */
    transition: transform 0.3s ease-out; /* Smooth transition for non-animated state */
}

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

/* Specific styling for the dashboard icon (assuming it's in a heading of a section) */
/* If you have a specific dashboard section, you might need to target it more precisely,
   e.g., #dashboard-section h2 .fa-chart-pie */
/* For example, if your dashboard link/icon is in header: */
header .header-btn.dashboard-link:hover i {
    animation: icon-bounce 0.6s ease-in-out infinite; /* Example bounce for a dashboard icon in header */
    will-change: transform;
}

/* Animation for an arrow icon in the dashboard context (e.g., within a heading or navigation) */
/* Assuming a class like 'dashboard-arrow' or a direct FontAwesome class within a relevant element */
.dashboard-icon-arrow-left { /* Add this class to your arrow icon if it's not already there */
    transition: transform 0.3s ease-out;
}

.dashboard-icon-arrow-left:hover {
    animation: arrow-move-left 0.8s ease-in-out infinite;
    will-change: transform;
}

/* Form Styling */
#expenseForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    margin-bottom: 5px; /* Adjust spacing between groups */
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: calc(100% - 20px); /* Account for padding */
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    color: #444;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box; /* Include padding in width */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #D32F2F; /* Red */
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.2); /* Red shadow */
    outline: none;
}

.form-group textarea {
    resize: vertical; /* Allow vertical resizing only */
    min-height: 60px;
}

/* Inline group for Amount and Currency */
.inline-group {
    display: flex;
    gap: 20px;
    width: 100%;
}

.inline-group .input-with-label {
    flex: 1; /* Distribute space evenly */
}

.inline-group .input-with-label input,
.inline-group .input-with-label select {
    width: 100%; /* Make inputs/selects fill their container */
}

.add-button {
    background-color: #D32F2F; /* Red */
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-button:hover {
    background-color: #c62828; /* Darker red */
    transform: translateY(-2px);
}

.add-button:active {
    transform: translateY(0);
}

/* List Styling */
.list-card {
    position: relative; /* For absolute positioning of no expenses message */
}

#noExpensesMessage {
    background-color: #fce4ec; /* Light pinkish red */
    color: #c2185b; /* Darker pinkish red */
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-top: 15px;
    font-style: italic;
    font-size: 1.1em;
    display: none; /* Hidden by default, JavaScript will show/hide */
    border: 1px solid #f8bbd0;
}

.expense-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.expense-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px; /* Space between details and actions */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.expense-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.expense-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.expense-details h4 {
    margin: 0 0 5px 0;
    color: #222;
    font-size: 1.2em;
    font-weight: 600;
}

.expense-details p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

.expense-details .amount-date {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-top: 5px;
}

.expense-details .expense-amount {
    font-weight: 700;
    color: #D32F2F; /* Red for expenses */
    font-size: 1.3em;
}

.expense-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #666;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: #e0e0e0;
    color: #333;
}

.action-btn.edit-btn:hover {
    background-color: #ffeb3b; /* Yellow for edit */
    color: #e65100;
}

.action-btn.delete-btn { /* Specific style for delete button */
    background-color: #ef9a9a; /* Lighter red for delete button default */
    color: #b71c1c; /* Darker red text */
    border-color: #ef9a9a;
}

.action-btn.delete-btn:hover {
    background-color: #e57373; /* Darker red on hover */
    color: white;
}

/* Footer */
footer {
    margin-top: 40px;
    padding: 20px;
    background-color: #e9ecef; /* Light grey footer */
    color: #555;
    text-align: center;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

/* Responsive Design */
@media (max-width: 900px) {
    .expense-main-content {
        grid-template-columns: 1fr; /* Stack columns on smaller screens */
        padding: 20px;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .header-buttons {
        flex-direction: column;
        width: 100%;
    }

    .header-btn {
        width: calc(100% - 30px); /* Full width minus padding */
        justify-content: center;
    }

    .logo-title {
        justify-content: center;
    }

    .expense-main-content {
        padding: 15px;
    }

    .form-card, .list-card {
        padding: 20px;
    }

    .form-card h2, .list-card h2 {
        font-size: 1.5em;
    }

    .inline-group {
        flex-direction: column; /* Stack amount and currency */
        gap: 15px;
    }

    .expense-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .expense-details {
        width: 100%;
        margin-bottom: 10px;
    }

    .expense-actions {
        width: 100%;
        justify-content: flex-end; /* Push buttons to the right */
    }
}
