.app-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 0 20px 145px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition:
        transform 0.3s ease-in-out,
        opacity 0.3s ease-in-out;
}

.page {
    transition:
        transform 0.3s ease-out,
        opacity 0.3s ease-out;
    width: 100%;
}

/* Entrance States */
.slide-from-right {
    transform: translateX(100%);
    opacity: 0;
}
.slide-from-left {
    transform: translateX(-100%);
    opacity: 0;
}

/* Active State */
.slide-active {
    transform: translateX(0);
    opacity: 1;
    position: relative;
}

/* Exit States */
.exit-left {
    transform: translateX(-100%);
    opacity: 0;
    position: absolute; /* Takes it out of the flow so new page can move up */
    top: 0;
    left: 0;
}
.exit-right {
    transform: translateX(100%);
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    height: var(--header-height);
    height: calc(var(--header-height) + env(safe-area-inset-top));
    padding: 0 15px;
    padding-top: env(safe-area-inset-top);
    background: var(--layer-1);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    z-index: 100;
}

.page-header {
    position: sticky;
    top: 0;
    margin: 0 -20px 0 -20px;
    padding: 20px 20px 0 20px;
    padding-top: calc (20px + env(safe-area-inset-top));
    width: calc(100% + 40px);
    min-height: var(--header-height);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#settings-page {
    display: none; /* Default to hidden */
}
#leaderboard-page {
    display: none; /* Default to hidden */
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* =========================
     Install Banner 
   ========================= */
#install-banner {
    position: fixed;
    bottom: 150px;
    left: 20px;
    right: 20px;
    background: #ffffff;
    color: #333;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: slideUp 0.4s ease-out;
}

#install-banner.hidden {
    display: none;
}

.install-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.install-actions {
    display: flex;
    gap: 10px;
}

/* ============================== */

.daily-numbers-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 0;
}

/* =================================================
   BUTTONS
   ================================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 65px;
    padding-top: 5px;
    padding-bottom: 15px;
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--layer-2);
    border-top: var(--glass-border);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-4);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 10;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}

.nav-icon {
    width: 24px;
    height: 24px;
    fill: var(--text-muted); /* for inactive */
    transition: 0.2s;
}

.nav-item.active .nav-icon {
    fill: var(--fitness-green); /* for active */
}

.nav-item small {
    font-size: 0.8rem;
}
.nav-item.active small {
    color: var(--fitness-green);
}

.leaderboard-nav {
    position: sticky;
    top: calc(80px + env(safe-area-inset-top));
    margin-bottom: 20px;
    padding: 5px 20px;
    align-self: center;
    width: calc(100% + 20px);
    border-radius: 12px;
    background: var(--layer-2);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-2);
    border: var(--glass-border);
    z-index: 5;
}

.danger-zone {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--danger);
    text-align: center;
    display: grid;
    gap: 10px;
}

.input-inline-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    box-sizing: border-box;
}
.input-wide {
    width: 100%;
}
.input-compact {
    width: 120px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.trend-footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 0px;
    width: 100%;
}

.trend-col-left {
    flex: 1; /* Takes up available space */
    text-align: left;
}

.trend-col-right {
    flex: 1;
    text-align: right; /* Aligns text to the right edge */
}

/* =================================================
   CHARTS (WEEKLY & MONTHLY)
   ================================================= */
.chart-with-axis {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 75px;
    margin-top: 5px;
}

.bar-chart {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100%;
    border-bottom: var(--glass-border);
}

.bar-labels {
    display: flex;
    justify-content: space-between;
    margin: 4px 28px 0 28px;
}

/* Monthly Specific Logic */
.monthly-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

/* =================================================
   TAGS & BADGES
   ================================================= */
.streak-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.intensity-legend {
    display: flex;
    justify-content: space-around;
    margin-top: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: bold;
    text-transform: uppercase;
}

/* =================================================
   LEADERBOARD
   ================================================= */
.lb-row {
    display: flex;
    justify-content: space-between;
}

.lb-name {
    flex: 1;
    margin-left: 10px;
}

/* =================================================
   SETTINGS & EDITING
   ================================================= */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.date-picker-trigger {
    position: relative;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    min-width: 140px;
    height: 40px;
}

.edit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
}

.checkbox-grid {
    line-height: 2;
}

/* =================================================
   MODALS
   ================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

/* =================================================
   Symbols
   ================================================= */
/* Pull to Refresh Container */
#pull-to-refresh {
    position: fixed;
    top: -60px; /* Hide off-screen */
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: transform 0.15s ease-out;
    pointer-events: none; /* Don't block clicks to the header */
}
