body {
  background: #0f172a !important;
  background-image: none !important;
  animation: none !important;
  background-attachment: scroll !important;
}

.topbar {
    direction: rtl;
	position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    background: #dc3545;
    color: #000;
    padding: .4rem .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dc3545;
    backdrop-filter: none !important;
}

.topbar .brand {
    font-weight: 700;
}

.topbar .brand .fa-check-square-o {
    cursor: pointer;
    margin-right: .4rem;
}


.topbar .user-email {
    min-width: 170px; /* ثابت بماند تا نجنبد */
    display: inline-block;
    white-space: nowrap;
    direction: ltr; /* انگليسی چپ به راست */
    font-weight: 700;
}

.typing-caret::after {
    content: '▌';
    display: inline-block;
    margin-left: 2px;
    animation: caretBlink 1.5s steps(1) infinite;
}

@keyframes caretBlink {
    50% {
        opacity: 0;
    }
}

/* کارت اصلی (کانتینر) */
.grid-card {
    /* حذف بردر و سایه از اینجا چون به لایه داخلی منتقل می‌شوند */
    border: none;
    box-shadow: none;
    background: transparent;
    
    display: flex;
    flex-direction: column;
    height: 350px;
    position: relative;
    
    /* نکته کلیدی: اینجا visible می‌ماند تا منو بیرون بزند */
    overflow: visible; 
    opacity: .9;
    z-index: 1; /* لایه پایه */
}

/* لایه جدید داخلی برای استایل، پس‌زمینه و برش */
.grid-card-bg-layer {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid #00000020;
    box-shadow: unset;
    
    /* اینجا hidden می‌گذاریم تا پس‌زمینه بلور شده بیرون نزند */
    overflow: hidden; 
    z-index: 0; /* زیر همه محتوا */
    
    /* انتقال متغیرهای پس‌زمینه */
    --bg-blur: 3px;
    --bg-light: .75;
}

/* استایل‌های پس‌زمینه را به این کلاس جدید منتقل می‌کنیم */
/* لایه تصویر پس‌زمینه */
/* لایه تصویر پس‌زمینه (::after) */
.grid-card-bg-layer.has-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--bg-url);
    background-size: cover;
    background-position: center;
    z-index: 0;
    pointer-events: none;
    /* افزایش شفافیت تصویر برای دیده شدن */
    opacity: 0.7 !important; 
    filter: blur(var(--bg-blur, 0px)) !important;
}

/* لایه پوششی سفید (::before) */
.grid-card-bg-layer.has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    /* اصلاح شد: استفاده از متغیر bg-light به جای مقدار ثابت */
    background: rgba(255, 255, 255, var(--bg-light, 0.4)) !important;
    z-index: 1;
    pointer-events: none;
}


.grid-card.has-bg::before,
.grid-card.has-bg::after {
  content: none !important;
  background: none !important;
  filter: none !important;
}

/* بازگشت استایل‌های هدر و فوتر به حالت ساده (چون لایه زیری گرد است) */
.grid-header {
    /* حذف گردی‌های عجیب */
    border-radius: 14px 14px 0 0; 
    /* z-index بالا برای منو */
    z-index: 10; 
    position: relative;
}

.grid-footer {
    border-radius: 0 0 14px 14px;
    position: relative;
    z-index: 2;
}

.grid-body {
    position: relative;
    z-index: 2;
}

.grid-header {
    padding: .55rem .8rem;
    border-bottom: 1px solid #eee;
    background: #ffffffb8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* عدد بالا برای قرار گرفتن روی تمام تسک‌ها */
    z-index: 50; 
    /* گرد کردن گوشه‌های بالا چون overflow کارت برداشته شده */
    border-radius: 14px 14px 0 0; 
}

.grid-title {
    font-weight: 700;
    color: #111;
}

.grid-body {
    padding: .6rem .8rem;
    overflow-y: auto;
    flex: 1;
    position: relative;
    z-index: 1;
}

.grid-footer {
    padding: .6rem .8rem;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    position: relative;
    z-index: 1;
    /* گرد کردن گوشه‌های پایین */
    border-radius: 0 0 14px 14px; 
}

.empty-msg {
    color: #e7e7e7;
    padding: 2px 7px;
    background: #606060;
    width: fit-content;
    text-align: center;
    margin-inline: auto;
    border-radius: 9px;
    margin-block: auto;
    position: relative;
    top: 50%;
}

.grid-card {
    --bg-blur: 3px;
    --bg-light: .75;
}

.grid-card.has-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--bg-url);
    background-size: cover;
    background-position: center;
    filter: blur(var(--bg-blur));
    transform: scale(1.06);
    z-index: 0;
    pointer-events: none;
}

.grid-card.has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, var(--bg-light));
    z-index: 1;
    pointer-events: none;
}

/* آیتم پیش‌فرض در لیست تنظیمات: خاکستری */
#catSettingsList .cat-default {
    background: #f3f3f3;
}

.grid-card .grid-body,
.grid-card .grid-footer {
    position: relative;
    z-index: 2;
}



/* تسک */
.task-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: .25rem .7rem;
    margin-bottom: .15rem;
    position: relative;
    z-index: 0;
}

.task-title {
    font-weight: normal;
    color: #000;
    font-size: .95em;
}

.grid-card .task-row[data-pinned="1"] .task-title {
    font-weight: 700;
}

.drag-handle {
    cursor: grab;
    color: #000;
    display: inline-block;
    width: 16px;
    text-align: center;
}

.icon-btn {
    border: none;
    background: transparent;
    font-size: 1rem;
    cursor: pointer;
    color: #000;
    margin-right: 7px;
}

.icon-btn-change,
.icon-btn-alarm {
    background: transparent;
    cursor: pointer;
    color: #000;
    padding: 0;
    font-size: 1.1em;
    display: flex;
}

.info-btn {
    color: #000;
    font-size: .9em;
    margin-right: 0;
}

/* منوی هر تسک (DropDown) */
.task-menu {
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    margin-top: .3rem;
    background: #ffffff;
    border: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    border-radius: 8px;
    padding: .35rem;
    display: none; /* ← پنهانِ پیش‌فرض */
    z-index: 10000;
}

.task-menu.show {
    display: flex; /* تغییر به فلکس برای کنترل بهتر */
    flex-direction: column;
    gap: .2rem;
    text-align: start; /* شروع متن بر اساس زبان (راست در فارسی) */
    width: max-content;
}

.task-menu .menu-btn {
	direction:ltr;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: start;
    gap: 5px;
    border: none;
    margin: .15rem;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.task-row.menu-open {
    z-index: 10001;
}


.task-row.sortable-chosen,
.task-row.sortable-drag,
.task-row.drag-chosen,
.task-row.dragging {
    background: #fff3cd;
    border-radius: 10px;
    box-shadow: 0 0 0 2px #ffe58f, 0 8px 18px rgba(0, 0, 0, .25);
    transition: none !important;
    z-index: 2;
}

.task-row.sortable-ghost,
.task-row.drag-ghost {
    background: rgba(255, 243, 205, .5);
    border-radius: 10px;
    outline: 2px dashed #ffe58f;
    opacity: .8;
}

.task-row.sortable-drag .drag-handle,
.task-row.dragging .drag-handle {
    cursor: grabbing;
}

.fa-bell {
    color: #dc3545;
}

.fa-bell-o,
.fa-trash-o {
    color: #000;
}

.pill {
    font-size: .75rem;
    background: #eef2ff;
    color: #3b5bd6;
    border-radius: 999px;
    padding: .15rem .5rem;
}


.brand .fa-check-square-o:before {
   content: "\f046";
}

.fa-bell:before {
    content: "⏰";
}

.fa-bell-info:before {
    content: "⏱️";
}

.btn-copy-grid {
    direction: ltr !important;
}

/* دکمه‌های کناری */
.rail-btn {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    border: none;
    padding: .6rem .45rem;
    border-radius: 10px 0 0 10px;
    cursor: pointer;
    opacity: .95;
    color: #fff;
    position: fixed;
    right: 0;
    z-index: 1050;
}

#btnTrash {
    background: #ffc107;
    color: #212529;
    bottom: 10%;
    rotate: 180deg;
    padding: 6px 0;
    font-size: 1.7em;
    opacity: .8;
}



#btnSettingsDemo {
    left: 0px;
    bottom: 10%;
    background: var(--bs-blue);
    color: #ffffff;
    padding: 6px 0;
    font-size: 1.7em;
    opacity: .8;
    right: auto;
}

/* دراورها */
.drawer {
    position: fixed;
    top: 42px;
    bottom: 0;
    width: 360px;
    background: #fff;
    z-index: 1045;
    box-shadow: 0 0 20px rgba(0, 0, 0, .25);
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
}

.drawer.right {
    right: 0;
}

.drawer.show {
    transform: translateX(0);
}

.drawer-header {
    padding: .8rem 1rem;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-body {
    padding: 1rem;
    overflow-y: auto;
}

.drawer-footer {
    padding: .8rem 1rem;
    border-top: 1px solid #eee;
}

.loadmore-container {
    margin-top: .5rem;
    text-align: center;
}

/* انیمیشن‌ها */
@keyframes zoomInSoft {
    from {
        transform: scale(.96);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOutSoft {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(.96);
        opacity: 0;
    }
}

.anim-zoomIn {
    animation: zoomInSoft .22s ease both;
}

.anim-zoomOut {
    animation: zoomOutSoft .18s ease both;
}

.popover,
.popover .popover-body {
    font-family: "Open Sans", sans-serif !important;
    text-align: justify;
    font-size: .85rem;
    line-height: 1.7;
}

.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

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

.cal-cell {
    text-align: center;
    padding: .35rem 0;
    background: #f6f6f6;
    border-radius: 6px;
    font-size: .85rem;
}

.cal-today {
    outline: 2px solid #0d6efd;
    background: #e7f0ff;
}

.cal-dow {
    font-weight: 700;
    background: #eef2ff;
}

.btn-pin-add {
    background: var(--bs-black) !important;
    color: #ffffff !important;
    border-color: #000000;
}

.btn-pin-add:hover {
    color: #dc3545 !important;
}

.flatpickr-calendar.md-only .flatpickr-current-month .numInputWrapper {
    display: none;
}

.flatpickr-calendar.md-only .flatpickr-monthDropdown-months {
    margin-right: 0;
}

.bd-days {
    cursor: pointer;
    user-select: none;
    font-size: 0.65rem;
}

.modal {
    z-index: 9999;
}

.modal-title {
    font-weight: bold;
}

.text-bg-light-custom {
    color: #ffffff !important;
    background-color: var(--bs-warning-text-emphasis) !important;
}

.blur-mode-on .task-title,
.blur-mode-on .bd-name {
    filter: blur(1.5px);
    transition: filter .15s ease;
    background: #000;
}

.swal-occasion-list {
    list-style-type: none;
    padding: 0; /* حذف پدینگ راست */
    margin-top: 15px;
    text-align: right;
    border: 1px solid #dee2e6; /* بوردر زیبا شبیه بوت‌استرپ */
    border-radius: 6px; /* گوشه‌های گرد */
    overflow: hidden; /* برای اینکه بوردر ردیوس درست اعمال شود */
}

.swal-occasion-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px; /* پدینگ جدید */
    border-bottom: 1px solid #dee2e6; /* خط جداکننده بوت‌استرپی */
    font-size: 0.9em; /* [اصلاح] فونت ریزتر */
    font-weight: normal; /* [اصلاح] اطمینان از عدم بولد بودن */
}

.swal-occasion-list li:last-child {
    border-bottom: none; /* حذف خط از آیتم آخر */
}

/* استایل نام مناسبت */
.swal-occasion-list .occasion-name {
    font-weight: normal; /* [اصلاح] حذف بولد */
    color: #212529; /* رنگ متن استاندارد */
}

/* استایل تاریخ/زمان باقیمانده */
.swal-occasion-list .occasion-due {
    white-space: nowrap;
    padding-right: 15px;
    color: #495057; /* کمی خاکستری */
    font-weight: normal; /* [اصلاح] حذف بولد */
}

.swal-occasion-list .occasion-due.today {
    font-weight: normal; /* [اصلاح] حذف بولد */
    color: #dc3545; /* رنگ قرمز حفظ شود */
}

.swal2-actions {
    margin-top: 0;
}

.stats-card,
.stats-card .grid-header,
.stats-card .grid-body,
.stats-card .grid-footer {
    background: #ffffff !important;
    color: #000000 !important;
}

.stats-card .grid-header {
    border-bottom: 1px solid #e0e0e0;
}

.stats-card .grid-footer {
    border-top: 1px solid #e0e0e0;
}

#statsChartContainer {
    background: #ffffff;
}

#btnShowGoogleLogin {
    align-items: center;
    gap: 6px;
    vertical-align: sub;
    font-weight: bold;
    color: #2d2d2d;
    font-family: monospace;
}

#btnShowGoogleLogin > img {
    vertical-align: sub !important;
}

#demoAlert {
    position: fixed;
    top: 60px;
    right: 0px;
    z-index: 1040;
    margin: 0px;
    width: fit-content;
    margin-right: auto !important;
    margin-left: auto !important;
    border-radius: 22px;
}

#btnShowGoogleLogin {
    direction: ltr;
}

/* برای اینکه آیکان‌ها کنار هم باشند و شبیه دکمه شوند */
.lang-toggle img {
    width: 30px; /* اندازه دلخواه */
    height: 30px;
    border-radius: 50%; /* گرد کردن پرچم‌ها (اختیاری) */
    cursor: pointer;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.lang-toggle img:hover {
    transform: scale(1.1); /* کمی بزرگنمایی ao روی هاور */
    opacity: 0.8;
}

.copyright {
    font-size: 0.7rem;
    padding: 0;
    line-height: 1.6;
    font-family: monospace;
    direction: ltr;
}

/* Brand Menu */
.brand-menu {
    top: 100%;
    inset-inline-start: 0; /* چپ یا راست بسته به زبان */
    inset-inline-end: auto;
    width: 200px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
}
.brand-menu.show {
    display: flex;
}

/* Grid Title Menu */
.grid-title-menu {
    top: 100%;
    inset-inline-start: 0;
    inset-inline-end: auto;
    width: 180px;
    font-size: 0.9rem;
    font-weight: normal;
}
.grid-title-menu.show {
    display: flex;
    flex-direction: column;
}
.grid-title-menu .menu-btn {
    padding: 6px 10px;
}

/* Grid Drag Handle */
.grid-drag-handle {
    color: #aaa;
    transition: color 0.2s;
}
.grid-drag-handle:hover {
    color: #333;
}

/* راست‌چین کردن منوها در حالت فارسی و چپ‌چین در انگلیسی */
.task-menu.show {
    text-align: start !important; 
    display: flex !important;
    flex-direction: column;
}

/* استایل درگ اند دراپ: جای خالی آیتم */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f0f0f0;
    border: 2px dashed #ccc;
    box-shadow: none !important;
}

/* استایل آیتمی که در حال کشیده شدن است */
.sortable-drag {
    cursor: grabbing;
    background: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transform: scale(1.02);
}

/* --- استایل‌های درگ اند دراپ نرم (Grids) --- */

/* ۱. جای خالی آیتم (Ghost) */
/* وقتی آیتم را بلند می‌کنید، این استایل جای خالی آن را در لیست نشان می‌دهد */
.grid-ghost {
    opacity: 0.25; /* کمی پررنگ‌تر برای دیده شدن بهتر جای خالی */
    background-color: #e9ecef;
    border: 2px dashed #adb5bd;
    border-radius: 14px;
    box-shadow: none !important;
}
.grid-ghost > * {
    opacity: 0; /* محتوای داخل جای خالی دیده نشود */
}

/* ۲. آیتم در حال حرکت (Fallback/Drag) */
/* این همان کپی‌ای است که زیر ماوس کاربر می‌چسبد */
.grid-fallback {
    opacity: 1 !important;
    background: #fff;
    border-radius: 14px;
    /* سایه نرم و یکدست برای حس شناور بودن */
    box-shadow: 0 15px 35px rgba(0,0,0,0.2), 0 5px 15px rgba(0,0,0,0.1);
    /* به جای چرخش، فقط کمی بزرگ شود تا حس بلند شدن بدهد */
    transform: scale(1.02); 
    cursor: grabbing;
    pointer-events: none; /* بسیار مهم برای جلوگیری از پرش */
    z-index: 99999 !important;
    overflow: hidden; /* جلوگیری از بیرون زدگی محتوا */
}

/* مخفی کردن دکمه‌های اضافی هنگام درگ برای ظاهر تمیزتر */
.grid-fallback .grid-footer, 
.grid-fallback .btn-copy-grid,
.grid-fallback .grid-drag-handle {
    display: none;
}

/* تنظیم پس‌زمینه سفید و خوانا برای منوی گرید */
.grid-title-menu {
    background-color: #ffffff !important;
    border: 1px solid #e0e0e0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border-radius: 8px;
    z-index: 1000;
}

/* تنظیم نشانگر موس برای هدر (نشان دهنده قابلیت درگ) */
/* تنظیم نشانگر موس و جلوگیری از انتخاب متن هنگام درگ */
.grid-header {
    cursor: grab;
    /* استاندارد برای جلوگیری از آبی شدن متن هنگام درگ */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE10+/Edge */
    user-select: none;         /* Standard */
}
.grid-header:active {
    cursor: grabbing;
}

/* نشانگر موس برای آیتم‌های تعاملی داخل هدر (که نباید درگ شوند) */
.grid-title, 
.btn-copy-grid {
    cursor: pointer !important;
}

#btnBrandMenu > span{
	direction: ltr;
}

/* --- اصلاحات ریسپانسیو برای موبایل (هدر) --- */

/* تنظیمات مخصوص صفحه‌های کوچک (موبایل) */
@media (max-width: 576px) {
    
    /* ۱. جلوگیری از دو خطی شدن عنوان سایت */
    .topbar .brand {
        white-space: nowrap !important; /* هرگز نشکند */
        font-size: 1.1rem; /* کمی کوچک‌تر برای جا شدن */
        display: flex;
        align-items: center;
    }

    /* ۲. جلوگیری از دو خطی شدن دکمه ورود و جمع‌وجور کردن آن */
	#btnShowGoogleLogin {
        white-space: nowrap !important;
        font-size: 0.8rem !important;
        padding: 0.25rem 0.5rem !important;
        height: 32px;
        /* important حذف شد تا تابع hide() در جاوااسکریپت بتواند کار کند */
        display: inline-flex; 
        align-items: center;
    }

    /* ۳. کم کردن فاصله بین دکمه ورود و پرچم (gap-3 خیلی زیاد است) */
    .topbar .d-flex.gap-3 {
        gap: 0.3rem !important; 
    }
    
    /* تنظیم اندازه لوگوی گوگل داخل دکمه */
    #btnShowGoogleLogin img {
        width: 14px !important;
        height: 14px !important;
    }

}

/* مطمئن شوید پس‌زمینه مودال blur ندارد */
.modal-backdrop {
  backdrop-filter: none !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
}

.modal-content {
  box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important;
  border: none !important;
}

/* بهینه‌سازی textarea (اگر دارید) */
textarea.form-control {
  resize: none !important;
  box-shadow: none !important;
}

textarea.form-control:focus {
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1) !important;
}

/* اگر blur-mode دارید و روی آیتم‌های زیاد فعال می‌شود، این از blur واقعی سبک‌تر است */
.blur-mode-on .task-title,
.blur-mode-on .bd-name {
  filter: none !important;
  opacity: 0.15 !important;
}

.task-emoji-icon {
    display: inline-block !important;
    filter: grayscale(30%) !important;
    transition: all 0.3s ease !important;
    font-style: normal !important;
}

.task-row:hover .task-emoji-icon {
    filter: grayscale(0%) opacity(1) !important;
}

/* اعمال افکت سیاه و سفید روی تمام دکمه‌های اصلی و اختصاصی */
.btn, .icon-btn, .menu-btn {
    filter: grayscale(40%) opacity(0.9) !important;
    transition: all 0.3s ease !important;
}

/* رنگی شدن و وضوح کامل هنگام هاور کردن روی خود دکمه */
.btn:hover, .icon-btn:hover, .menu-btn:hover {
    filter: grayscale(0%) opacity(1) !important;
}

/* یک حالت حرفه‌ای‌تر: وقتی ماوس روی کل کارت گرید می‌رود، دکمه‌های آن کمی واضح‌تر شوند */
.grid-card:hover .btn, 
.grid-card:hover .icon-btn {
    filter: grayscale(40%) opacity(0.9);
}

/* احترام به تنظیمات کاهش حرکت در سیستم‌عامل */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.rec-meta { font-size: 0.75rem; color: #666; }