﻿/* Apply a consistent, modern font across the entire app */
body, button, input, select, table {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    margin: 0;
    padding: 0;
}

/* General page styling */
body {
    margin: 0;
    padding: 10px;
    margin-bottom: 160px;
    background-color: #f4f7fa;
    min-height: 100vh;
    overflow-y: auto;
}

/* Layout container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    position: relative;
    padding-bottom: 60px;
}

/* Header banner */
.header-banner {
    padding: clamp(5px, 1vw, 10px);
    background-color: #f8f9fa;
    margin-bottom: 1px;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid #e0e0e0;
}

/* Header content (title, go pro button, and terms link) */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Define a specific style for the title */
.header-title {
    color: black !important;
    font-size: clamp(14px, 2vw, 24px);
    font-weight: bold;
    margin: 0;
    padding: 5px;
    flex: 1;
    max-height: 2.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    white-space: normal;
    text-align: center;
}

/* Go Pro Button */
.go-pro-btn {
    background-color: #10B981;
    color: white;
    padding: clamp(4px, 1vw, 8px) clamp(6px, 1.5vw, 16px);
    border: none;
    border-radius: 5px;
    font-size: clamp(10px, 1.5vw, 14px);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

    .go-pro-btn:hover {
        background-color: #34D399;
        transform: translateY(-2px);
    }

    .go-pro-btn:active {
        transform: translateY(0);
    }

/* Ensure Terms & Conditions link in the header is visible */
.header-banner .terms-link {
    color: #007BFF;
    text-decoration: none;
    font-size: clamp(10px, 1.5vw, 16px);
    padding: 5px;
    transition: color 0.3s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

    .header-banner .terms-link:hover {
        color: #0056b3;
        text-decoration: underline;
    }

/* Ensure all field labels and section titles are readable */
h3, label, p, th, td {
    color: #333 !important;
}

/* Inputs and selects */
input, select {
    padding: 12px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    color: black;
    background-color: white;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

    input:focus, select:focus {
        border-color: #007BFF;
        box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
        outline: none;
    }

    /* Normalize number input to remove spin buttons */
    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    input[type="number"] {
        -moz-appearance: textfield;
    }

/* Pay Day Picker styling - Clean and consistent */
#paydayPicker {
    margin-top: 10px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

    #paydayPicker label {
        color: #333 !important;
        font-weight: normal;
        text-shadow: none;
    }

    #paydayPicker input[type="date"] {
        padding: 12px;
        margin-top: 5px;
        margin-bottom: 10px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background: white;
        color: #333;
        font-weight: normal;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

        #paydayPicker input[type="date"]:hover,
        #paydayPicker input[type="date"]:focus {
            border-color: #007BFF;
            box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
        }

/* Tab buttons */
.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    padding: 5px 0;
}

    .tab-buttons button {
        flex: 1;
        max-width: 200px;
        height: 44px;
        padding: 2px 5px;
        font-size: 14px;
        font-weight: bold;
        border: 1px solid #ccc;
        background-color: #f8f9fa;
        color: black;
        border-radius: 5px;
        cursor: pointer;
        text-transform: uppercase;
        transition: background 0.3s ease, transform 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.2;
    }

        .tab-buttons button:hover {
            background-color: #e9ecef;
            transform: translateY(-2px);
        }

        .tab-buttons button.active {
            background-color: #007BFF;
            color: white;
            transform: none;
        }

/* Tabs */
.tab {
    display: none;
    padding: 15px;
    overflow-y: auto;
    padding-bottom: 80px;
    min-height: calc(100vh - 140px);
}

    .tab.active {
        display: block;
    }

    /* Reduce space around tab titles */
    .tab h3 {
        margin-top: 5px;
        margin-bottom: 10px;
        font-size: 20px;
    }

/* TermsTabSpecialCSS */
#termsTab {
    line-height: 1.2;
}

    #termsTab p {
        margin: 5px 0;
    }

    #termsTab h4 {
        margin: 10px 0 5px 0;
    }

/* Button styling */
button {
    margin: 0;
    width: 100%;
    height: 44px;
    padding: 10px;
    border: none;
    background-color: #007BFF;
    color: white;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

    button:hover {
        background-color: #0056b3;
        transform: translateY(-2px);
    }

/* Income input label */
#budgetTab label[for="income"] {
    display: block;
    margin-bottom: 25px !important;
}

/* Expense field spacing */
#fixedExpenses div,
#flexibleExpenses div {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    align-items: center;
    flex-wrap: nowrap;
}

    #fixedExpenses div input[type="text"],
    #flexibleExpenses div input[type="text"] {
        flex: 2;
        min-width: 120px;
    }

    #fixedExpenses div input[type="number"],
    #flexibleExpenses div input[type="number"] {
        flex: 1;
        min-width: 80px;
    }

    #fixedExpenses div .remove-btn,
    #flexibleExpenses div .remove-btn {
        flex: 0 0 auto;
    }

/* Add expense buttons */
.add-expense-btn {
    margin-top: 15px;
    margin-bottom: 15px;
    width: 100%;
    height: 44px;
    padding: 10px;
    border: none;
    background-color: #007BFF;
    color: white;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

    .add-expense-btn:hover {
        background-color: #0056b3;
        transform: translateY(-2px);
    }

/* Total displays */
#totalFixedCosts,
#totalBudgeted {
    margin-top: 10px;
    font-weight: bold;
    color: #333;
}

/* Remove buttons */
.remove-btn {
    width: auto;
    height: 44px;
    padding: 0 10px;
    background-color: #dc2626;
    font-weight: bold;
    border-radius: 5px;
    font-size: 20px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.3s ease, transform 0.2s ease;
}

    .remove-btn:hover {
        background-color: #b91c1c;
        transform: translateY(-2px);
    }

/* Pinned budget summary at bottom */
.summary-section {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    text-align: center;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
    border-top: 2px solid #ccc;
    z-index: 10;
}

/* Summary banner styling */
.summary-banner {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background-color: #f5f5f5;
    transition: background 0.3s ease;
}

    .summary-banner:hover {
        background-color: #e9ecef;
    }

/* Summary content - collapsible part */
.summary-content {
    padding: 10px;
    transition: height 0.3s ease-in-out;
    overflow: hidden;
}

/* Reduce spacing inside the summary section */
.summary-section h3 {
    margin: 0;
    font-size: 16px;
    padding: 0;
}

.summary-section p {
    margin: 1px 0;
    line-height: 1.2;
    font-size: 16px;
}

/* Highlighted budget numbers */
.summary-section .highlight {
    font-size: 1.4em;
    font-weight: bold;
    color: #ffd700;
}

/* Arrow for collapsible sections */
.banner-arrow {
    font-size: 14px;
}

/* Collapsible banners */
.collapsible-banner {
    padding: 2px 10px;
    height: 44px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 5px;
    margin-top: 10px;
    margin-bottom: 5px;
    color: white;
    background: #666;
    transition: background 0.3s ease;
    box-sizing: border-box;
    width: 100%;
}

    .collapsible-banner:hover {
        background: #555;
    }

/* Fixed and flexible expense banners */
#fixedBanner, #flexBanner {
    display: none;
}

/* Flexible expense inputs progress bar */
#flexibleExpenses input[type="number"] {
    background: #eee;
    transition: background 0.3s ease;
    min-width: 0;
}

@media (max-width: 768px) {
    #flexibleExpenses input[type="number"] {
        width: auto;
    }
}

/* Category selection UI */
.category-selection {
    border: 2px solid #ccc;
    padding: 10px;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 5px;
}

/* Category Buttons in Track Expenses */
.category-buttons button {
    color: black;
    padding: 10px;
    margin: 5px 0;
    width: 100%;
    display: block;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f8f9fa;
    transition: background 0.3s ease, transform 0.2s ease;
}

    .category-buttons button:hover {
        background-color: #e9ecef;
        transform: translateY(-2px);
    }

/* Expense Wizard Styling */
#expenseWizard {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    #expenseWizard label {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    #expenseWizard select,
    #expenseWizard input[type="date"],
    #expenseWizard input[type="number"],
    #expenseWizard input[type="text"] {
        width: 200px;
        box-sizing: border-box;
    }

/* Month-based grouping in Track Expenses */
.month-banner {
    padding: 2px 10px;
    height: 44px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 5px;
    margin-top: 10px;
    margin-bottom: 5px;
    background-color: #444;
    color: #fff;
    transition: background 0.3s ease;
}

    .month-banner:hover {
        background-color: #333;
    }

/* Month arrow */
.month-arrow {
    margin-left: 10px;
    font-size: 20px;
    font-weight: normal;
}

/* Controls section */
.controls {
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Tutorial Popup Styles */
.tutorial-popup {
    position: absolute;
    background: #007BFF;
    color: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    max-width: 250px;
}

    .tutorial-popup p {
        margin: 0;
        font-size: 14px;
    }

    .tutorial-popup button {
        margin-top: 8px;
        height: 25px;
        padding: 0 10px;
        background: white;
        color: #007BFF;
        border: none;
        border-radius: 3px;
        cursor: pointer;
        margin-right: 5px;
        font-size: 14px;
        display: flex;
        align-items: center;
        transition: background 0.3s ease;
    }

        .tutorial-popup button:hover {
            background: #f0f0f0;
        }

/* Fireworks container */
.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.explosion {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.money {
    position: absolute;
    font-size: 30px;
    color: #85BB65;
    text-shadow: 0 0 5px #000000, 0 0 10px #000000;
    animation: explode 1s ease-out forwards;
}

.added {
    position: absolute;
    font-size: 48px;
    font-weight: bold;
    color: #85BB65;
    text-shadow: 0 0 5px #ff073a, 0 0 10px #ff073a;
    animation: flyUp 1s ease-out forwards;
}

@keyframes explode {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--x), var(--y)) scale(2);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }

    100% {
        opacity: 0;
        transform: scale(1);
    }
}

@keyframes flyUp {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.8);
    }

    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1);
    }
}

/* Reports Tab Layout */
#reportsTab {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.report-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#periodSelector {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid #ccc;
    background-color: #f8f9fa;
    position: relative;
}

#periodPickerBtn {
    width: 100%;
    max-width: 400px;
    height: 44px;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.3s ease, border-color 0.3s ease;
    margin: 0 auto;
}

    #periodPickerBtn::after {
        content: '▼';
        font-size: 12px;
        margin-left: 10px;
    }

    #periodPickerBtn:hover {
        background-color: #f8f9fa;
        border-color: #007BFF;
    }

#periodDropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    opacity: 0;
    transform: translateX(-50%) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

    #periodDropdown[style*="block"] {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

.period-item {
    padding: 10px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .period-item:hover, .period-item:focus {
        background-color: #e9ecef;
    }

/* Charts full width with max 1000px */
#currentPeriodChartContainer,
#stackedBarChartContainer,
#lineChartContainer {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    box-sizing: border-box;
    min-height: 250px;
}

canvas {
    width: 100%;
    height: 450px;
    max-width: 1000px;
    max-height: 450px;
    display: block;
    margin: 0 auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: #fafafa;
    min-height: 250px;
}

/* Remove manual legends (Chart.js handles) */
#currentPeriodChartLegend,
#lineChartLegend {
    display: none;
}

/* Report Buttons (for export buttons) */
.report-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

    .report-buttons button {
        flex: 1;
        max-width: 200px;
        height: 44px;
        padding: 10px;
        font-size: 14px;
        font-weight: bold;
        border: none;
        background-color: #007BFF;
        color: white;
        border-radius: 5px;
        cursor: pointer;
        transition: background 0.3s ease, transform 0.2s ease;
    }

        .report-buttons button:hover {
            background-color: #0056b3;
            transform: translateY(-2px);
        }

/* Settings Buttons */
.settings-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

    .settings-buttons button {
        width: 100%;
        max-width: 400px;
        height: 44px;
        padding: 10px;
        font-size: 14px;
        font-weight: bold;
        border: 1px solid #ccc;
        background-color: #f8f9fa;
        color: black;
        border-radius: 5px;
        cursor: pointer;
        transition: background 0.3s ease, transform 0.2s ease;
        margin: 0 auto;
    }

        .settings-buttons button:hover {
            background-color: #e9ecef;
            transform: translateY(-2px);
        }

/* Fullscreen modal */
#fullScreenChartContainer {
    width: 100%;
    max-width: 1000px;
    height: 80vh;
    margin: 50px auto;
}

#fullScreenCanvas {
    width: 100%;
    height: 100%;
    max-height: 80vh;
}

/* Terms Popup */
.terms-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.terms-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

    .terms-content h3 {
        margin-top: 0;
    }

#termsText {
    margin: 10px 0;
    line-height: 1.2;
}

    #termsText h4 {
        margin: 10px 0 5px 0;
    }

    #termsText p {
        margin: 5px 0;
    }

.terms-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

    .terms-actions label {
        display: flex;
        align-items: center;
        gap: 5px;
    }

#viewTermsBtn {
    background-color: #007BFF;
    color: white;
    margin-bottom: 10px;
}

    #viewTermsBtn:hover {
        background-color: #0056b3;
    }

#acceptCheckbox {
    width: auto;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    appearance: checkbox;
    position: relative;
    width: 20px;
    height: 20px;
    background-color: white;
    border: 2px solid #333;
    cursor: pointer;
}

/* Pro Status */
#proStatus {
    display: flex;
    align-items: center;
    gap: 10px;
}

#proIcon.pro::before {
    content: '⭐';
    color: gold;
}

#proIcon:not(.pro)::before {
    content: '⚪';
    color: grey;
}

#proText.pro {
    color: #2ecc71;
    font-weight: bold;
}

#proText:not(.pro) {
    color: #333;
}

#cancelProButton:hover {
    background-color: #b91c1c;
}

/* Expense banners (side-by-side layout) */
.expense-banners {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-bottom: 10px;
    margin-top: 15px;
}

.banner {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: black;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    text-align: center;
    transition: background-color 0.1s ease, color 0.1s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

    .banner:hover {
        background-color: #e9ecef;
        transform: translateY(-2px);
    }

    .banner.active {
        background-color: #007BFF;
        color: white;
        transform: none;
    }

.banner-arrow {
    margin-left: 5px;
    font-size: 14px;
}

.collapsible-content {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    box-sizing: border-box;
    overflow: hidden;
    transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.help-text {
    font-style: italic;
    color: #666;
    margin-bottom: 10px;
}

#incomeHelpText {
    font-style: italic;
    color: #666;
    margin-left: 10px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    #fixedExpenses div,
    #flexibleExpenses div {
        gap: 5px;
    }

        #fixedExpenses div input[type="text"],
        #flexibleExpenses div input[type="text"] {
            flex: none;
            width: 48%;
            min-width: 90px;
        }

        #fixedExpenses div input[type="number"],
        #flexibleExpenses div input[type="number"] {
            flex: none;
            width: 32%;
            min-width: 70px;
        }

        #fixedExpenses div .remove-btn,
        #flexibleExpenses div .remove-btn {
            flex: none;
            width: 34px;
            padding: 0 7px;
        }

    .expense-banners {
        flex-direction: row;
        gap: 5px;
    }

    .banner {
        font-size: 12px;
        padding: 8px;
    }

    .settings-buttons button {
        max-width: 300px;
    }

    #periodPickerBtn {
        max-width: 300px;
    }

    #periodDropdown {
        max-width: 300px;
    }

    /* Adjust chart containers for mobile */
    #currentPeriodChartContainer,
    #stackedBarChartContainer,
    #lineChartContainer {
        width: 100%;
        min-height: 300px;
        max-height: 450px;
        padding: 15px;
        box-sizing: border-box;
    }

    canvas {
        width: 100%;
        height: 100%;
        max-height: 450px;
        min-height: 250px;
    }
}
