/* فونت Vazirmatn از Google Fonts لود می‌شود (در index و dashboard). برای استفاده آفلاین فایل‌ها را در static/page/assets/fonts قرار دهید و @font-face را برگردانید. */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-UI-FD-Light.woff2') format('woff2');
    font-weight: 300; /* 'Light' usually corresponds to weight 300 */
    font-style: normal;
}

:root {
    --green: #239f40;
    --green-light: #2eb85c;
    --green-dark: #1a7a32;
    --red: #da0000;
    --bg: #fefdf8;
    --bg-alt: #f5f4ef;
    --fg: #1a1a1a;
    --fg-muted: #6b7280;
    --card: #ffffff;
    --border: #e5e7eb;
    --shadow: rgba(0,0,0,0.06);
    --glass: rgba(255,255,255,0.85);
    --nav-bg: rgba(255,255,255,0.92);
}

.dark {
    --bg: #0a0f1a;
    --bg-alt: #111827;
    --fg: #f1f5f9;
    --fg-muted: #94a3b8;
    --card: #1e293b;
    --border: #334155;
    --shadow: rgba(0,0,0,0.3);
    --glass: rgba(15,23,42,0.9);
    --nav-bg: rgba(15,23,42,0.95);
    --green: #2eb85c;
}

* {
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 300; /* This must match the weight defined in @font-face */
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background: var(--bg);
    color: var(--fg);
    overscroll-behavior: none;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

::-webkit-scrollbar { width: 0px; height: 0px; } /* Hide scrollbar for clean look */
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green); border-radius: 4px; }

.app-container {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.page {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.98);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto; /* Always allow scroll if needed */
    overflow-x: hidden;
}

.page.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    /* background: var(--glass); */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* border-bottom: 1px solid var(--border); */
    transition: all 0.3s ease;
}


/* home Page */
#logo-homepage {
    display: block;
    width: 90px;
    height: 90px;
    margin: 0 auto;
    margin-bottom: 20px;
}
.logo-homepage-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
/* Modern Floating Bottom Nav */
.bottom-nav-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    pointer-events: none;
}

.bottom-nav {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 30px;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    pointer-events: auto;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    position: relative;
    overflow: hidden;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 16px;
    color: var(--fg-muted);
    cursor: pointer;
    border-radius: 16px;
    position: relative;
    z-index: 2;
    min-width: 60px;
    flex: 1;
    transition: color 0.3s ease;
    border: none;
    background: none;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item span {
    font-size: 10px;
    font-weight: 700;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.nav-item.active {
    color: var(--green-light);
}

.nav-item.active svg {
    transform: scale(1.1);
}

.nav-bubble {
    position: absolute;
    height: 91%;
    min-width: 45px;
    width: 60px;
    background: #bfdfc77a;
    border-radius: 30px;
    top: 3px;
    left: 0;
    z-index: 1;
    opacity: 1;
    /* box-shadow: 0 4px 12px rgba(35, 159, 64, 0.4); */
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.dashboard-tab.hidden {
    display: none !important;
}

.page-chat.hidden {
    display: none !important;
}

.page-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0 100px 0;
    min-height: 200px;
    max-height: calc(100vh - 220px);
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.chat-bubble.sent {
    margin-right: 0;
    margin-left: auto;
    background: var(--green);
    color: white;
    border-bottom-left-radius: 4px;
}

.chat-bubble.received {
    margin-left: 0;
    margin-right: auto;
    background: var(--bg-alt);
    color: var(--fg);
    border: 1px solid var(--border);
    border-bottom-right-radius: 4px;
}

.chat-bubble-text { display: block; }
.chat-bubble-time { display: block; font-size: 0.7rem; opacity: 0.85; margin-top: 4px; }

.chat-input-wrap {
    display: flex;
    gap: 8px;
    padding: 10px 16px 12px;
    position: fixed;
    bottom: 78px;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg);
    z-index: 90;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--card);
    color: var(--fg);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--green);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    opacity: 0.95;
}

.chat-send-btn:active {
    transform: scale(0.96);
}

/* Form Elements */
.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-alt);
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 15px;
    color: var(--fg);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    background: var(--card);
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(35, 159, 64, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: white;
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(35, 159, 64, 0.3);
}

.card {
    background: var(--card);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 12px;
}

.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 10px; background: var(--bg-alt);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease; color: var(--fg);
}
.theme-toggle:hover { background: var(--green); color: white; transform: rotate(15deg); }

/* Toast */
.toast-container {
    position: fixed; top: 70px; left: 50%;
    transform: translateX(-50%); z-index: 1000;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    background: var(--card); color: var(--fg); padding: 12px 20px;
    border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--border); font-weight: 500; font-size: 14px;
    animation: toastIn 0.4s ease forwards; display: flex; align-items: center; gap: 8px;
}
.toast.success { border-right: 4px solid var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* Profile Image */
.profile-img-container { position: relative; width: 70px; height: 70px; flex-shrink: 0; }
.profile-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--green); }
.edit-btn { position: absolute; bottom: 0; right: 0; width: 24px; height: 24px; background: var(--green); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid var(--card); }

/* Tags */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: rgba(35, 159, 64, 0.1); color: var(--green); border-radius: 20px; font-size: 12px; font-weight: 500; }

/* Custom Select */
.select-wrapper { position: relative; }
.select-trigger {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
   
    width: 100%;
    gap: 10px;
}
.select-trigger > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select-trigger > svg {
    flex-shrink: 0;
}
.select-trigger:focus { outline: none; background: var(--card); border-color: var(--green); box-shadow: 0 0 0 4px rgba(35, 159, 64, 0.15); }
.select-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    max-height: 150px; overflow-y: auto; z-index: 50;
    box-shadow: 0 10px 40px var(--shadow); opacity: 0; visibility: hidden;
    transform: translateY(-10px); transition: all 0.3s ease;
}
.select-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.select-option { padding: 10px 14px; cursor: pointer; transition: all 0.2s ease; }
.select-option:hover { background: rgba(35, 159, 64, 0.1); }

/* Grids */
.explore-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.explore-item { aspect-ratio: 1; position: relative; overflow: hidden; cursor: pointer; }
.explore-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.explore-item:hover img { transform: scale(1.1); }
.masonry { columns: 1; column-gap: 12px; }
@media (min-width: 640px) { .masonry { columns: 2; } }
.masonry-item { break-inside: avoid; margin-bottom: 12px; }

/* Checkbox */
.checkbox-item { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer; transition: all 0.3s ease; }
.checkbox-item:has(input:checked) { border-color: var(--green); background: rgba(35, 159, 64, 0.08); }
.checkbox-item input { display: none; }
.checkbox-circle { width: 20px; height: 20px; border: 2px solid var(--border);  display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; flex-shrink: 0; }
.checkbox-item:has(input:checked) .checkbox-circle { background: var(--green); border-color: var(--green); }
.checkbox-circle svg { opacity: 0; transform: scale(0); transition: all 0.2s ease; color: white; }
.checkbox-item:has(input:checked) .checkbox-circle svg { opacity: 1; transform: scale(1); }

.hero-img-wrapper { height: 130px; border-radius: 16px; overflow: hidden; position: relative; }
.hero-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }

/* ========================================================== */
/* RESPONSIVE FIX FOR SMALL SCREENS (iPhone 4, S4, etc.)      */
/* ========================================================== */
@media screen and (max-height: 700px) {
    .hero-img-wrapper { height: 90px; } /* Smaller hero image */
     /* Tighter card padding */
    .form-input { padding: 10px 12px; font-size: 13px; } /* Smaller inputs */
    .btn-primary { padding: 10px 20px; font-size: 13px; } /* Smaller button */
    .nav-item { padding: 4px 12px; }
    .nav-item svg { width: 20px; height: 20px; }
    .nav-item span { font-size: 9px; }
    .bottom-nav { height: 54px; }
    /* .nav-bubble { height: 38px; top: 8px; } */
    .checkbox-item { padding: 8px; }
    .checkbox-item-my-help { padding: 4px !important; border: 0 !important;}
    .checkbox-item span { font-size: 12px; }
    .tag { padding: 4px 8px; font-size: 11px; }
    .profile-img-container { width: 60px; height: 60px; }
}

/* Even smaller adjustments (e.g. iPhone 4 height ~480px) */
@media screen and (max-height: 550px) {
    .hero-img-wrapper { height: 70px; margin-bottom: 8px; }
    h1 { font-size: 1.25rem; margin-bottom: 4px; }
    .card { padding: 10px; }
    .app-header { padding-top: 8px; padding-bottom: 8px; }
    .form-input { padding: 8px 10px; font-size: 12px; }
    .btn-primary { padding: 8px 16px; font-size: 12px; }
}

/* homepage text-slider */
/* کلاسی برای محو کردن متن */
.fade-out {
    opacity: 0;
    transform: translateY(-10px); /* حرکت به سمت بالا هنگام خروج */
}

/* Bottom sheet scroll behavior for long province/city lists */
#bsm-modal {
    height: min(82vh, 760px) !important;
    max-height: min(82vh, 760px) !important;
    overflow: hidden;
}

#bsm-list {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}