/* --- CSS Variables for easy theme management --- */
:root {
    /* Site-wide Colors */
    --primary-color-site: #0a4d68;
    --secondary-color-site: #088395;
    --dark-color-site: #343a40;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    /* Expense Tracker Colors */
    --bg-color: #f4f7fe;
    --surface-color: #ffffff;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: #e5e7eb;
}

/* --- General & Global Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
}

body.menu-open {
    overflow: hidden;
}

#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

#overlay.active {
    display: block;
}

/* --- Header & Navigation --- */
.header { background-color: var(--surface-color); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); position: sticky; top: 0; z-index: 1000; }
.header .container-nav { display: flex; justify-content: space-between; align-items: center; height: 65px; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo img { height: 45px; }
.logo span { font-size: 1.5rem; font-weight: 700; color: var(--primary-color-site); }
.primary-menu .nav-links { list-style: none; display: flex; align-items: center; gap: 1.5rem; }
.primary-menu a { text-decoration: none; color: var(--dark-color-site); font-weight: 500; transition: color 0.3s ease; }
.primary-menu a:hover { color: var(--secondary-color-site); }
.dropdown { position: relative; }
.dropdown-content { display: none; position: absolute; background-color: var(--surface-color); min-width: 260px; box-shadow: var(--box-shadow); z-index: 1; border-radius: 8px; padding: 0.5rem 0; margin-top: 10px; border: 1px solid #eee; }
.dropdown-content a { color: var(--dark-color-site); padding: 12px 20px; display: block; font-size: 0.95rem; }
.dropdown-content a:hover { background-color: #f8f9fa; }
.dropdown:hover .dropdown-content { display: block; }
.dropdown .dropbtn i { font-size: 0.7rem; margin-left: 5px; transition: transform 0.3s ease; }
.dropdown:hover .dropbtn i { transform: rotate(180deg); }
.mobile-menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--primary-color-site); cursor: pointer; z-index: 1001; }

/* --- Expense Tracker Styles --- */
.content-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 135px); /* Adjust for header and footer */
    padding: 20px;
}

main.container {
    width: 100%;
    max-width: 800px;
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

h1, h2 { text-align: center; font-weight: 700; }
h1 { color: var(--primary-color); }
h2 { color: var(--text-dark); }

#expense-form { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; align-items: flex-end; }
.form-group { display: flex; flex-direction: column; }
.form-group-full { grid-column: 1 / -1; }
label { font-size: 0.875rem; margin-bottom: 6px; font-weight: 500; color: var(--text-light); }
input, select { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
input:focus, select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }
button { padding: 12px; border: none; border-radius: 8px; font-family: 'Inter', sans-serif; font-weight: 600; cursor: pointer; transition: background-color 0.2s, transform 0.1s; }
button:active { transform: translateY(1px); }
.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-danger { background-color: var(--accent-red); color: #fff; padding: 6px 10px; font-size: 0.8rem; }
.btn-success { background-color: var(--accent-green); color: #fff; width: 100%; max-width: 250px; margin: 0 auto; display: block;}

.summary-report { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; text-align: center; }
.summary-card h3 { font-size: 1rem; font-weight: 500; color: var(--text-light); margin-bottom: 0.5rem; }
.summary-card p { font-size: 1.75rem; font-weight: 600; }
.positive { color: var(--accent-green); }
.negative { color: var(--accent-red); }

.table-container { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 14px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: var(--bg-color); font-weight: 600; font-size: 0.875rem; color: var(--text-light); text-transform: uppercase; }
.app-footer { text-align: center; }

/* --- Site-wide Footer Styles --- */
.footer { background-color: var(--dark-color-site); color: #ccc; padding: 40px 20px 20px; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid #555; max-width: 1200px; margin: 0 auto; }
.footer-logo { font-size: 1.2rem; font-weight: 700; color: #fff; }
.footer-menu a { color: #ccc; text-decoration: none; margin-left: 20px; transition: color 0.3s ease; }
.footer-menu a:hover { color: #fff; }
.copyright { text-align: center; margin-top: 20px; font-size: 0.9rem; }

/* --- Responsive Styles --- */
@media (max-width: 992px) {
    .primary-menu { display: none; }
    .mobile-menu-toggle { display: block; }
    .primary-menu.mobile-active { display: flex; position: fixed; top: 0; right: 0; width: min(80vw, 320px); height: 100vh; background-color: #fff; z-index: 999; transform: translateX(100%); transition: transform 0.3s ease-in-out; flex-direction: column; align-items: flex-start; gap: 0; padding: 2rem; }
    .primary-menu.mobile-active.active { transform: translateX(0); }
    .primary-menu.mobile-active li { width: 100%; }
    .primary-menu.mobile-active a { padding: 1rem 0; display: block; width: 100%; }
    .dropdown:hover .dropdown-content { display: none; }
    .dropdown-content { position: static; display: none; box-shadow: none; background-color: #f7f7f7; padding-left: 1rem; }
    .dropdown.active > .dropdown-content { display: block; }
    .dropdown.active > a > i { transform: rotate(180deg); }
    .dropdown .dropbtn { display: flex; justify-content: space-between; align-items: center; width: 100%; }
}

@media (max-width: 767px) {
    .content-wrapper { padding: 10px; }
    main.container { padding: 1.5rem; }
    #expense-form, .summary-report { grid-template-columns: 1fr; }
    .footer-content { flex-direction: column; text-align: center; }
    .footer-menu a { margin: 0 10px; display: inline-block; padding: 5px 0; }
}