/* =========================================================================
 |  اجاره کوتاه مدت سایت ۲ — تقویم رزرو ، پنل میزبان و فاکتور
 |  تبدیل تاریخ سمت سرور انجام می شود ؛ اینجا فقط ظاهر شبکه تقویم است.
 * ====================================================================== */

:root {
    --gr-open: #1e3a2c;
    --gr-open-bg: #ffffff;
    --gr-selected: #1e3a2c;
    --gr-inrange: #e8f1ec;
    --gr-closed: #f3f4f6;
    --gr-unopened: #fafafa;
    --gr-booked: #fdeaea;
    --gr-border: #e6e8eb;
}

.gr-cal {
    direction: rtl;
}

.gr-cal__months {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .gr-cal--multi .gr-cal__months {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .gr-cal--wide .gr-cal__months {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.gr-cal__month {
    border: 1px solid var(--gr-border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

/* ---- ورق زدن ماه ها روی گوشی (MonthPager در site2-rental.js) --------------
   شش ماهِ پشت سر هم روی موبایل حدود ۳۴۰۰ پیکسل بود. خانه ها در DOM می مانند و
   فقط ماه جاری دیده می شود ، پس انتخاب بازه بین دو ماه هم کار می کند. */

.gr-cal__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.gr-cal__nav[hidden] {
    display: none;
}

.gr-cal__navlabel {
    font-weight: 700;
    font-size: 0.95rem;
}

.gr-cal__navbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--gr-border);
    border-radius: 10px;
    background: #fff;
    color: inherit;
    cursor: pointer;
}

.gr-cal__navbtn:disabled {
    opacity: .4;
    cursor: default;
}

.gr-cal--paged .gr-cal__month {
    display: none;
}

.gr-cal--paged .gr-cal__month.is-current {
    display: block;
}

/* نامِ ماه بالای نوار ورق زدن نوشته می شود ؛ عنوانِ داخلِ کارت همان را دوباره
   تکرار می کرد. */
.gr-cal--paged .gr-cal__month .gr-cal__title {
    display: none;
}

.gr-cal__title {
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.gr-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.gr-cal__dow {
    text-align: center;
    font-size: 0.7rem;
    color: #7a8290;
    padding-bottom: 4px;
}

.gr-cal__cell {
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1.1;
    cursor: default;
    padding: 2px;
    background: var(--gr-unopened);
    color: #8D9AA8;
    user-select: none;
}

.gr-cal__cell--empty {
    background: transparent;
    border-color: transparent;
}

.gr-cal__price {
    font-size: 0.6rem;
    margin-top: 2px;
    opacity: 0.75;
    white-space: nowrap;
}

/* روز باز و قابل انتخاب */
.gr-cal__cell--open {
    background: var(--gr-open-bg);
    border-color: var(--gr-border);
    color: #22272f;
    cursor: pointer;
}

.gr-cal__cell--open:hover {
    border-color: var(--gr-open);
}

.gr-cal__cell--weekend.gr-cal__cell--open {
    background: #fffaf0;
}

/* روزی که میزبان هنوز باز نکرده — با روز «رزرو شده» یکی نیست */
.gr-cal__cell--unopened {
    background: repeating-linear-gradient(45deg, #fafafa, #fafafa 4px, #f2f2f2 4px, #f2f2f2 8px);
    color: #8D9AA8;
}

.gr-cal__cell--closed {
    background: var(--gr-closed);
    color: #7E8A97;
    text-decoration: line-through;
}

.gr-cal__cell--booked {
    background: var(--gr-booked);
    color: #c05252;
    text-decoration: line-through;
}

/* روزهای گذشته و بسته عمدا کم رنگ اند ، ولی #dcdfe3 روی سفید عملا نامرئی بود
   (کنتراست ۱٫۳ به ۱) و کاربر عدد روز را نمی دید. اینها حالا خاکستریِ خوانا اند. */
.gr-cal__cell--past {
    background: transparent;
    color: #A7B2BF;
}

/* انتخاب مسافر */
.gr-cal__cell--selected {
    background: var(--gr-selected) !important;
    border-color: var(--gr-selected) !important;
    color: #fff !important;
}

.gr-cal__cell--inrange {
    background: var(--gr-inrange) !important;
    border-color: var(--gr-inrange) !important;
    /* رنگ متن هم باید با پالت بخش اجاره جلو برود ؛ قبلا سبزِ ثابتِ پوسته ی قدیم
       بود و روی زمینه ی فیروزه ای شبیه یک لکه ی جامانده دیده می شد. */
    color: var(--gr-open) !important;
}

.gr-cal__cell--checkout {
    background: var(--gr-selected) !important;
    border-color: var(--gr-selected) !important;
    color: #fff !important;
}

/* راهنمای رنگ ها */
.gr-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 0.75rem;
    color: #5c646f;
    margin-top: 12px;
}

.gr-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gr-legend__swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid var(--gr-border);
    display: inline-block;
}

.gr-legend__swatch--open { background: #fff; }
.gr-legend__swatch--unopened { background: repeating-linear-gradient(45deg, #fafafa, #fafafa 3px, #eee 3px, #eee 6px); }
.gr-legend__swatch--closed { background: var(--gr-closed); }
.gr-legend__swatch--booked { background: var(--gr-booked); }
.gr-legend__swatch--selected { background: var(--gr-selected); }

/* جعبه رزرو در صفحه اقامتگاه.

   چسبندگی روی ظرفِ کلِ ستون است و نه روی خودِ جعبه ی رزرو: وقتی فقط .gr-book
   چسبنده بود ، کارتِ «ساعت ورود و خروج» که بلافاصله بعد از آن می آید هنگام
   اسکرول از زیرش بالا می آمد و رویش می نشست. زیر ۹۹۲ پیکسل ستون کناری زیر متن
   می رود و چسبندگی معنایی ندارد ، پس آنجا خاموش است. */
.rt-aside-sticky {
    position: static;
}

@media (min-width: 992px) {
    .rt-aside-sticky {
        position: sticky;
        top: 90px;
        /* ستون از ارتفاع پنجره بلندتر است ؛ بدون این دو خط ، sticky انتهای فرم
           رزرو را برای همیشه زیر لبه ی پایین نگه می داشت. */
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
    }
}

.gr-book {
    position: static;
}

.rt-admin-box {
    border: 1px solid var(--gr-border) !important;
}

.gr-book__price {
    font-size: 1.25rem;
    font-weight: 700;
}

.gr-book__dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.gr-book__date {
    border: 1px solid var(--gr-border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    background: #fff;
}

.gr-book__date small {
    display: block;
    color: #7a8290;
    font-size: 0.7rem;
}

.gr-book__date strong {
    font-size: 0.85rem;
}

.gr-book__date.is-active {
    border-color: var(--gr-open);
    box-shadow: 0 0 0 2px rgba(30, 58, 44, 0.12);
}

.gr-book__rows {
    font-size: 0.82rem;
}

.gr-book__rows .row-line {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.gr-book__total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    border-top: 1px dashed var(--gr-border);
    padding-top: 8px;
    margin-top: 8px;
}

.gr-nights-table {
    max-height: 190px;
    overflow-y: auto;
    font-size: 0.78rem;
}

/* پنل میزبان */
.gr-owner-toolbar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #fff;
    border-top: 1px solid var(--gr-border);
    padding: 12px;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
}

.gr-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    background: #eef1f4;
    color: #47505c;
}

.gr-chip--success { background: #e6f5ec; color: #1c7a45; }
.gr-chip--warning { background: #fdf3e2; color: #a3701a; }
.gr-chip--danger  { background: #fdeaea; color: #b23b3b; }

/* فاکتور */
.gr-invoice {
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--gr-border);
    border-radius: 14px;
    padding: 24px;
}

.gr-invoice__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 2px solid var(--gr-open);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.gr-invoice table {
    width: 100%;
    border-collapse: collapse;
}

.gr-invoice th,
.gr-invoice td {
    border: 1px solid var(--gr-border);
    padding: 8px 10px;
    font-size: 0.85rem;
    text-align: right;
}

.gr-invoice thead th {
    background: #f6f8f7;
}

.gr-invoice__stamp {
    display: inline-block;
    border: 2px solid;
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 700;
    transform: rotate(-4deg);
}

@media print {
    .gr-no-print,
    header,
    footer,
    .btn-scroll-top,
    #goftino_w {
        display: none !important;
    }

    .gr-invoice {
        border: none;
        max-width: 100%;
    }

    body {
        background: #fff !important;
    }
}

/* نوار صف های مدیر روی گوشی.

   با هشت «قرص» ، ‎flex-wrap‎ چهار سطر می ساخت و بالای هر صفحه ی مدیریت نصف نمایشگر
   منو بود. زیر ۷۶۸ پیکسل یک ردیفِ افقیِ اسکرول شونده می شود و قرص فعال هم با
   scroll-snap در دید می ماند. */
@media (max-width: 767.98px) {
    .rt-adminnav {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 6px;
        margin-bottom: 1rem !important;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .rt-adminnav > .nav-item {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .rt-adminnav .nav-link {
        white-space: nowrap;
        font-size: 0.82rem;
        padding: 7px 12px;
    }
}

/* =========================================================================
 |  تقویم تک ماهه ی پنل میزبان
 |
 |  پنل میزبان از این پس یک ماه در هر صفحه نشان می دهد ، ولی شبکه ی
 |  .gr-cal--wide هنوز سه ستون می ساخت: همان یک ماه در یک سومِ کارت
 |  می نشست ، به لبه ی راست می چسبید و دو سومِ صفحه سفیدِ خالی می ماند.
 |  وقتی فقط یک ماه هست ، شبکه یک ستونِ وسط چین با خانه های بزرگ تر است.
 * ====================================================================== */
.gr-cal--single .gr-cal__months,
.gr-cal--multi.gr-cal--single .gr-cal__months,
.gr-cal--wide.gr-cal--single .gr-cal__months {
    grid-template-columns: minmax(0, 1fr);
    max-width: 720px;
    margin-inline: auto;
}

/* ماهی که همین حالا ویرایش می شود باید از بقیه ی کارت جدا دیده شود. فقط در
   پنل میزبان ؛ تقویمِ مسافر «در حال ویرایش» ندارد. */
.gr-cal--single[data-gr-owner-calendar] .gr-cal__month {
    padding: 16px;
    border: 2px solid var(--gr-open);
    border-radius: 16px;
    box-shadow: 0 0 0 4px rgba(30, 58, 44, 0.06);
}

/* نام ماه بالای نوار ورق زدن نوشته می شود ؛ عنوان داخل کارت همان را دوباره
   تکرار می کرد. */
.gr-cal--single[data-gr-owner-calendar] .gr-cal__title {
    display: none;
}

.gr-cal--single .gr-cal__grid {
    gap: 6px;
}

.gr-cal--single .gr-cal__dow {
    font-size: 0.8rem;
    font-weight: 600;
    padding-bottom: 8px;
}

.gr-cal--single .gr-cal__cell {
    min-height: 72px;
    font-size: 1rem;
    border-radius: 10px;
    padding: 6px 4px;
}

.gr-cal--single .gr-cal__price {
    font-size: 0.7rem;
    margin-top: 4px;
}

.gr-cal--single .gr-legend {
    justify-content: center;
    margin-top: 16px;
}

@media (max-width: 575.98px) {
    .gr-cal--single[data-gr-owner-calendar] .gr-cal__month {
        padding: 8px;
    }

    .gr-cal--single .gr-cal__grid {
        gap: 4px;
    }

    .gr-cal--single .gr-cal__cell {
        min-height: 54px;
        font-size: 0.85rem;
    }
}

/* ---- نوار ورق زدن ماه در پنل میزبان ---------------------------------- */
.gr-monthnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 18px;
    border-radius: 14px;
    background: #f4f7f5;
    border: 1px solid var(--gr-border);
}

.gr-monthnav__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
    text-align: center;
}

.gr-monthnav__month {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gr-open);
}

.gr-monthnav__hint {
    font-size: 0.7rem;
    color: #6b7a72;
}

@media (max-width: 575.98px) {
    .gr-monthnav {
        gap: 8px;
        padding: 8px;
    }

    .gr-monthnav__month {
        font-size: 1.05rem;
    }

    /* روی گوشی این توضیح در ۶۸ پیکسل به سه سطر می شکست و نوار را دو برابر
       بلند می کرد ؛ نام ماه به تنهایی همان کار را می کند. */
    .gr-monthnav__hint {
        display: none;
    }
}

/* ---- گوشه های گرد input-group روی صفحه ی راست به چپ --------------------
   بوت استرپِ این پوسته چپ به راست کامپایل شده ولی ‎main‎ روی ‎direction: rtl‎
   می نشیند. نتیجه اش این بود که در «نرخ روزهای انتخاب شده» لبه ی بیرونیِ
   جعبه ی متن و دکمه تخت در می آمد و گوشه ی گرد به محل چسبیدن آن دو می افتاد.
   اینجا فقط همان چهار گوشه جابه جا می شوند ؛ ‎margin-right: -1px‎ سرِ جایش
   می ماند چون در حالت راست به چپ همان لبه ی درست را روی هم می آورد. */
main .input-group {
    --gr-ig-radius: 0.5rem;
}

main .input-group-sm {
    --gr-ig-radius: 0.375rem;
}

main
  .input-group:not(.has-validation)
  > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu),
main .input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n + 3) {
    border-top-right-radius: var(--gr-ig-radius);
    border-bottom-right-radius: var(--gr-ig-radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

main
  .input-group
  > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    border-top-left-radius: var(--gr-ig-radius);
    border-bottom-left-radius: var(--gr-ig-radius);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* نوار ماه ، دکمه های انتخاب و خودِ تقویم باید یک ستون به هم چسبیده باشند ؛
   وگرنه دکمه ها تمامِ عرضِ کارت را می گیرند و تقویمِ وسط چین زیرشان معلق
   به نظر می رسد. */
.gr-cal-col {
    max-width: 720px;
    margin-inline: auto;
}
