/* --- Global & Shared Styles --- */
:root {
    --primary-color-site: #0a4d68;
    --secondary-color-site: #088395;
    --light-color-site: #f8f9fa;
    --dark-color-site: #343a40;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    
    /* Invoice Specific Colors */
    --invoice-primary: #0056b3;
    --text-dark: #333;
    --text-light: #777;
    --border-color: #ddd;
    --white: #fff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f4f7f6; /* Neutral page background */
    margin: 0;
    font-size: 14px;
}
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(--white); 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(--white); 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: var(--light-color-site); }
.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; }

/* --- Invoice Generator Styles --- */
.app-container { display: flex; gap: 20px; align-items: flex-start; padding: 20px; max-width: 1400px; margin: 0 auto; }
.form-container { flex: 1; background: var(--white); padding: 25px; border-radius: 8px; box-shadow: var(--box-shadow); }
.form-container h2 { margin-top: 0; margin-bottom: 20px; color: var(--invoice-primary); border-bottom: 2px solid var(--border-color); padding-bottom: 10px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--text-dark); }
.form-group input, .form-group textarea { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; box-sizing: border-box; }
.form-section { margin-bottom: 25px; border: 1px solid var(--border-color); padding: 15px; border-radius: 5px; }

#invoice-preview-container { flex: 1.2; position: sticky; top: 85px; /* space for header */ }
#invoice-preview { background: var(--white); padding: 40px; border-radius: 8px; box-shadow: var(--box-shadow); min-height: 800px; position: relative; }
.preview-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--invoice-primary); padding-bottom: 15px; }
.preview-header h1 { margin: 0; font-size: 26px; color: var(--invoice-primary); }
.preview-header p, .preview-header span { margin: 2px 0; color: var(--text-light); font-size: 12px; white-space: pre-wrap; }
.preview-invoice-details { text-align: right; }
.preview-invoice-details h2 { margin: 0 0 10px 0; color: var(--text-dark); }
.preview-customer { margin-top: 25px; }
.preview-customer h3 { margin: 0 0 8px 0; color: var(--invoice-primary); font-weight: 600; padding-bottom: 5px; border-bottom: 1px solid #eee;}
.preview-customer p { margin: 4px 0; }
.preview-payment-details { margin-top: 15px; padding: 10px; background-color: #f8f9fa; border-radius: 4px; }
#preview-items-table { width: 100%; border-collapse: collapse; margin-top: 25px; }
#preview-items-table th, #preview-items-table td { border: 1px solid var(--border-color); padding: 10px; text-align: left; }
#preview-items-table th { background-color: var(--invoice-primary); color: var(--white); }
#preview-items-table td:nth-child(3), #preview-items-table td:nth-child(4) { text-align: right; }
.preview-totals { margin-top: 25px; text-align: right; }
.preview-totals table { width: 50%; margin-left: auto; }
.preview-totals td { padding: 8px; text-align: right; }
.preview-totals .label { font-weight: bold; color: var(--text-dark); text-align: left;}
.grand-total { font-weight: bold; font-size: 1.2em; color: var(--invoice-primary); }
.preview-footer { margin-top: 60px; padding-top: 15px; border-top: 2px solid var(--invoice-primary); text-align: center; font-size: 12px; color: var(--text-light); }
#paid-seal-container { display: none; position: absolute; right: 50px; bottom: 80px; z-index: 10; }
#paid-seal-container img { width: 140px; height: auto; opacity: 0.85; transform: rotate(-15deg); }
#item-rows .form-group { display: flex; gap: 10px; align-items: center; }
#item-rows .item-desc { flex: 3; }
#item-rows .item-qty, #item-rows .item-price { flex: 1; }
.checkbox-group { display: flex; align-items: center; gap: 10px; }
.checkbox-group input { width: auto; }
#add-item-btn, #download-btn { color: white; border: none; padding: 12px 20px; border-radius: 5px; cursor: pointer; font-size: 16px; font-weight: bold; display: block; width: 100%; margin-top: 10px; transition: background-color 0.3s; }
#add-item-btn { background-color: #28a745; margin-bottom: 20px;}
#add-item-btn:hover { background-color: #218838; }
#download-btn { background-color: var(--invoice-primary); }
#download-btn:hover { background-color: #00418a; }
.remove-item-btn { background: #dc3545; color: white; border: none; border-radius: 50%; width: 25px; height: 25px; cursor: pointer; font-weight: bold; }

/* --- Site-wide Footer Styles --- */
.footer { background-color: var(--dark-color-site); color: #ccc; padding: 40px 20px 20px; margin-top: 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: var(--white); }
.footer-menu a { color: #ccc; text-decoration: none; margin-left: 20px; transition: color 0.3s ease; }
.footer-menu a:hover { color: var(--white); }
.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%; }
    .app-container { flex-direction: column; }
    #invoice-preview-container { position: static; margin-top: 20px; }
}
@media (max-width: 767px) {
    .footer-content { flex-direction: column; text-align: center; }
    .footer-menu a { margin: 0 10px; display: inline-block; padding: 5px 0; }
}