/* ==================================================
    КОЛЬОРИ
================================================== */

:root {
    --background: #f4f7f2;
    --card: #ffffff;
    --green-dark: #2f4f3e;
    --green: #5f806d;
    --green-light: #dfe9e1;
    --text: #26332b;
    --text-light: #718078;
    --border: #d8e2da;
}

/* ==================================================
    ОСНОВА СТОРІНКИ
================================================== */

body {
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, sans-serif;
}

/* ==================================================
    ШАПКА
================================================== */

header {
    background: var(--green);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 32px;
    fonth-weight: 700;
}

header p {
    margin: 8px 0 0;
    color: var(--green-light);
}

/* ==================================================
    ОСНОВНИЙ КОНТЕНТ
================================================== */

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

section {
    margin-bottom: 30px;
}

section h2 {
    margin: 0 0 20px;
    color: var(--green-dark);
    font-size: 24px;
}

/* ==================================================
    ФІНАНСОВІ КАРТКИ
================================================== */

.finance-summary article {
    background: var(--card);
    padding: 24px 20px;
    margin-bottom: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 4px;
}

.finance-summary h3 {
    margin: 0 0 10px;
    color: var(--green-dark);
    font-size: 18px;
}

.finance-summary p {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

/* ==================================================
    ОНОВЛЕННЯ ПОДУШКИ
================================================== */

#saving-form {
    background: var(--card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px;
}

#saving-form label {
    display: block;
    margin-bottom: 6px;
    color: var(--green-dark);
    font-size: 16px;
    font-weight: bold;
}

#saving-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
}

#saving-button {
    width: 100%;
    padding: 13px;
    background: var(--green);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

#saving-button:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
}

#saving-status {
    margin: 12px 0 0;
    color: var(--text-light);
    font-size: 14px;
}

/* ==================================================
    ФОРМА ДОДАВАННЯ ОПЕРАЦІЇ
================================================== */

#transaction-form {
    background: var(--card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px;
}

#transaction-form label {
    display: block;
    margin-bottom: 6px;
    color: var(--green-dark);
    font-size: 16px;
    font-weight: bold;
}

#transaction-form input,
#transaction-form select {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
}

#transaction-form button {
    width: 100%;
    padding: 13px;
    background: var(--green);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

#transaction-form button:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
}

/* ==================================================
    ДАТА
================================================== */

.date-row {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

#transaction-form .date-row input {
    width: 180px;
    flex: none;
    margin-bottom: 0;
}

#transaction-form #today-button {
    width: 300px;
    padding: 0 14px;
}

/* ==================================================
    КНОПКИ ФОРМИ
================================================== */

.form-actions {
    display: flex;
    gap: 10px;
}

#transaction-form .form-actions button {
    width: 50%;
}

#transaction-form #undo-button {
    background: var(--card);
    color: var(--green-dark);
    border: 1px solid var(--border);
}

#transaction-form #undo-button:hover {
    background: #b85f5f;
    transform: translateY(-2px);
}

#save-status,
#undo-status {
    margin: 12px 0 0;
    color: var(--text-light);
    font-size: 14px;
}

/* ==================================================
    ІСТОРІЯ ОПЕРАЦІЙ
================================================== */

#transactions-list > div {
    padding: 15px 20px;
    margin-bottom: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: 0.2s;
}

#transactions-list > div:hover {
    transform: translateY(-2px);
}

#transactions-list .income {
    background: #e3efe5;
    border-left: 5px solid var(--green);
}

#transactions-list .expense {
    background: #f3e7e4;
    border-left: 5px solid #a85f52;
}

/* ==================================================
    ВМІСТ КАРТКИ ОПЕРАЦІЇ
================================================== */

.transaction-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.transaction-category {
    font-size: 16px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.transaction-amount {
    font-size: 16px;
    font-weight: bold;
}

.transaction-date {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 14px;
}

#transactions-list .income .transaction-amount {
    color: var(--green-dark);
}

#transactions-list .expense .transaction-amount {
    color: #a85f52;
}

/* ==================================================
    МОБІЛЬНА ВЕРСІЯ
================================================== */

@media (max-width: 700px) {

    main {
        padding: 24px 14px;
    }

    header {
        padding: 24px 14px;
    }

    header h1 {
        font-size: 28px;
        fonth-weight: 700;
    }

    section h2 {
        font-size: 22px;
    }

    .finance-summary article {
        padding: 20px 18px;
    }

    #transaction-form,
    #saving-form {
        padding: 20px 18px;
    }

    .date-row {
        flex-direction: column;
        gap: 8px;
    }

    #transaction-form .date-row input {
        width: 100%;
        margin-bottom: 0;
    }

    #transaction-form #today-button {
        width: 100%;
        padding: 13px;
    }

    .form-actions {
        flex-direction: column;
    }

    #transaction-form .form-actions button {
        width: 100%;
    }

    .transaction-main {
        gap: 8px;
        align-items: flex-start;
    }

    .transaction-amount {
        white-space: nowrap;
    }
}