/* Common styles shared across all pages */

/* Reset & Base */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    font-size: 14px;
}

/* Site Footer */
.site_footer {
    margin: 30px 20px 20px;
    padding: 14px 16px;
    text-align: center;
    color: #555;
    font-size: 12px;
    background-color: #fafafa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 5px;
}

/* Page Title / Header */
#page_title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #333;
    color: white;
}

#page_title h1 {
    margin: 0;
}

/* Navigation */
.nav_links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav_link {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background-color: #2196F3;
    border-radius: 5px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-block;
}

.nav_link:hover {
    background-color: #1976D2;
}

.nav_link.green {
    background-color: #4CAF50;
}

.nav_link.green:hover {
    background-color: #45a049;
}

.nav_link.red {
    background-color: #e53935;
}

.nav_link.red:hover {
    background-color: #c62828;
}

.nav_link.danger {
    background-color: #666;
}

.nav_link.danger:hover {
    background-color: #888;
}

.nav_link:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#abs_toggle_btn {
    background-color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#abs_toggle_btn:hover {
    background-color: #444;
}

/* Containers */
.container {
    margin: 20px;
    background-color: white;
    border-radius: 5px;
    padding: 20px;
}

/* Section Titles */
.section_title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

/* Chart Container */
.chart_container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Banners */
.error_banner {
    background-color: #ffebee;
    border: 1px solid #f44336;
    border-radius: 5px;
    padding: 10px 15px;
    margin: 20px;
    color: #c62828;
    display: none;
}

.error_banner.visible {
    display: block;
}

.error_title {
    font-weight: bold;
    margin-bottom: 5px;
}

.error_list {
    font-size: 14px;
}

.success_banner {
    background-color: #e8f5e9;
    border: 1px solid #4CAF50;
    border-radius: 5px;
    padding: 10px 15px;
    margin: 20px;
    color: #1b5e20;
    display: none;
}

.success_banner.visible {
    display: block;
}

/* Buttons */
.btn {
    padding: 8px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn.primary {
    background-color: #2196F3;
    color: white;
}

.btn.primary:hover {
    background-color: #1976D2;
}

.btn.success {
    background-color: #4CAF50;
    color: white;
}

.btn.success:hover {
    background-color: #45a049;
}

.btn.danger {
    background-color: #e53935;
    color: white;
}

.btn.danger:hover {
    background-color: #c62828;
}

.btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    color: #333;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
}

/* Forms */
input, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

/* Utilities */
.inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.hint {
    color: #666;
    font-size: 12px;
    margin-top: 6px;
}

/* Privacy toggle (hide absolute values) */
.abs_value {
    display: inline;
}

.pct_value {
    display: inline;
}

.pct_placeholder {
    display: none;
    color: #777;
}

body.hide_absolute .abs_value {
    display: none !important;
}

body.hide_absolute .pct_placeholder {
    display: inline;
}

/* Summary Cards (used in history, can be shared) */
.summary_cards {
    display: flex;
    gap: 20px;
    margin: 20px;
    flex-wrap: wrap;
}

.summary_card {
    flex: 1;
    min-width: 200px;
    background-color: white;
    border-radius: 5px;
    padding: 20px;
}

.summary_card_title {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.summary_card_value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.summary_card_value.positive {
    color: #4CAF50;
}

.summary_card_value.negative {
    color: #f44336;
}

/* Change cell styling */
.change_cell {
    font-weight: bold;
}

.change_cell.positive {
    color: #4CAF50;
}

.change_cell.negative {
    color: #f44336;
}

/* Mobile Bottom Navigation */
@media (max-width: 768px) {
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom)); /* Ensure content isn't hidden */
    }

    #page_title {
        justify-content: center;
        text-align: center;
    }

    .nav_links {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%; /* Ensure full width */
        background-color: #333;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) 10px; /* Safe area padding */
        display: flex;
        justify-content: space-evenly; /* Even spacing */
        align-items: center;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
        z-index: 9999; /* High z-index to overlay everything */
        box-sizing: border-box; /* Include padding in width */
    }

    .nav_link {
        flex: 1;
        text-align: center;
        margin: 0 4px;
        font-size: 12px;
        padding: 8px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px; /* Prevent single buttons from being too wide */
    }

    #abs_toggle_btn {
        position: fixed;
        top: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        padding: 8px 10px;
        background-color: #333;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
        z-index: 10000;
    }

    /* Adjust specific buttons on mobile if needed */
    .nav_link.danger {
        /* Logout button style adjustments if it were here */
    }
}
