/* Universal Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* Containers & Layout */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #00796b, #4caf50);
}

.auth-container {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.app-content {
    display: grid;
    grid-template-areas:
        "header header"
        "menu main";
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

/* Responsive layout for smaller screens */
@media (max-width: 768px) {
    .app-content {
        grid-template-areas:
            "header header"
            "main main"
            "menu menu";
        grid-template-columns: 1fr;
    }
    .side-menu {
        position: fixed;
        top: 0;
        left: -250px;
        z-index: 1000;
        height: 100vh;
        width: 250px;
        transition: left 0.3s ease;
    }
    .side-menu.open {
        left: 0;
    }
    .main-content {
        padding-left: 0;
    }
}

/* Header */
.main-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #00796b;
    color: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.main-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* Side Menu */
.side-menu {
    grid-area: menu;
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.side-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.side-menu li {
    margin: 0;
}

.side-menu .nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    font-size: 1rem;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.side-menu .nav-btn i {
    margin-right: 10px;
}

.side-menu .nav-btn:hover {
    background-color: #34495e;
}

/* Main Content Area */
.main-content {
    grid-area: main;
    padding: 2rem;
    background-color: #f0f2f5;
    min-height: calc(100vh - 80px); /* Adjust based on header height */
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

h2 {
    color: #00796b;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

h3 {
    color: #34495e;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

hr {
    border: 0;
    border-top: 1px solid #ddd;
    margin: 2rem 0;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #00796b;
    box-shadow: 0 0 0 2px rgba(0, 121, 107, 0.2);
}

.form-inline {
    display: flex;
    gap: 10px;
}

.form-inline input {
    flex-grow: 1;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary {
    background-color: #00796b;
    color: #fff;
}

.btn-primary:hover {
    background-color: #005f56;
}

.btn-secondary {
    background-color: #607d8b;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #455a64;
}

.btn-icon {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.btn-link {
    background: none;
    border: none;
    color: #00796b;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: underline;
}

.delete-btn {
    background-color: #e53935;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.delete-btn:hover {
    background-color: #c62828;
}

.download-btn, .recall-btn, .edit-item-btn {
    background-color: #42a5f5;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    margin-left: 5px;
}

.download-btn:hover, .recall-btn:hover, .edit-item-btn:hover {
    background-color: #2196f3;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #e53935;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Cards & Summary */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card h3 {
    color: #555;
    margin-top: 0;
}

.card p {
    font-size: 2rem;
    font-weight: bold;
    color: #00796b;
    margin: 0.5rem 0 0;
}

#total-expenses {
    color: #e53935;
}

#net-profit {
    color: #46b553;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: #f8f9fa;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* Specific Page Styles */
.invoice-container, .income-container, .expenses-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .invoice-container, .income-container, .expenses-container {
        grid-template-columns: 2fr 1fr;
    }
}

.form-section {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.invoices-list, .income-list, .expenses-list {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Invoice form specific styles */
.invoice-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 1rem;
}

.invoice-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

.invoice-item .item-total {
    font-weight: bold;
    text-align: right;
}

.invoice-item .custom-description-input {
    grid-column: 1 / 2;
}

.totals-section {
    text-align: right;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #eee;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.grand-total {
    font-size: 1.5rem;
    color: #46b553;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.tag-list span {
    background-color: #e0e0e0;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
}

@media (max-width: 576px) {
    .invoice-item {
        grid-template-columns: 1fr;
    }
    .form-actions {
        flex-direction: column;
    }
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
#invoice-search {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
#invoice-month-filter {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}