/* پویا CRM — استایل RTL فارسی */

:root {
    --sidebar-width: 264px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --sidebar-bg: #0f172a;
    --sidebar-bg-2: #16233c;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, 'B Nazanin', sans-serif;
    background-color: var(--bg);
    /* الگوی زنبوری بسیار کم‌رنگ — هم‌رنگ پنل سمت راست ولی محو */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%230f172a' fill-opacity='0.045' fill-rule='nonzero'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-size: 42px 73px;
    margin: 0;
    direction: rtl;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background:
        radial-gradient(900px 420px at 50% -60px, rgba(59, 130, 246, 0.10), transparent 70%),
        var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: -6px 0 20px rgba(15, 23, 42, 0.10);
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1.1rem;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.sidebar-brand i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.sidebar-nav { padding: 0.75rem 0.75rem 1rem; flex: 1; overflow-y: auto; }

.nav-module { margin-bottom: 0.75rem; }

.nav-module-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: #94a3b8;
    font-weight: 600;
}

.nav-module-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.35), transparent);
}

.sidebar-nav .nav-link {
    color: #cbd5e1;
    padding: 0.55rem 0.85rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 0.55rem;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-nav .nav-link i {
    font-size: 0.95rem;
    width: 1.1rem;
    text-align: center;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.sidebar-nav .nav-link:hover { background: rgba(148, 163, 184, 0.14); color: #fff; }

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(0, 0, 0, 0.18);
}

.main-content {
    margin-right: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem;
    min-height: 100vh;
}

.main-content.full-width {
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* داشبورد */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.4rem 1.25rem;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.09);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.85rem;
}

/* دکمه بزرگ ثبت تماس */
.btn-call-big {
    background: linear-gradient(135deg, var(--success), #15803d);
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: transform 0.15s;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-call-big:hover {
    transform: translateY(-2px);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}

.btn-call-big i { font-size: 2rem; }

/* کارت‌ها — حاشیه‌ی کم‌رنگ هم‌رنگ پنل سمت راست + سایه‌ی ملایم و مدرن */
.card-panel,
.stat-card,
.form-section,
.login-card,
.modal-content {
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.055);
}

.card-panel {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
}

.card-panel h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

/* یادداشت روزانه — آیتم هر روز در گزارش مدیر */
.daily-note-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: 3px solid var(--primary);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
}

/* پیگیری‌های امروز */
.followup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border-right: 3px solid var(--primary);
}

.followup-item.overdue {
    border-right-color: var(--danger);
    background: #fef2f2;
}

.followup-item a { text-decoration: none; color: inherit; }

/* وضعیت تسک روزانه — در حال انتظار / انجام‌شده */
.task-status-row.task-pending {
    border-right-color: var(--warning, #f59e0b);
    background: #fffbeb;
}

.task-status-row.task-done {
    border-right-color: var(--success, #16a34a);
    background: #f0fdf4;
}

/* تسک انجام‌نشده‌ای که مهلتش گذشته — منقضی */
.task-status-row.task-expired {
    border-right-color: var(--danger, #dc2626);
    background: #fef2f2;
}

.task-status-row.task-expired.task-other-day {
    border-right-color: #f87171;
    background: #fef2f2;
}

/* تمایز رنگی تسک‌های امروز از سایر روزهای هفته */
.task-status-row.task-today {
    border-right-width: 5px;
    border-right-color: var(--primary, #2563eb);
    background: #eff6ff;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}

.task-status-row.task-today.task-pending {
    border-right-color: var(--primary, #2563eb);
    background: #eff6ff;
}

.task-status-row.task-today.task-done {
    border-right-color: var(--success, #16a34a);
    background: #f0fdf4;
}

.task-status-row.task-other-day {
    opacity: 0.92;
    background: #f8fafc;
    border-right-color: #94a3b8;
}

.task-status-row.task-other-day.task-pending {
    background: #f8fafc;
    border-right-color: #cbd5e1;
}

.task-status-row.task-other-day.task-done {
    background: #f1f5f9;
    border-right-color: #94a3b8;
}

/* هدر روز هفته در نمایش هفتگی */
.task-day-header {
    padding: 0.4rem 0.6rem;
    margin: 0.5rem 0 0.25rem;
    border-radius: 6px;
    background: #f1f5f9;
    border-right: 3px solid #cbd5e1;
}

.task-day-header.task-day-today {
    background: #dbeafe;
    border-right-color: var(--primary, #2563eb);
}

.task-day-header.task-day-other {
    background: #f1f5f9;
    border-right-color: #cbd5e1;
}

/* کارت روز در صفحه «تسک‌های من» */
.card-panel.task-day-today {
    border: 1px solid #bfdbfe;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.card-panel.task-day-other {
    border: 1px solid #e2e8f0;
}

/* فرم */
.form-section {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* لاگین */
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand h2 { font-weight: 700; color: var(--primary); }

/* جدول — مدرن و سبک */
.table {
    --bs-table-bg: transparent;
    color: #1e293b;
}

.table thead th {
    font-weight: 600;
    font-size: 0.78rem;
    color: #64748b;
    letter-spacing: 0.02em;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.6rem 0.75rem;
    border-color: #f1f5f9;
    vertical-align: middle;
}

.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: #f8fafc; }

/* ردیف‌های کارت‌مانند در جدول‌های بزرگ */
.table.table-cards thead { display: none; }
.table.table-cards tbody td {
    border: none;
    border-bottom: 1px solid #f1f5f9;
}

.badge-hot { background: #fef3c7; color: #92400e; }
.badge-overdue { background: #fee2e2; color: #991b1b; }

/* خطای Blazor */
#blazor-error-ui {
    background: #fee2e2;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid red; }
.validation-message { color: red; font-size: 0.85rem; }

.alert-floating {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    min-width: 300px;
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-right: 0; }
}

/* انتخابگر تاریخ شمسی */
.jalali-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.jalali-picker-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1050;
    width: 260px;
    background: #fff;
}

.jalali-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.jalali-picker-dow {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    padding: 0.25rem 0;
}

.jalali-picker-day {
    text-align: center;
    padding: 0.25rem 0;
}
