/* ============================================================
   RESET
============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #000;
    color: #fbf7f7;
    overflow-x: hidden;
}


/* ============================================================
   APPLICATION
============================================================ */

.app {
    position: relative;

    width: 100%;
    max-width: 480px;
    min-height: 100vh;

    margin: 0 auto;

    background-image: url("images/background.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;

    overflow: hidden;
}


.app::before {
    content: "";

    position: fixed;
    inset: 0;

    background: rgba(20, 20, 20, 0.48);

    pointer-events: none;

    z-index: 0;
}


.app > * {
    position: relative;
    z-index: 1;
}


/* ============================================================
   HEADER
============================================================ */

.top-bar {
    width: 100%;

    min-height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 14px 16px;

    background: rgba(0, 0, 0, 0.68);

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}


.title-area {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 4px;
}


.title-area h1 {
    font-size: 21px;
    font-weight: 700;

    line-height: 1.1;

    color: #d71313;
}


.title-area span {
    font-size: 13px;

    color: rgba(159, 157, 157, 0.62);
}


/* ============================================================
   BOUTON PARAMÈTRES
============================================================ */

.image-button {
    width: 44px;
    height: 44px;

    margin-left: auto;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 12px;

    background: rgba(255, 255, 255, 0.08);

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}


.image-button:active {
    transform: scale(0.92);

    background: rgba(255, 255, 255, 0.16);
}


.image-button img {
    width: 27px;
    height: 27px;

    object-fit: contain;

    display: block;
}


/* ============================================================
   CONTENU PRINCIPAL
============================================================ */

main {
    width: 100%;

    padding: 14px 12px 110px;
}


/* ============================================================
   CARTE CALENDRIER
============================================================ */

.calendar-card {
    width: 100%;

    padding: 12px;

    border-radius: 18px;

    background: rgba(0, 0, 0, 0.68);

    border: 1px solid rgba(255, 255, 255, 0.08);

    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}


/* ============================================================
   NAVIGATION DU MOIS
============================================================ */

.calendar-navigation {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 14px;
}


.calendar-navigation h2 {
    flex: 1;

    text-align: center;

    font-size: 17px;
    font-weight: 700;

    color: #df0c0c;
}


.month-button {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.08);

    color: #c91515;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}


.month-button:active {
    transform: scale(0.9);

    background: rgba(255, 255, 255, 0.16);
}


/* ============================================================
   JOURS DE LA SEMAINE
============================================================ */

.weekdays {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(7, minmax(0, 1fr));

    margin-bottom: 5px;
}


.weekdays div {
    text-align: center;

    padding: 6px 0;

    font-size: 10px;
    font-weight: 600;

    color: rgba(241, 9, 9, 0.89);
}


/* ============================================================
   CALENDRIER
============================================================ */

.calendar {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(7, minmax(0, 1fr));

    grid-auto-rows: minmax(72px, 1fr);

    gap: 3px;
}


/* ============================================================
   CASE JOUR
============================================================ */

.calendar-day {
    position: relative;

    width: 100%;
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 6px 2px 4px;

    border: 1px solid rgba(255, 255, 255, 0.055);

    border-radius: 9px;

    background: rgba(255, 255, 255, 0.045);

    color: #fdfafa;

    cursor: pointer;

    overflow: hidden;

    transition:
        background 0.15s ease,
        border 0.15s ease,
        transform 0.12s ease;
}


.calendar-day:active {
    transform: scale(0.96);

    background: rgba(255, 255, 255, 0.13);
}


.calendar-day.empty {
    border-color: transparent;

    background: transparent;

    cursor: default;
}


.calendar-day.empty:active {
    transform: none;
}


/* ============================================================
   NUMÉRO DU JOUR
============================================================ */

.day-number {
    width: 25px;
    height: 25px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    font-size: 12px;
    font-weight: 600;

    color: rgba(251, 248, 248, 0.88);
}


/* ============================================================
   AUJOURD'HUI
============================================================ */

.calendar-day.today .day-number {
    background: #dd0a0a;

    color: #000;

    font-weight: 700;
}


/* ============================================================
   JOUR SÉLECTIONNÉ
============================================================ */

.calendar-day.selected {
    background: rgba(255, 255, 255, 0.15);

    border-color: rgba(233, 10, 10, 0.861);
}


.calendar-day.today.selected .day-number {
    background: #f60606;

    color: #000;
}


/* ============================================================
   POIDS DANS LA CASE
============================================================ */

.day-weight {
    width: 100%;

    margin-top: 4px;

    text-align: center;

    font-size: 9px;
    font-weight: 700;

    line-height: 1.1;

    color: #f7f2f2;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* ============================================================
   VARIATION DU POIDS
============================================================ */

.day-difference {
    width: 100%;

    margin-top: 3px;

    text-align: center;

    font-size: 8px;
    font-weight: 700;

    line-height: 1;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* Perte */

.day-difference.loss {
    color: #35d06f;
}


/* Prise */

.day-difference.gain {
    color: #ff4d4d;
}


/* Aucun changement */

.day-difference.same {
    color: rgba(255, 255, 255, 0.55);
}


/* ============================================================
   CARTE JOUR SÉLECTIONNÉ
============================================================ */

.selected-day-card {
    width: 100%;

    margin-top: 12px;

    padding: 16px;

    border-radius: 18px;

    background: rgba(0, 0, 0, 0.70);

    border: 1px solid rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}


/* ============================================================
   EN-TÊTE JOUR
============================================================ */

.selected-day-header {
    display: flex;
    align-items: center;

    margin-bottom: 15px;
}


.selected-day-header > div {
    display: flex;
    flex-direction: column;

    gap: 4px;
}


.small-label {
    font-size: 11px;

    color: rgba(255, 255, 255, 0.48);
}


#selectedDate {
    font-size: 16px;

    color: #e70909;
}


/* ============================================================
   CHAMP POIDS
============================================================ */

.weight-entry {
    width: 100%;
}


.weight-entry label {
    display: block;

    margin-bottom: 7px;

    font-size: 12px;

    color: rgba(255, 255, 255, 0.65);
}


.weight-input-row {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 8px;
}


#weightInput {
    flex: 1;

    min-width: 0;

    height: 46px;

    padding: 0 13px;

    border: 1px solid rgba(255, 255, 255, 0.12);

    border-radius: 11px;

    outline: none;

    background: rgba(255, 255, 255, 0.08);

    color: #f5f2f2;

    font-size: 16px;
}


#weightInput:focus {
    border-color: rgba(255, 255, 255, 0.45);

    background: rgba(255, 255, 255, 0.11);
}


#weightInput::placeholder {
    color: rgba(255, 255, 255, 0.30);
}


.weight-input-row > span {
    font-size: 13px;

    color: rgba(255, 255, 255, 0.55);
}


#saveWeight {
    height: 46px;

    padding: 0 14px;

    border: none;

    border-radius: 11px;

    background: #e70606c0;

    color: #000;

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;

    white-space: nowrap;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}


#saveWeight:active {
    transform: scale(0.95);

    opacity: 0.8;
}


/* ============================================================
   DIFFÉRENCE SOUS LE CALENDRIER
============================================================ */

.difference {
    min-height: 20px;

    margin-top: 12px;

    font-size: 13px;
    font-weight: 600;

    color: rgba(255, 255, 255, 0.72);
}


/* ============================================================
   BARRE FIXE DU BAS
============================================================ */

.bottom-bar {
    position: fixed !important;

    left: 50%;
    bottom: 0;

    transform: translateX(-50%);

    width: 100%;
    max-width: 480px;

    min-height: 70px;

    display: grid;

    grid-template-columns: 1fr 1fr;

    padding:
        10px 16px
        calc(10px + env(safe-area-inset-bottom));

    background: rgba(0, 0, 0, 0.88);

    border-top: 1px solid rgba(255, 255, 255, 0.10);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    z-index: 50 !important;
}


.bottom-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 4px;
}


.bottom-info span {
    font-size: 10px;

    color: rgba(255, 255, 255, 0.45);
}


.bottom-info strong {
    font-size: 16px;

    color: #fff;
}


/* ============================================================
   FENÊTRE PARAMÈTRES
============================================================ */

.settings-overlay {
    position: fixed !important;

    inset: 0;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    background: rgba(0, 0, 0, 0.65);

    z-index: 100 !important;

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}


.settings-overlay.hidden {
    display: none;
}


.settings-panel {
    width: 100%;
    max-width: 480px;

    padding: 20px 18px;

    padding-bottom:
        calc(20px + env(safe-area-inset-bottom));

    border-radius: 22px 22px 0 0;

    background: #101010;

    border-top: 1px solid rgba(255, 255, 255, 0.10);

    box-shadow:
        0 -15px 45px rgba(0, 0, 0, 0.45);
}


/* ============================================================
   HEADER PARAMÈTRES
============================================================ */

.settings-header {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 22px;
}


.settings-header h2 {
    font-size: 19px;

    color: #fff;
}


.close-button {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.08);

    color: #fff;

    font-size: 25px;

    cursor: pointer;
}


/* ============================================================
   CHAMPS PARAMÈTRES
============================================================ */

.setting-field {
    width: 100%;

    margin-bottom: 16px;
}


.setting-field label {
    display: block;

    margin-bottom: 7px;

    font-size: 12px;

    color: rgba(255, 255, 255, 0.55);
}


.setting-input {
    width: 100%;
    height: 48px;

    display: flex;
    align-items: center;

    border: 1px solid rgba(255, 255, 255, 0.10);

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.06);
}


.setting-input input {
    flex: 1;

    width: 100%;
    height: 100%;

    padding: 0 13px;

    border: none;
    outline: none;

    background: transparent;

    color: #fff;

    font-size: 16px;
}


.setting-input input::placeholder {
    color: rgba(255, 255, 255, 0.28);
}


.setting-input span {
    padding-right: 14px;

    font-size: 13px;

    color: rgba(255, 255, 255, 0.50);
}


/* ============================================================
   BOUTON PARAMÈTRES
============================================================ */

.save-settings-button {
    width: 100%;

    height: 48px;

    margin-top: 6px;

    border: none;

    border-radius: 12px;

    background: #fff;

    color: #000;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}


.save-settings-button:active {
    transform: scale(0.97);

    opacity: 0.82;
}


/* ============================================================
   PETITS ÉCRANS
============================================================ */

@media (max-width: 360px) {

    .top-bar {
        padding-left: 12px;
        padding-right: 12px;
    }


    main {
        padding-left: 8px;
        padding-right: 8px;
    }


    .calendar-card {
        padding: 8px;
    }


    .calendar {
        grid-auto-rows: minmax(61px, 1fr);

        gap: 2px;
    }


    .calendar-day {
        padding-top: 5px;
    }


    .day-number {
        width: 23px;
        height: 23px;

        font-size: 11px;
    }


    .day-weight {
        margin-top: 3px;

        font-size: 8px;
    }


    .day-difference {
        margin-top: 2px;

        font-size: 7px;
    }


    #saveWeight {
        padding-left: 10px;
        padding-right: 10px;
    }

}


/* ============================================================
   ÉCRAN PLUS LARGE
============================================================ */

@media (min-width: 481px) {

    body {
        background: #050505;
    }

}