/* استایل اصلی چله - تم لاکی قالی */

:root {
    /* پالت اصلی */
    --pl-primary: #b3383e;
    --pl-primary-2: #d4574b;
    --pl-primary-dark: #8f2b34;
    --pl-primary-rgb: 179, 56, 62;
    --pl-gradient: linear-gradient(135deg, #b3383e, #d4574b);

    /* رنگ مکمل (فیروزه‌ای - برای اکسنت‌های آینده) */
    --pl-accent: #0e9594;

    /* سطوح و متن */
    --pl-bg: #f8f5f3;
    --pl-surface: #ffffff;
    --pl-text: #1f2937;
    --pl-muted: #6b7280;
    --pl-border: #f0e5e2;

    /* شعاع و سایه */
    --pl-radius: 12px;
    --pl-radius-lg: 16px;
    --pl-shadow-sm: 0 1px 3px rgba(75, 27, 30, 0.06), 0 1px 2px rgba(75, 27, 30, 0.04);
    --pl-shadow: 0 4px 14px rgba(75, 27, 30, 0.07), 0 1px 3px rgba(75, 27, 30, 0.05);
    --pl-shadow-lg: 0 12px 32px rgba(75, 27, 30, 0.12), 0 4px 10px rgba(75, 27, 30, 0.06);

    /* ابعاد چیدمان */
    --pl-sidebar-w: 256px;
    --pl-topbar-h: 64px;

    /* سایدبار */
    --pl-sidebar-bg: linear-gradient(180deg, #331417 0%, #260f12 100%);
    --pl-sidebar-text: rgba(255, 255, 255, 0.72);
    --pl-sidebar-muted: rgba(255, 255, 255, 0.38);
    --pl-sidebar-hover: rgba(255, 255, 255, 0.08);

    /* نگاشت بوت‌استرپ */
    --bs-primary: #b3383e;
    --bs-primary-rgb: 179, 56, 62;
    --bs-link-color: #b3383e;
    --bs-link-color-rgb: 179, 56, 62;
    --bs-link-hover-color: #8f2b34;
    --bs-link-hover-color-rgb: 143, 43, 52;
    --chelleh-bg: var(--pl-bg);
}

html.sidebar-collapsed {
    --pl-sidebar-w: 76px;
}

body {
    background-color: var(--pl-bg);
    color: var(--pl-text);
}

/* اعداد فارسی در فیلدهای ورودی */
input, textarea, select, .form-control, .form-select {
    font-feature-settings: "ss03";
}

/* ==================================================
   نگاشت رنگ اصلی بوت‌استرپ به ایندیگو
   ================================================== */
.btn-primary {
    --bs-btn-bg: #b3383e;
    --bs-btn-border-color: #b3383e;
    --bs-btn-hover-bg: #5558e6;
    --bs-btn-hover-border-color: #5558e6;
    --bs-btn-active-bg: #8f2b34;
    --bs-btn-active-border-color: #8f2b34;
    --bs-btn-disabled-bg: #a5b4fc;
    --bs-btn-disabled-border-color: #a5b4fc;
    background-image: var(--pl-gradient);
    border: none;
    border-radius: 10px;
    transition: box-shadow 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background-image: var(--pl-gradient);
    filter: brightness(1.06);
    box-shadow: 0 6px 18px rgba(179, 56, 62, 0.35);
}

.btn-primary:active {
    background-image: var(--pl-gradient);
    filter: brightness(0.95);
}

.btn-primary:disabled, .btn-primary.disabled {
    background-image: none;
}

.btn-outline-primary {
    --bs-btn-color: #b3383e;
    --bs-btn-border-color: #b3383e;
    --bs-btn-hover-bg: #b3383e;
    --bs-btn-hover-border-color: #b3383e;
    --bs-btn-active-bg: #8f2b34;
    --bs-btn-active-border-color: #8f2b34;
    border-radius: 10px;
}

.btn {
    border-radius: 10px;
    transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.15s ease, color 0.15s ease;
}

.bg-primary {
    background-color: #b3383e !important;
}

.text-primary {
    color: #b3383e !important;
}

.badge.bg-primary {
    background-color: #b3383e !important;
}

.form-check-input:checked {
    background-color: #b3383e;
    border-color: #b3383e;
}

.form-check-input:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 0.2rem rgba(179, 56, 62, 0.2);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-image: var(--pl-gradient);
}

.pagination {
    --bs-pagination-color: #b3383e;
    --bs-pagination-hover-color: #8f2b34;
    --bs-pagination-focus-color: #8f2b34;
    --bs-pagination-active-bg: #b3383e;
    --bs-pagination-active-border-color: #b3383e;
    --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(179, 56, 62, 0.2);
}

.dropdown-menu {
    border: 1px solid var(--pl-border);
    border-radius: var(--pl-radius);
    box-shadow: var(--pl-shadow-lg);
    overflow: hidden;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: background 0.12s ease;
}

.dropdown-item:active {
    background-color: #b3383e;
}

/* ==================================================
   چیدمان اپلیکیشن: سایدبار + تاپ‌بار + محتوا
   ================================================== */
.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--pl-sidebar-w);
    z-index: 1045;
    display: flex;
    flex-direction: column;
    background: var(--pl-sidebar-bg);
    color: var(--pl-sidebar-text);
    transition: width 0.25s ease, transform 0.25s ease;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    min-height: var(--pl-topbar-h);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    min-width: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--pl-gradient);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(179, 56, 62, 0.45);
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--pl-sidebar-text);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.25s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

html.sidebar-collapsed #sidebarCollapseBtn i {
    transform: rotate(180deg);
}

#sidebarCollapseBtn i {
    transition: transform 0.25s ease;
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px 20px;
}

.side-group-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--pl-sidebar-muted);
    padding: 16px 12px 6px;
    white-space: nowrap;
}

.side-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 10px;
    color: var(--pl-sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.side-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.side-link:hover {
    background: var(--pl-sidebar-hover);
    color: white;
    transform: translateX(-2px);
}

.side-link::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 60%;
    border-radius: 4px 0 0 4px;
    background: var(--pl-gradient);
    transition: transform 0.25s ease;
}

.side-link.active {
    background-image: var(--pl-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(179, 56, 62, 0.4);
}

.side-link.active::before {
    transform: translateY(-50%) scaleY(1);
}

.sidebar-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
    white-space: nowrap;
}

.sidebar-footer .text-muted {
    color: var(--pl-sidebar-muted) !important;
}

/* حالت جمع‌شده (فقط دسکتاپ) */
@media (min-width: 992px) {
    html.sidebar-collapsed .side-label,
    html.sidebar-collapsed .side-group-label,
    html.sidebar-collapsed .brand-text {
        display: none;
    }

    html.sidebar-collapsed .sidebar-header {
        flex-direction: column;
        justify-content: center;
        padding: 12px 8px;
        gap: 10px;
    }

    html.sidebar-collapsed .side-link {
        justify-content: center;
        padding: 11px 8px;
    }

    html.sidebar-collapsed .side-link i {
        width: auto;
    }

    html.sidebar-collapsed .sidebar-nav {
        padding: 12px 10px 20px;
    }
}

/* اسکرول‌بار سایدبار */
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }

/* ---------------- تاپ‌بار ---------------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin-right: var(--pl-sidebar-w);
    height: var(--pl-topbar-h);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--pl-border);
    transition: margin-right 0.25s ease;
}

.topbar-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
}

.topbar-icon-btn {
    background: transparent;
    border: none;
    color: var(--pl-text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.topbar-icon-btn:hover {
    background: rgba(179, 56, 62, 0.1);
    color: var(--pl-primary);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(179, 56, 62, 0.07);
    border: 1px solid transparent;
    border-radius: 50rem;
    padding: 0 14px;
    height: 40px;
    width: 320px;
    color: var(--pl-muted);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.topbar-search:focus-within {
    background: var(--pl-surface);
    border-color: var(--pl-primary);
    box-shadow: 0 0 0 0.2rem rgba(179, 56, 62, 0.15);
}

.topbar-search-input {
    border: none;
    outline: none;
    background: transparent;
    flex-grow: 1;
    min-width: 0;
    font-size: 0.875rem;
    color: var(--pl-text);
}

.topbar-search-input::placeholder {
    color: var(--pl-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

.btn-quick-add {
    background-image: var(--pl-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: box-shadow 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

.btn-quick-add:hover {
    filter: brightness(1.07);
    box-shadow: 0 6px 18px rgba(179, 56, 62, 0.4);
    transform: translateY(-1px);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--pl-text);
    padding: 4px 8px;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.topbar-user:hover {
    background: rgba(179, 56, 62, 0.08);
    color: var(--pl-text);
}

.topbar-user-initial {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pl-gradient);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.topbar-user-info {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar-user-role {
    font-size: 0.7rem;
    color: var(--pl-muted);
}

/* ---------------- محتوای اصلی ---------------- */
.main-content {
    min-height: calc(100vh - 80px);
}

.app-main,
.app-footer {
    margin-right: var(--pl-sidebar-w);
    transition: margin-right 0.25s ease;
}

.app-main {
    min-height: calc(100vh - var(--pl-topbar-h) - 60px);
}

/* بک‌دراپ موبایل */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* موبایل و تبلت */
@media (max-width: 991.98px) {
    .app-sidebar {
        width: 268px;
        transform: translateX(100%);
        box-shadow: none;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: -8px 0 32px rgba(15, 23, 42, 0.3);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }

    .app-main,
    .app-footer,
    .app-topbar {
        margin-right: 0;
    }

    .topbar-inner {
        padding: 0 12px;
    }

    .topbar-search {
        width: 220px;
    }
}

/* ==================================================
   انیمیشن‌ها
   ================================================== */
@media (prefers-reduced-motion: no-preference) {
    @keyframes pl-fade-in-up {
        from { opacity: 0; transform: translateY(12px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .app-main {
        animation: pl-fade-in-up 0.35s ease-out;
    }

    @keyframes pl-slide-in {
        from { opacity: 0; transform: translateX(14px); }
        to   { opacity: 1; transform: translateX(0); }
    }

    .sidebar-nav > * {
        animation: pl-slide-in 0.3s ease-out backwards;
    }

    .sidebar-nav > *:nth-child(1)  { animation-delay: 0.03s; }
    .sidebar-nav > *:nth-child(2)  { animation-delay: 0.06s; }
    .sidebar-nav > *:nth-child(3)  { animation-delay: 0.09s; }
    .sidebar-nav > *:nth-child(4)  { animation-delay: 0.12s; }
    .sidebar-nav > *:nth-child(5)  { animation-delay: 0.15s; }
    .sidebar-nav > *:nth-child(6)  { animation-delay: 0.18s; }
    .sidebar-nav > *:nth-child(7)  { animation-delay: 0.21s; }
    .sidebar-nav > *:nth-child(8)  { animation-delay: 0.24s; }
    .sidebar-nav > *:nth-child(9)  { animation-delay: 0.27s; }
    .sidebar-nav > *:nth-child(10) { animation-delay: 0.3s; }

    @keyframes pl-badge-pulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.45); }
        50%      { box-shadow: 0 0 0 5px rgba(220, 53, 69, 0); }
    }

    #notifBadge, #followupBadge {
        animation: pl-badge-pulse 2.2s ease-in-out infinite;
    }
}

/* ==================================================
   صفحه ورود
   ================================================== */
.login-page {
    background: var(--pl-bg);
}

.login-split {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.login-hero {
    flex: 1 1 52%;
    background: linear-gradient(135deg, #8f2b34 0%, #a2333c 55%, #d4574b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.login-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 420px;
}

.login-blob {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
    pointer-events: none;
}

.login-blob-1 { width: 320px; height: 320px; top: -80px; left: -100px; }
.login-blob-2 { width: 220px; height: 220px; bottom: -60px; right: -60px; background: rgba(255, 255, 255, 0.07); }
.login-blob-3 { width: 130px; height: 130px; bottom: 22%; left: 14%; background: rgba(255, 255, 255, 0.06); }

@media (prefers-reduced-motion: no-preference) {
    @keyframes pl-float {
        0%, 100% { transform: translateY(0) translateX(0); }
        50%      { transform: translateY(-22px) translateX(12px); }
    }

    .login-blob-1 { animation: pl-float 9s ease-in-out infinite; }
    .login-blob-2 { animation: pl-float 11s ease-in-out infinite reverse; }
    .login-blob-3 { animation: pl-float 7s ease-in-out infinite; }
}

.login-form-side {
    flex: 1 1 48%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: var(--pl-radius-lg);
    box-shadow: var(--pl-shadow-lg);
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--pl-gradient);
    color: white;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 10px 30px rgba(179, 56, 62, 0.45);
}

.login-hero-logo {
    width: 88px;
    height: 88px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    backdrop-filter: blur(6px);
}

@media (max-width: 767.98px) {
    .login-split {
        flex-direction: column;
    }

    .login-hero {
        flex: 0 0 auto;
        padding: 36px 24px;
        min-height: 220px;
    }

    .login-form-side {
        padding: 24px 16px 48px;
    }
}

/* ==================================================
   کامپوننت‌های عمومی
   ================================================== */
/* کارت‌ها */
.card {
    border: none;
    border-radius: var(--pl-radius-lg);
    box-shadow: var(--pl-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pl-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--pl-border);
    border-radius: var(--pl-radius-lg) var(--pl-radius-lg) 0 0 !important;
    padding: 0.9rem 1.25rem;
}

/* جدول‌ها */
.table thead th {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--pl-muted);
    border-bottom-width: 1px;
}

.table > :not(caption) > * > * {
    padding: 0.65rem 0.75rem;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-hover-bg: rgba(179, 56, 62, 0.05);
}

/* کارت‌های آماری */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pl-shadow);
}

.clickable-card {
    cursor: pointer;
    color: inherit;
}

.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--pl-shadow-lg);
    border-color: var(--pl-primary);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

/* کارت‌های پروژه */
.project-card {
    transition: all 0.2s ease;
    cursor: pointer;
    color: inherit;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pl-shadow);
    border-color: var(--pl-primary);
}

/* کارت‌های وظیفه (در داشبورد پروژه) */
.task-card {
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.task-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--pl-shadow-sm);
}

.task-column {
    min-height: 100px;
}

/* جدول وظایف */
.task-row {
    cursor: pointer;
}

.task-row:hover {
    background-color: rgba(179, 56, 62, 0.05);
}

.table-danger-soft {
    background-color: rgba(220, 53, 69, 0.05) !important;
}

.table-danger-soft:hover {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* پیوست‌ها و کامنت‌ها */
.comment-item .bg-light {
    border-radius: 12px;
}

/* آواتارها */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-md {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder,
.avatar-placeholder-sm,
.avatar-placeholder-lg {
    background: var(--pl-gradient);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.avatar-placeholder-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.avatar-placeholder-lg {
    width: 100px;
    height: 100px;
    font-size: 36px;
}

/* فرم‌ها */
.form-control,
.form-select {
    border-radius: 10px;
    border-color: var(--pl-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--pl-primary);
    box-shadow: 0 0 0 0.2rem rgba(179, 56, 62, 0.15);
}

.input-group-text {
    border-radius: 10px;
    border-color: var(--pl-border);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.4rem;
}

/* breadcrumb */
.breadcrumb {
    font-size: 0.875rem;
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

/* progress bar */
.progress {
    border-radius: 8px;
    background: #e7e8f4;
}

/* badge ها */
.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
    font-size: 0.78em;
}

/* alert ها */
.alert {
    border: none;
    border-radius: var(--pl-radius);
    box-shadow: var(--pl-shadow-sm);
}

/* تایمر شمارش معکوس */
.timer-card {
    transition: all 0.3s ease;
    border-width: 2px;
}

.timer-card.timer-normal {
    border-color: #198754;
    background: linear-gradient(135deg, #d1e7dd 0%, #ffffff 100%);
}

.timer-card.timer-warning {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff3cd 0%, #ffffff 100%);
    animation: pulse-warning 2s ease-in-out infinite;
}

.timer-card.timer-overdue {
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #ffffff 100%);
    animation: pulse-overdue 1.5s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
}

@keyframes pulse-overdue {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
}

.timer-numbers {
    font-feature-settings: "ss03";
}

.timer-block {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 8px 4px;
    min-width: 55px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.timer-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: inherit;
}

.timer-card.timer-normal .timer-value {
    color: #198754;
}

.timer-card.timer-warning .timer-value {
    color: #b37700;
}

.timer-card.timer-overdue .timer-value {
    color: #dc3545;
}

.timer-label {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 4px;
}

.timer-status {
    margin-top: 8px;
    font-size: 0.9rem;
}

/* بهبود تب‌ها */
.nav-tabs {
    border-bottom: 2px solid var(--pl-border);
}

.nav-tabs .nav-link {
    color: #6b7280;
    border: none;
    padding: 0.7rem 1.2rem;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    color: var(--pl-primary);
    border-bottom: 3px solid var(--pl-primary);
    background: transparent;
}

/* چک‌لیست */
.checklist-item:last-child {
    border-bottom: none !important;
}

.checklist-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* status change buttons */
.status-change-btn.active {
    color: white !important;
}

.status-change-btn.active.btn-outline-secondary {
    background-color: #6c757d !important;
}

.status-change-btn.active.btn-outline-primary {
    background-color: var(--pl-primary) !important;
}

.status-change-btn.active.btn-outline-success {
    background-color: #198754 !important;
}

/* تقویم شمسی */
.datepicker-plot-area {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}

/* بازپوشش تقویم جلالی با تم ایندیگو (استایل خود پیکر داخل JS تزریق می‌شود) */
.jdp-header {
    background: var(--pl-gradient) !important;
}

.jdp-day.jdp-selected,
.jdp-day.jdp-selected:hover,
.jdp-month-btn.jdp-selected,
.jdp-year-btn.jdp-selected {
    background: var(--pl-gradient) !important;
}

.jdp-day:hover:not(.jdp-selected) {
    background: #e0e7ff !important;
}

.jdp-month-btn:hover,
.jdp-year-btn:hover {
    background: #e0e7ff !important;
    border-color: var(--pl-primary) !important;
}

html.dark-mode .jdp-day:hover:not(.jdp-selected),
html.dark-mode .jdp-month-btn:hover,
html.dark-mode .jdp-year-btn:hover {
    background: #43302f !important;
}

/* پاسخگویی موبایل */
@media (max-width: 768px) {
    .stat-icon {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.3rem;
    }
}

/* اسکرول‌بار سفارشی */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
}

/* ================== دارک مود ================== */
html.dark-mode {
    --chelleh-bg: #181113;
    --pl-bg: #181113;
    --pl-surface: #231a1c;
    --pl-text: #e2e8f0;
    --pl-muted: #94a3b8;
    --pl-border: #43302f;
    --pl-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --pl-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    --pl-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --pl-sidebar-bg: linear-gradient(180deg, #241214 0%, #1a0d0f 100%);
    --bs-body-bg: #231a1c;
    --bs-body-color: #e2e8f0;
    --bs-border-color: #43302f;
    --bs-secondary-bg: #43302f;
    --bs-light: #231a1c;
    --bs-dark: #f1f5f9;
}

html.dark-mode body {
    background-color: var(--pl-bg);
    color: #e2e8f0;
}

html.dark-mode .app-topbar {
    background: rgba(36, 18, 20, 0.75);
    border-bottom-color: var(--pl-border);
}

html.dark-mode .topbar-icon-btn {
    color: #cbd5e1;
}

html.dark-mode .topbar-search {
    background: rgba(179, 56, 62, 0.12);
}

html.dark-mode .topbar-search:focus-within {
    background: var(--pl-surface);
}

html.dark-mode .topbar-search-input {
    color: #e2e8f0;
}

html.dark-mode .topbar-user {
    color: #e2e8f0;
}

html.dark-mode .card {
    background-color: var(--pl-surface);
    color: #e2e8f0;
}

html.dark-mode .card-header {
    background-color: var(--pl-surface) !important;
    border-color: var(--pl-border);
    color: #e2e8f0;
}

html.dark-mode .bg-white {
    background-color: var(--pl-surface) !important;
}

html.dark-mode .bg-light,
html.dark-mode .table-light {
    background-color: #43302f !important;
    color: #e2e8f0 !important;
}

html.dark-mode .text-muted {
    color: #94a3b8 !important;
}

html.dark-mode .text-dark {
    color: #e2e8f0 !important;
}

html.dark-mode .form-control,
html.dark-mode .form-select,
html.dark-mode .input-group-text {
    background-color: var(--pl-surface);
    border-color: #3d3f63;
    color: #e2e8f0;
}

html.dark-mode .form-control:focus,
html.dark-mode .form-select:focus {
    background-color: var(--pl-surface);
    color: #e2e8f0;
    border-color: var(--pl-primary);
}

html.dark-mode .form-control::placeholder {
    color: #64748b;
}

html.dark-mode .table {
    color: #e2e8f0;
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(179, 56, 62, 0.08);
}

html.dark-mode .table thead {
    background-color: #43302f;
}

html.dark-mode .list-group-item {
    background-color: var(--pl-surface);
    border-color: var(--pl-border);
    color: #e2e8f0;
}

html.dark-mode .list-group-item-action:hover {
    background-color: #43302f;
    color: #e2e8f0;
}

html.dark-mode .modal-content {
    background-color: var(--pl-surface);
    color: #e2e8f0;
    border: 1px solid var(--pl-border);
}

html.dark-mode .modal-header,
html.dark-mode .modal-footer {
    border-color: var(--pl-border);
}

html.dark-mode .dropdown-menu {
    background-color: var(--pl-surface);
    border-color: var(--pl-border);
    color: #e2e8f0;
}

html.dark-mode .dropdown-item {
    color: #e2e8f0;
}

html.dark-mode .dropdown-item:hover,
html.dark-mode .dropdown-item:focus {
    background-color: #43302f;
    color: #e2e8f0;
}

html.dark-mode .dropdown-divider {
    border-color: var(--pl-border);
}

html.dark-mode .breadcrumb-item.active {
    color: #e2e8f0;
}

html.dark-mode .border,
html.dark-mode .border-bottom,
html.dark-mode .border-top {
    border-color: var(--pl-border) !important;
}

html.dark-mode .alert-info {
    background-color: rgba(13, 202, 240, 0.15);
    color: #93c5fd;
    border-color: rgba(13, 202, 240, 0.3);
}

html.dark-mode .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #fcd34d;
}

html.dark-mode .alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: #fca5a5;
}

html.dark-mode .alert-success {
    background-color: rgba(25, 135, 84, 0.15);
    color: #86efac;
}

html.dark-mode ::-webkit-scrollbar-track {
    background: transparent;
}

html.dark-mode ::-webkit-scrollbar-thumb {
    background: #3d3f63;
}

html.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #b3383e;
}

html.dark-mode .timer-card.timer-normal {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.15) 0%, var(--pl-surface) 100%);
}

html.dark-mode .timer-card.timer-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, var(--pl-surface) 100%);
}

html.dark-mode .timer-card.timer-overdue {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, var(--pl-surface) 100%);
}

html.dark-mode .timer-block {
    background: rgba(255, 255, 255, 0.05);
}

html.dark-mode .task-row:hover {
    background-color: #43302f;
}

html.dark-mode .calendar-day {
    background: var(--pl-surface);
    color: #e2e8f0;
}

html.dark-mode .calendar-day.empty {
    background: var(--pl-bg);
}

html.dark-mode .calendar-day:hover {
    background: #43302f;
}

html.dark-mode .calendar-header-cell {
    background: #43302f;
    color: #e2e8f0;
}

html.dark-mode .calendar-day.today {
    background: rgba(179, 56, 62, 0.15);
}

html.dark-mode .login-form-side .card {
    background-color: var(--pl-surface);
}

/* ================== تگ‌ها ================== */
.task-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 500;
    background: #e0e7ff;
    color: #3730a3;
    margin: 2px 2px 2px 0;
    border: 1px solid #c7d2fe;
}

html.dark-mode .task-tag {
    background: rgba(179, 56, 62, 0.2);
    color: #c7d2fe;
    border-color: rgba(179, 56, 62, 0.3);
}

/* ================== آواتارهای رنگی هوشمند ================== */
.avatar-color-0 { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }
.avatar-color-1 { background: linear-gradient(135deg, #f97316, #ea580c) !important; }
.avatar-color-2 { background: linear-gradient(135deg, #f59e0b, #d97706) !important; }
.avatar-color-3 { background: linear-gradient(135deg, #10b981, #059669) !important; }
.avatar-color-4 { background: linear-gradient(135deg, #06b6d4, #0891b2) !important; }
.avatar-color-5 { background: linear-gradient(135deg, #3b82f6, #2563eb) !important; }
.avatar-color-6 { background: linear-gradient(135deg, #d4574b, #a2333c) !important; }
.avatar-color-7 { background: linear-gradient(135deg, #ec4899, #db2777) !important; }
.avatar-color-8 { background: linear-gradient(135deg, #14b8a6, #0d9488) !important; }
.avatar-color-9 { background: linear-gradient(135deg, #b3383e, #8f2b34) !important; }

/* ================== جستجوی جهانی ================== */
.search-result-item {
    color: inherit;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
    transition: background 0.1s;
}

.search-result-item.active,
.search-result-item:hover {
    background-color: rgba(179, 56, 62, 0.08);
}

html.dark-mode .search-result-item.active,
html.dark-mode .search-result-item:hover {
    background-color: #43302f;
}

html.dark-mode #globalSearchModal .modal-header .input-group-text,
html.dark-mode #globalSearchModal .modal-header input {
    background-color: transparent !important;
    color: #e2e8f0;
}

#globalSearchInput {
    font-size: 1.1rem;
}

#themeToggle {
    font-size: 1.05rem;
}

/* ================== Kanban Board ================== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(240px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    min-height: 500px;
}

@media (max-width: 1200px) {
    .kanban-board {
        grid-template-columns: repeat(5, 260px);
    }
}

.kanban-column {
    background: #eef0f9;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    border: 2px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.kanban-column.drag-over {
    border-color: var(--pl-primary);
    background: rgba(179, 56, 62, 0.06);
}

.kanban-column-header {
    padding: 12px 14px;
    border-bottom: 2px solid;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.kanban-column[data-status="todo"]              .kanban-column-header { color: #475569; border-color: #cbd5e1; background: #e2e8f0; }
.kanban-column[data-status="in_progress"]       .kanban-column-header { color: #4338ca; border-color: #c7d2fe; background: #e0e7ff; }
.kanban-column[data-status="pending_approval"]  .kanban-column-header { color: #b45309; border-color: #fcd34d; background: #fef3c7; }
.kanban-column[data-status="rejected"]          .kanban-column-header { color: #b91c1c; border-color: #fca5a5; background: #fee2e2; }
.kanban-column[data-status="done"]              .kanban-column-header { color: #15803d; border-color: #86efac; background: #dcfce7; }

html.dark-mode .kanban-column { background: var(--pl-surface); }
html.dark-mode .kanban-column[data-status="todo"]              .kanban-column-header { background: #43302f; color: #cbd5e1; border-color: #3d3f63; }
html.dark-mode .kanban-column[data-status="in_progress"]       .kanban-column-header { background: rgba(179, 56, 62, 0.2); color: #c7d2fe; border-color: rgba(179, 56, 62, 0.4); }
html.dark-mode .kanban-column[data-status="pending_approval"]  .kanban-column-header { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
html.dark-mode .kanban-column[data-status="rejected"]          .kanban-column-header { background: rgba(220, 38, 38, 0.2); color: #fca5a5; border-color: rgba(220, 38, 38, 0.4); }
html.dark-mode .kanban-column[data-status="done"]              .kanban-column-header { background: rgba(21, 128, 61, 0.2); color: #86efac; border-color: rgba(21, 128, 61, 0.4); }

.kanban-column-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kanban-cards {
    flex-grow: 1;
    padding: 8px;
    overflow-y: auto;
    max-height: calc(100vh - 320px);
    min-height: 200px;
}

.kanban-card {
    background: white;
    border: 1px solid var(--pl-border);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
}

html.dark-mode .kanban-card {
    background: #181113;
    border-color: #43302f;
    color: #e2e8f0;
}

.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(75, 27, 30, 0.12);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card-priority {
    width: 4px;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    border-radius: 8px 0 0 8px;
}

.kanban-card-priority.priority-low      { background: #94a3b8; }
.kanban-card-priority.priority-medium   { background: #06b6d4; }
.kanban-card-priority.priority-high     { background: #f59e0b; }
.kanban-card-priority.priority-urgent   { background: #dc2626; }

.kanban-card-title {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 6px;
    line-height: 1.4;
    padding-right: 6px;
}

.kanban-card-title a {
    color: inherit;
    text-decoration: none;
}

.kanban-card-title a:hover {
    color: var(--pl-primary);
}

.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.7rem;
    color: #6b7280;
}

html.dark-mode .kanban-card-meta { color: #94a3b8; }

.kanban-card-meta i { margin-left: 2px; }

.kanban-card-tags { margin-bottom: 6px; }
.kanban-card-tags .task-tag { font-size: 0.65rem; padding: 1px 6px; }

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f3f4f6;
}

html.dark-mode .kanban-card-footer { border-color: #43302f; }

.kanban-card-overdue {
    color: var(--bs-danger);
    font-weight: 600;
}

.kanban-empty-state {
    text-align: center;
    padding: 30px 10px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.kanban-cards::-webkit-scrollbar { width: 6px; }
.kanban-cards::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* دکمه toggle نما */
.view-toggle {
    background: #eef0f9;
    border-radius: 10px;
    padding: 3px;
    display: inline-flex;
    border: 1px solid var(--pl-border);
}

.view-toggle .btn {
    border: none !important;
    border-radius: 8px !important;
    padding: 4px 12px !important;
    font-size: 0.85rem !important;
    color: #64748b !important;
    background: transparent !important;
}

.view-toggle .btn.active {
    background: white !important;
    color: var(--pl-primary) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

html.dark-mode .view-toggle {
    background: #43302f;
    border-color: #3d3f63;
}

html.dark-mode .view-toggle .btn { color: #94a3b8 !important; }

html.dark-mode .view-toggle .btn.active {
    background: #181113 !important;
    color: #c7d2fe !important;
}

/* ================== گزارش‌ها ================== */
.report-card {
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
    border-width: 2px;
}

.report-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pl-shadow-lg);
}

html.dark-mode .report-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/* ستون‌های جدول در دارک مود */
html.dark-mode .table thead.table-light {
    background-color: #43302f !important;
}

html.dark-mode .table thead.table-light th {
    color: #e2e8f0 !important;
    border-color: #3d3f63 !important;
}

/* ================== داشبورد مدرن ================== */
.dashboard-page {
    --metric-blue-from: #b3383e;
    --metric-blue-to: #8f2b34;
    --metric-green-from: #10b981;
    --metric-green-to: #059669;
    --metric-orange-from: #f59e0b;
    --metric-orange-to: #d97706;
    --metric-red-from: #ef4444;
    --metric-red-to: #dc2626;
    --metric-gray-from: #94a3b8;
    --metric-gray-to: #64748b;
}

/* HERO header */
.dashboard-hero {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-radius: var(--pl-radius-lg);
    padding: 24px;
    border: 1px solid #e0e7ff;
}

html.dark-mode .dashboard-hero {
    background: linear-gradient(135deg, #231a1c 0%, #312e81 100%);
    border-color: #4338ca;
    color: #e2e8f0;
}

html.dark-mode .dashboard-hero h3 {
    color: #f1f5f9;
}

/* Section heading */
.section-heading {
    color: var(--bs-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    margin-top: 8px;
}

html.dark-mode .section-heading {
    color: #cbd5e1;
}

.section-heading i {
    margin-left: 4px;
}

/* ============== Metric Cards (کارت‌های آماری) ============== */
.metric-card {
    border-radius: 14px;
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    height: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(75, 27, 30, 0.2);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.metric-blue {
    background: linear-gradient(135deg, var(--metric-blue-from), var(--metric-blue-to));
}

.metric-green {
    background: linear-gradient(135deg, var(--metric-green-from), var(--metric-green-to));
}

.metric-orange {
    background: linear-gradient(135deg, var(--metric-orange-from), var(--metric-orange-to));
}

.metric-red {
    background: linear-gradient(135deg, var(--metric-red-from), var(--metric-red-to));
}

.metric-gray {
    background: linear-gradient(135deg, var(--metric-gray-from), var(--metric-gray-to));
}

.metric-pulse {
    animation: metric-pulse 2s ease-in-out infinite;
}

@keyframes metric-pulse {
    0%, 100% { box-shadow: 0 2px 4px rgba(0,0,0,0.06); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.25); }
}

.metric-icon {
    font-size: 1.6rem;
    opacity: 0.9;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.metric-label {
    font-size: 0.875rem;
    opacity: 0.92;
    position: relative;
    z-index: 1;
}

.metric-trend {
    margin-top: 10px;
    font-size: 0.75rem;
    opacity: 0.85;
    position: relative;
    z-index: 1;
}

.metric-trend-warning, .metric-trend-danger {
    background: rgba(0, 0, 0, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 500;
}

/* ============== Quick Stats ============== */
.quick-stat {
    background: white;
    border: 1px solid var(--pl-border);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s, transform 0.2s;
}

.quick-stat:hover {
    border-color: var(--pl-primary);
    transform: translateY(-1px);
}

html.dark-mode .quick-stat {
    background: var(--pl-surface);
    border-color: var(--pl-border);
}

.quick-stat i {
    font-size: 2rem;
}

.quick-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--bs-dark);
}

html.dark-mode .quick-stat-value {
    color: #f1f5f9;
}

/* ============== Performer Row ============== */
.performer-row {
    transition: background 0.15s;
}

.performer-row:hover {
    background: var(--bs-light);
}

html.dark-mode .performer-row:hover {
    background: #43302f;
}

.performer-row:last-child {
    border-bottom: none !important;
}

.performer-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.performer-row:nth-child(1) .performer-rank { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.performer-row:nth-child(2) .performer-rank { background: linear-gradient(135deg, #cbd5e1, #94a3b8); }
.performer-row:nth-child(3) .performer-rank { background: linear-gradient(135deg, #fb923c, #ea580c); }
.performer-row:nth-child(n+4) .performer-rank { background: linear-gradient(135deg, #94a3b8, #64748b); }

.min-w-0 { min-width: 0; }

/* ============== Project Mini Card ============== */
.project-mini-card {
    background: white;
    border: 1px solid var(--pl-border);
    border-radius: 12px;
    padding: 16px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    height: 100%;
    color: inherit;
}

.project-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pl-shadow);
    border-color: var(--pl-primary);
}

html.dark-mode .project-mini-card {
    background: var(--pl-surface);
    border-color: var(--pl-border);
    color: #e2e8f0;
}

/* ============== Today/Tomorrow Cards ============== */
.today-card .list-group-item {
    border-left: 0;
    border-right: 0;
}

.today-card .list-group-item:first-child {
    border-top: 0;
}

/* ============== Attention Card ============== */
.attention-card .list-group-item {
    border-left: 0;
    border-right: 0;
    transition: background 0.15s;
}

.attention-card .list-group-item:first-child {
    border-top: 0;
}

.attention-card .list-group-item:last-child {
    border-bottom: 0;
}

/* ============== Empty State ============== */
.empty-state-card {
    border: 2px dashed var(--pl-border);
    background: transparent;
    box-shadow: none;
}

html.dark-mode .empty-state-card {
    border-color: #43302f;
}

/* ============== Progress Card ============== */
.progress-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
}

html.dark-mode .progress-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

/* ============== Sub-task list ============== */
.subtask-row {
    transition: background 0.15s;
}

.subtask-row:hover {
    background: var(--bs-light);
}

html.dark-mode .subtask-row:hover {
    background: #43302f;
}

/* Mobile fixes */
@media (max-width: 768px) {
    .dashboard-hero {
        padding: 16px;
    }

    .metric-card {
        padding: 14px;
    }

    .metric-value {
        font-size: 1.8rem;
    }

    .metric-icon {
        font-size: 1.3rem;
    }
}

/* ================== @Mention در کامنت‌ها ================== */
.mention-wrapper {
    position: relative;
}

.mention-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    left: 0;
    margin-bottom: 4px;
    background: white;
    border: 1px solid var(--pl-border);
    border-radius: 10px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
}

html.dark-mode .mention-dropdown {
    background: var(--pl-surface);
    border-color: var(--pl-border);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f1f5f9;
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-item.active,
.mention-item:hover {
    background: #eef2ff;
}

html.dark-mode .mention-item {
    border-bottom-color: #43302f;
}

html.dark-mode .mention-item.active,
html.dark-mode .mention-item:hover {
    background: #43302f;
}

.mention-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.mention-avatar-fallback {
    background: var(--pl-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.mention-info {
    flex-grow: 1;
    min-width: 0;
}

.mention-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-empty {
    padding: 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* لینک mention در کامنت‌ها */
.mention-link {
    background: rgba(179, 56, 62, 0.12);
    color: #8f2b34 !important;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none !important;
    transition: background 0.15s;
}

.mention-link:hover {
    background: rgba(179, 56, 62, 0.22);
    color: #4338ca !important;
}

html.dark-mode .mention-link {
    background: rgba(179, 56, 62, 0.2);
    color: #c7d2fe !important;
}

html.dark-mode .mention-link:hover {
    background: rgba(179, 56, 62, 0.3);
    color: #e0e7ff !important;
}

.comment-text {
    line-height: 1.7;
    word-wrap: break-word;
}

/* ================== Gantt Chart ================== */
.gantt-container {
    display: flex;
    direction: rtl;
    overflow-x: auto;
    border-radius: 8px;
    background: white;
}

html.dark-mode .gantt-container {
    background: var(--pl-surface);
}

.gantt-task-list {
    flex: 0 0 280px;
    border-left: 2px solid var(--pl-border);
    background: #f8fafc;
    position: sticky;
    right: 0;
    z-index: 5;
}

html.dark-mode .gantt-task-list {
    background: #181113;
    border-left-color: #43302f;
}

.gantt-task-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--pl-border);
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
}

html.dark-mode .gantt-task-header {
    background: var(--pl-surface);
    border-bottom-color: #43302f;
    color: #cbd5e1;
}

.gantt-task-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 48px;
    padding: 6px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: inherit;
    transition: background 0.15s;
}

.gantt-task-row:hover {
    background: #eef2ff;
}

html.dark-mode .gantt-task-row {
    border-bottom-color: #231a1c;
    color: #e2e8f0;
}

html.dark-mode .gantt-task-row:hover {
    background: #43302f;
}

.gantt-task-title {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
}

.gantt-task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 2px;
}

.gantt-timeline-wrapper {
    flex: 1;
    min-width: 600px;
    overflow-x: auto;
}

.gantt-timeline {
    position: relative;
    min-width: 100%;
}

.gantt-axis {
    height: 56px;
    position: relative;
    border-bottom: 2px solid var(--pl-border);
    background: #fff;
}

html.dark-mode .gantt-axis {
    background: var(--pl-surface);
    border-bottom-color: #43302f;
}

.gantt-axis-label {
    position: absolute;
    top: 50%;
    transform: translate(50%, -50%);
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    padding: 2px 6px;
    background: rgba(255,255,255,0.95);
    border-radius: 4px;
}

html.dark-mode .gantt-axis-label {
    color: #94a3b8;
    background: rgba(26,27,49,0.95);
}

.gantt-grid {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.gantt-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #f1f5f9;
}

html.dark-mode .gantt-grid-line {
    background: #43302f;
}

.gantt-today-line {
    position: absolute;
    top: 56px;
    bottom: 0;
    width: 2px;
    background: #dc2626;
    z-index: 4;
    pointer-events: none;
}

.gantt-today-marker {
    position: absolute;
    top: -22px;
    transform: translateX(50%);
    background: #dc2626;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.gantt-bars {
    position: relative;
}

.gantt-bar-row {
    height: 48px;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

html.dark-mode .gantt-bar-row {
    border-bottom-color: #231a1c;
}

.gantt-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.75rem;
    color: white;
    text-decoration: none !important;
    font-weight: 500;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.gantt-bar:hover {
    transform: translateY(-50%) scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.18);
    z-index: 3;
    color: white;
}

.gantt-bar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-bar-todo {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

.gantt-bar-in_progress {
    background: linear-gradient(135deg, #b3383e, #8f2b34);
}

.gantt-bar-pending_approval {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.gantt-bar-rejected {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.gantt-bar-done {
    background: linear-gradient(135deg, #10b981, #059669);
}

.gantt-bar-overdue:not(.gantt-bar-done) {
    background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
    animation: gantt-overdue-pulse 2s ease-in-out infinite;
}

.gantt-bar-blocked::before {
    content: '⛔';
    margin-left: 4px;
}

@keyframes gantt-overdue-pulse {
    0%, 100% { box-shadow: 0 1px 3px rgba(220,38,38,0.3); }
    50% { box-shadow: 0 0 0 4px rgba(220,38,38,0.2); }
}

.gantt-legend-bar {
    display: inline-block;
    width: 18px;
    height: 8px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* موبایل */
@media (max-width: 768px) {
    .gantt-task-list {
        flex: 0 0 180px;
    }
    .gantt-task-title {
        font-size: 0.8rem;
    }
    .gantt-bar {
        font-size: 0.7rem;
        padding: 0 6px;
    }
}

/* ================== PWA Offline Indicator ================== */
body.offline::before {
    content: '⚠️ در حالت آفلاین - برخی ویژگی‌ها محدود هستند';
    display: block;
    background: #f59e0b;
    color: white;
    text-align: center;
    padding: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1100;
}

/* PWA Install Banner در دارک مود */
html.dark-mode #pwaInstallBanner {
    background: #231a1c !important;
    border-color: #43302f !important;
    color: #e2e8f0;
}

html.dark-mode #pwaInstallBanner div[style*="color:#0f172a"] {
    color: #f1f5f9 !important;
}

html.dark-mode #pwaInstallBanner div[style*="color:#64748b"] {
    color: #94a3b8 !important;
}

html.dark-mode #pwaDismissBtn {
    background: transparent !important;
    color: #cbd5e1 !important;
    border-color: #43302f !important;
}

/* تنظیمات مخصوص وقتی در حالت standalone (نصب شده) اجرا می‌شه */
@media all and (display-mode: standalone) {
    /* در حالت PWA standalone، بانر نصب رو مخفی کن */
    #pwaInstallBanner {
        display: none !important;
    }
    /* safe area برای موبایل با notch */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ================== دکمه بازگشت ================== */
#backButton {
    transition: transform 0.15s, background 0.15s;
    font-weight: 500;
}

#backButton:hover {
    transform: translateX(2px);
}

#backButton:active {
    transform: translateX(0);
}

/* ==================================================
   لایه پالیش بصری چله — انیمیشن‌های ظریف و سراسری
   ================================================== */

/* ورود نرم محتوای صفحه */
@keyframes chelleh-rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.app-main > .container-fluid,
.app-main > .container {
    animation: chelleh-rise-in 0.35s ease-out both;
}

/* ورود پلکانی ردیف‌های داشبورد */
.dashboard-page > * {
    animation: chelleh-rise-in 0.4s ease-out both;
}
.dashboard-page > *:nth-child(2) { animation-delay: 0.05s; }
.dashboard-page > *:nth-child(3) { animation-delay: 0.10s; }
.dashboard-page > *:nth-child(4) { animation-delay: 0.15s; }
.dashboard-page > *:nth-child(5) { animation-delay: 0.20s; }
.dashboard-page > *:nth-child(6) { animation-delay: 0.25s; }
.dashboard-page > *:nth-child(n+7) { animation-delay: 0.3s; }

/* کارت‌ها: بلندشدن ظریف هنگام hover */
.card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
    box-shadow: var(--pl-shadow);
}

a > .quick-stat,
.quick-stat {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a:hover > .quick-stat {
    transform: translateY(-2px);
    box-shadow: var(--pl-shadow);
}

/* آیتم‌های لیست: سُرش ظریف به داخل */
.list-group-item-action {
    transition: background-color 0.15s ease, padding-right 0.18s ease;
}

.list-group-item-action:hover {
    padding-right: 1.35rem;
}

/* دکمه‌ها: فشردگی لمسی */
.btn {
    transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active {
    transform: scale(0.97);
}

/* بج‌های شمارنده: ضربان ملایم برای جلب توجه */
@keyframes chelleh-badge-pop {
    0%   { transform: scale(0.6); opacity: 0; }
    70%  { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}

.side-link .badge,
.topbar-icon-btn .badge {
    animation: chelleh-badge-pop 0.45s ease-out both;
}

/* جدول‌ها: هایلایت نرم ردیف */
.table-hover > tbody > tr {
    transition: background-color 0.15s ease;
}

/* دراپ‌داون: بازشدن نرم */
.dropdown-menu {
    animation: chelleh-rise-in 0.18s ease-out;
}

/* نوار پیشرفت: پرشدن نرم */
.progress-bar {
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* پیام‌های سیستم: ورود از بالا */
.alert {
    animation: chelleh-rise-in 0.3s ease-out both;
}

/* احترام به کاربرانی که حرکت کمتر می‌خواهند */
@media (prefers-reduced-motion: reduce) {
    .app-main > .container-fluid,
    .app-main > .container,
    .dashboard-page > *,
    .dropdown-menu,
    .alert,
    .side-link .badge,
    .topbar-icon-btn .badge {
        animation: none !important;
    }
    .card, .btn, .quick-stat, .list-group-item-action, .progress-bar {
        transition: none !important;
    }
}
