/* =========================================================
   RESET
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #050505;
    color: #ffffff;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}


/* =========================================================
   APPLICATION
========================================================= */

#app {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    margin: 0 auto;

    position: relative;

    background-image:
        linear-gradient(
            rgba(0, 0, 0, 0.28),
            rgba(0, 0, 0, 0.28)
        ),
        var(--background-image, none);

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    overflow-x: hidden;
}


/* =========================================================
   CONTENU PRINCIPAL
========================================================= */

main {
    width: 100%;
    padding: 16px;
    padding-bottom: 95px;
}

.page {
    width: 100%;
    display: none;
}

.page.active {
    display: block;
}


/* =========================================================
   TITRES
========================================================= */

.page-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.page-header button {
    flex-shrink: 0;
}


/* =========================================================
   BOUTONS
========================================================= */

button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.primary-button {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;

    border-radius: 14px;

    background: #ffffff;
    color: #000000;

    font-size: 15px;
    font-weight: 700;

    transition: 0.2s ease;
}

.primary-button:active {
    transform: scale(0.97);
}

.secondary-button {
    min-height: 44px;
    padding: 10px 15px;

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;

    font-size: 14px;
}

.danger-button {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;

    border-radius: 14px;

    background: #c62828;
    color: #ffffff;

    font-size: 15px;
    font-weight: 700;
}


/* =========================================================
   CARTE SOLDE
========================================================= */

.balance-card {
    width: 100%;
    padding: 22px 18px;
    margin-bottom: 14px;

    border-radius: 20px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.balance-label {
    font-size: 13px;
    color: #a7a7a7;
    margin-bottom: 7px;
}

.balance-value {
    font-size: 34px;
    line-height: 1.1;
    font-weight: 700;
    color: #ffffff;
    word-break: break-word;
}


/* =========================================================
   MOIS
========================================================= */

.current-month {
    margin-bottom: 14px;

    color: #bdbdbd;
    font-size: 14px;
}


/* =========================================================
   GRILLE RESUME
========================================================= */

.summary-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;

    margin-bottom: 14px;
}

.summary-card {
    min-width: 0;
    padding: 15px;

    border-radius: 16px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.summary-title {
    color: #9c9c9c;
    font-size: 12px;
    margin-bottom: 7px;
}

.summary-value {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;

    word-break: break-word;
}

.income-value {
    color: #4caf50;
}

.expense-value {
    color: #ef5350;
}


/* =========================================================
   BUDGET
========================================================= */

.budget-card {
    width: 100%;
    padding: 17px;
    margin-bottom: 14px;

    border-radius: 17px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    margin-bottom: 10px;
}

.budget-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.budget-remaining {
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;

    text-align: right;
}

.budget-bar {
    width: 100%;
    height: 8px;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.10);
    overflow: hidden;
}

.budget-progress {
    width: 0%;
    height: 100%;

    border-radius: 999px;

    background: #ffffff;

    transition: width 0.3s ease;
}


/* =========================================================
   LISTES
========================================================= */

.section-title {
    margin: 20px 0 10px;

    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
}

.transaction-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.transaction-item {
    width: 100%;
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 14px;

    border-radius: 15px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.transaction-info {
    min-width: 0;
    flex: 1;
}

.transaction-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-meta {
    margin-top: 4px;

    color: #909090;
    font-size: 12px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-amount {
    flex-shrink: 0;

    font-size: 14px;
    font-weight: 700;

    white-space: nowrap;
}

.transaction-amount.expense {
    color: #ef5350;
}

.transaction-amount.income {
    color: #4caf50;
}


/* =========================================================
   FILTRE MOIS
========================================================= */

.filter-box {
    width: 100%;
    margin-bottom: 15px;
}

.filter-box select {
    width: 100%;
}


/* =========================================================
   FORMULAIRES
========================================================= */

.form-group {
    width: 100%;
    margin-bottom: 14px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    color: #c7c7c7;
    font-size: 13px;
    font-weight: 600;
}

input,
select {
    width: 100%;
    max-width: 100%;
    min-height: 46px;

    padding: 11px 13px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;

    outline: none;

    background: rgba(20, 20, 20, 0.95);
    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
}

input:focus,
select:focus {
    border-color: rgba(255, 255, 255, 0.45);
}

input::placeholder {
    color: #777777;
}


/* =========================================================
   STATISTIQUES
========================================================= */

.stats-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;

    margin-bottom: 15px;
}

.stats-card {
    min-width: 0;
    padding: 12px 8px;

    border-radius: 14px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.07);

    text-align: center;
}

.stats-label {
    color: #929292;
    font-size: 10px;
    margin-bottom: 6px;
}

.stats-value {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;

    word-break: break-word;
}

.chart-card {
    width: 100%;
    padding: 15px;
    margin-bottom: 14px;

    border-radius: 17px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.chart-title {
    margin-bottom: 12px;

    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
}

.chart-container {
    width: 100%;
    height: 220px;
    position: relative;
}

.chart-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}


/* =========================================================
   PARAMETRES
========================================================= */

.settings-list {
    width: 100%;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-card {
    width: 100%;
    padding: 16px;

    border-radius: 16px;

    background: rgba(15, 15, 15, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.settings-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;

    margin-bottom: 6px;
}

.settings-description {
    color: #8f8f8f;
    font-size: 12px;
    line-height: 1.5;

    margin-bottom: 12px;
}


/* =========================================================
   SWITCH MODE SOMBRE
========================================================= */

.switch-row {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.switch-label {
    min-width: 0;

    color: #ffffff;
    font-size: 14px;
}

.switch {
    position: relative;

    width: 48px;
    height: 28px;

    flex-shrink: 0;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;

    border-radius: 999px;

    background: #444444;

    cursor: pointer;

    transition: 0.2s ease;
}

.slider::before {
    content: "";

    position: absolute;

    width: 22px;
    height: 22px;

    left: 3px;
    top: 3px;

    border-radius: 50%;

    background: #ffffff;

    transition: 0.2s ease;
}

.switch input:checked + .slider {
    background: #ffffff;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
    background: #000000;
}


/* =========================================================
   MODALES
========================================================= */

.modal {
    position: fixed;
    inset: 0;

    z-index: 1000;

    display: none;
    align-items: flex-end;
    justify-content: center;

    padding: 0;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.72);
}

.modal-content {
    position: relative;
    z-index: 2;

    width: 100%;
    max-width: 430px;

    max-height: 90vh;
    overflow-y: auto;

    padding: 20px 16px 25px;

    border-radius: 22px 22px 0 0;

    background: #111111;

    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 18px;
}

.modal-title {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
}

.close-modal {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;

    font-size: 20px;
}


/* =========================================================
   NAVIGATION BASSE
========================================================= */

.bottom-nav {
    position: fixed;

    left: 50%;
    bottom: 0;

    transform: translateX(-50%);

    width: 100%;
    max-width: 430px;

    height: 70px;

    z-index: 900;

    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));

    background: rgba(8, 8, 8, 0.96);

    border-top: 1px solid rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    padding-bottom: env(safe-area-inset-bottom);
}

.nav-button {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;

    padding: 8px 4px;
}

.nav-button img {
    width: 28px;
    height: 28px;

    object-fit: contain;

    opacity: 0.55;

    transition: 0.2s ease;
}

.nav-button.active img {
    opacity: 1;
    transform: scale(1.08);
}


/* =========================================================
   BOUTON AJOUT
========================================================= */

.add-button {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 15px;
}


/* =========================================================
   ETAT VIDE
========================================================= */

.empty-state {
    width: 100%;

    padding: 30px 15px;

    border-radius: 16px;

    background: rgba(15, 15, 15, 0.75);

    text-align: center;

    color: #888888;

    font-size: 13px;
}


/* =========================================================
   MODE SOMBRE
========================================================= */

body.dark {
    background: #000000;
}

body.dark #app {
    background-color: #050505;
}


/* =========================================================
   SCROLLBAR
========================================================= */

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}


/* =========================================================
   PETITS TELEPHONES
========================================================= */

@media (max-width: 360px) {

    main {
        padding: 12px;
        padding-bottom: 92px;
    }

    .balance-value {
        font-size: 29px;
    }

    .summary-value {
        font-size: 18px;
    }

    .stats-grid {
        gap: 6px;
    }

    .stats-card {
        padding: 10px 5px;
    }

    .stats-value {
        font-size: 13px;
    }

    .nav-button img {
        width: 25px;
        height: 25px;
    }
}


/* =========================================================
   ECRANS PLUS GRANDS
========================================================= */

@media (min-width: 431px) {

    body {
        background: #050505;
    }

    #app {
        box-shadow:
            0 0 40px rgba(0, 0, 0, 0.45);
    }
}