* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

* {
    -webkit-tap-highlight-color: transparent;
}

*::-webkit-scrollbar {
    display: none;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('../fonts/SFProDisplay-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('../fonts/SFProDisplay-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SF Pro Rounded';
    src: url('../fonts/SFRounded-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SF Pro Rounded';
    src: url('../fonts/SFRounded-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SF Pro Rounded';
    src: url('../fonts/SFRounded-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
}

/* Title */
.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.title {
    font-family: 'SF Pro Display', sans-serif;
    font-weight: bold;
    font-size: 2em;
    color: var(--tg-theme-text-color);
    margin: 0;
    padding: 0;
}

/* change toggle */
.settings {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border: none;
    padding: 8px 12px;
    border-radius: 30px;
    font-size: 1em;
    height: 100%;
    cursor: pointer;
}



/* Items Container */
.items-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: calc(var(--tg-safe-area-inset-top) + var(--tg-content-safe-area-inset-top)) 12px;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

/* Card */
.item-card {
    display: flex;
    align-items: center;
    background: var(--tg-theme-section-bg-color);
    border-radius: 25px;
    padding: 0.7em 5%;
    margin-bottom: 10px;
}

.item-icon {
    width: 50px;
    height: 50px;
    margin-right: 16px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.lottie-icon {
    width: 100%;
    height: 100%;
}

.item-info {
    flex: 1;
}

.item-name {
    font-family: 'SF Pro Rounded', sans-serif;
    font-weight: 600;
    font-size: 20px;
    margin-bottom: 4px;
}

.item-stats {
    font-family: 'SF Pro Rounded', sans-serif;
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

.item-price {
    text-align: right;
}

.price-main {
    font-family: 'SF Pro Rounded', sans-serif;
    font-weight: 600;
    font-size: 20px;
    margin-bottom: 4px;
}

.price-details {
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.price-details span {
    font-family: 'SF Pro Rounded', sans-serif;
}

.price-change {
    font-weight: 600;
}

.price-change.positive {
    color: #4CAF50;
}

.price-change.negative {
    color: #F44336;
}

.ton-icon img {
    width: 16px;
    margin-right: -8px;
}

/* --- Bottom Navigation --- */
.bottom-nav {
    font-family: 'SF Pro Display', sans-serif;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: solid 1px rgba(129, 129, 129, 0.3);
    background: rgb(25 28 33 / 70%);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0 calc(var(--tg-safe-area-inset-bottom) + var(--tg-content-safe-area-inset-bottom) + 10px);
    transition: all 0.3s ease;
    z-index: 999;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--tg-theme-hint-color);
    font-size: 13px;
}

.nav-item.active {
    color: var(--tg-theme-button-color);
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    fill: var(--tg-theme-hint-color);
}

.nav-item.active .nav-icon svg {
    fill: var(--tg-theme-button-color);
}

/* --- Footer Mode --- */
.bottom-nav.footer-mode {
    justify-content: space-between;
    padding: 14px 20px calc(var(--tg-safe-area-inset-bottom) + var(--tg-content-safe-area-inset-bottom) + 10px);
    flex-direction: row;
}

.bottom-nav.footer-mode .nav-item {
    display: none;
}

.footer-replace {
    display: none;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.bottom-nav.footer-mode .footer-replace {
    display: flex;
}

.footer-left {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    opacity: 0.7;
    font-family: 'SF Pro Rounded', sans-serif;
}

.scroll-top {
    font-size: 18px;
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    padding: 4px 10px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

a,
a:focus,
a:active {
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

/* نوتیفکیشن */
.bottom-nav.toast-mode {
    position: fixed;
    bottom: 40px;
    left: 40px;
    right: 40px;
    transform: none;
    height: auto;
    min-height: 48px;
    max-width: calc(100% - 24px);
    padding: 12px 16px;
    background: rgba(75, 75, 75, 0.4);
    backdrop-filter: blur(20px);
    border-radius: 18px;
    color: #fff;
    font-family: 'SF Pro Display', sans-serif;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    pointer-events: auto;
    z-index: 9999;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    animation: toastAppear 0.3s ease forwards;
}

/* مخفی کردن آیتم‌های ناوبری */
.bottom-nav.toast-mode .nav-item,
.bottom-nav.toast-mode .footer-replace {
    display: none !important;
}

/* Icon inside toast */
.bottom-nav.toast-mode svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    fill: white;
}


/* ---- Search Box ---- */
.search-row {
    margin-bottom: 12px;
}

.search-box {
    position: relative;
    background: var(--tg-theme-section-bg-color);
    border-radius: 20px;
    padding: 10px 14px 10px 14px;
    display: flex;
    align-items: center;
}

.search-box input {
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--tg-theme-text-color);
    width: 100%;
    font-family: 'SF Pro Rounded', sans-serif;
    font-size: 16px;
}

.search-box button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--tg-theme-hint-color);
    font-size: 20px;
    cursor: pointer;
}

.search-empty {
    text-align: center;
    color: var(--tg-theme-hint-color);
    margin-top: 24px;
    font-family: 'SF Pro Rounded', sans-serif;
}




/* Settings */

/* --- Bottom Sheet --- */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 1000;
}

.sheet-overlay.show {
    opacity: 1;
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tg-theme-section-bg-color);
    color: var(--tg-theme-text-color);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
    max-height: 75vh;
    height: auto;
    padding: 10px 14px calc(14px + var(--tg-safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.2, .8, .2, 1);
    z-index: 1001;
}

.sheet.open {
    transform: translateY(0);
}

.sheet[hidden] {
    display: block;
}


.sheet-handle {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--tg-theme-hint-color, #888);
    opacity: .35;
    margin: 6px auto 8px;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
}

.sheet-header h2 {
    font-family: 'SF Pro Display', sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.sheet-close {
    font-size: 22px;
    line-height: 1;
    border: 0;
    background: transparent;
    color: var(--tg-theme-hint-color);
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
}

.sheet-content {
    display: grid;
    gap: 14px;
}

/* Rows */
.setting-row {
    background: var(--tg-theme-section-bg-color);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-title {
    font-family: 'SF Pro Rounded', sans-serif;
    font-weight: 600;
}

.setting-hint {
    font-size: 12px;
    opacity: .65;
    margin-top: 4px;
}

/* Segmented control */
.segmented {
    background: var(--tg-theme-secondary-bg-color);
    position: relative;
    display: flex;
    gap: 0;
    padding: 4px;
    border-radius: 24px;
}

.segmented-btn {
    position: relative;
    z-index: 1;
    flex: 1 1 0;
    text-align: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 24px;
    color: var(--tg-theme-text-color);
    font-weight: 600;
    cursor: pointer;
}

.segmented::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: var(--tg-theme-button-color);
    border-radius: 24px;
    transform: translateX(0);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    z-index: 0;
}

.segmented-btn.active,
.segmented-btn[aria-selected="true"] {
    color: var(--tg-theme-button-text-color);
}

.segmented:has(.segmented-btn[data-period="7d"].active)::before,
.segmented:has(.segmented-btn[data-period="7d"][aria-selected="true"])::before {
    transform: translateX(100%);
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 999px;
    transition: transform .22s ease, background .22s ease;
}

.slider::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    left: 3px;
    top: 3px;
    background: var(--tg-theme-button-color);
    transition: inherit;
}

.switch input:checked+.slider {
    background: var(--tg-theme-button-color);
}

.switch input:checked+.slider::before {
    transform: translateX(20px);
    background: var(--tg-theme-secondary-bg-color);
}

.battery-saver * {
    animation: none !important;
    transition: none !important;
}