/* بیس کلی فریمورک - اعمال قطعی فونت وزیرمتن روی همه المان‌ها */
* { box-sizing: border-box; font-family: 'Vazirmatn', system-ui, sans-serif !important; margin: 0; padding: 0; }
body { background-color: #f1f5f9; color: #1e293b; overflow: hidden; }

/* --- هدر اصلی: یکپارچه، تک‌ردیفی، وسط‌چین و کاملا ریسپانسیو --- */
.master-compact-header { 
    display: flex; 
    flex-wrap: wrap; 
    align-items: center; 
    justify-content: center; /* همه عناصر به مرکز هدایت می‌شوند */
    background-color: #0f172a; 
    color: white; 
    padding: 6px 10px; 
    width: 100%; 
    gap: 12px;
}
.header-right-zone, .header-left-zone { 
    display: flex; 
    align-items: center; 
    flex-wrap: wrap; 
    justify-content: center; /* در صورت شکسته شدن خط، وسط‌چین می‌مانند */
    gap: 8px; 
}
.app-mini-title { font-size: 14px; font-weight: bold; color: #38bdf8; white-space: nowrap; }

/* KPIها */
.kpi-container { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.kpi-box { background: #1e293b; border: 1px solid #334155; padding: 3px 6px; border-radius: 6px; font-size: 10px; cursor: pointer; transition: all 0.15s; user-select: none; color: #cbd5e1; }
.kpi-box:hover { background: #334155; color: #fff; border-color: #475569; }

.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar-divider { width: 1px; height: 18px; background: #334155; margin: 0 2px; }

/* گوشه‌های نرم برای اینپوت‌ها */
.input-sm { padding: 4px 8px; font-size: 11px; border: 1px solid #cbd5e1; border-radius: 6px; outline: none; height: 26px; }
.input-sm:focus { border-color: #38bdf8; }
.btn-sm { font-size: 11px !important; padding: 4px 10px !important; border-radius: 6px; cursor: pointer; border: none; font-weight: bold; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
.ltr-input { direction: ltr; text-align: left; }

/* دکمه آپلود اکسل */
.excel-label-btn { background-color: #22c55e !important; color: white !important; cursor: pointer; user-select: none; }
.excel-label-btn:hover { background-color: #16a34a !important; }
.excel-label-btn input[type="file"] { display: none !important; }
.file-status-text { font-size: 11px; color: #94a3b8; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* دکمه‌ها */
.btn-execute-excel { background-color: #10b981; color: white; }
.btn-execute-excel:hover { background-color: #059669; }
.btn-primary { background-color: #3b82f6; color: white; }
.btn-primary:hover { background-color: #2563eb; }
.btn-info { background-color: #0ea5e9; color: white; }
.btn-info:hover { background-color: #0284c7; }
.btn-warning { background-color: #f59e0b; color: white; }
.btn-warning:hover { background-color: #d97706; }
.btn-secondary { background: #64748b; color: white; border-radius: 6px; border: none; cursor: pointer; padding: 4px 10px; font-size: 11px; }

/* لی‌آوت اصلی */
.main-layout { max-width: 100% !important; padding: 4px 8px; height: calc(100vh - 48px); display: flex; flex-direction: column; }
.content-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.table-container { flex: 1; overflow: auto; background: white; border-radius: 8px; border: 1px solid #e2e8f0; }

/* آکاردئون‌های دوقلو */
.accordions-wrapper { display: flex; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.manual-paste-accordion { flex: 1; min-width: 300px; background: white; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 11px; }
.manual-paste-accordion summary { padding: 4px 10px; cursor: pointer; font-weight: bold; background: #f8fafc; border-radius: 6px; }
.paste-grid { display: flex; gap: 8px; padding: 8px; }
.paste-item { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.paste-item textarea { height: 35px; padding: 4px; border: 1px solid #cbd5e1; border-radius: 6px; resize: none; font-size: 11px; outline: none; }
.paste-item textarea:focus { border-color: #3b82f6; }

.toolbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 8px; flex-wrap: wrap; gap: 10px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; }

/* --- جدول --- */
table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: right; table-layout: auto; }
th, td { padding: 5px 6px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; width: 1%; }

/* --- Alternate Coloring (ردیف‌های یکی‌درمیان سفید و خاکستری) --- */
tbody tr:nth-child(even) { background-color: #f8fafc; }
tbody tr:hover { background-color: #f1f5f9; }

tr.main-header { background: #f8fafc; position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 #cbd5e1; }
tr.filter-header { background: #ffffff; position: sticky; top: 27px; z-index: 10; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }

/* --- افزایش اندازه ستون‌های آی‌دی --- */
.col-site-id { width: 100px !important; min-width: 100px !important; max-width: 100px !important; text-align: center; }
.col-product-id { width: 115px !important; min-width: 115px !important; max-width: 115px !important; text-align: center; }
.col-site-id input, .col-product-id input { text-align: center; font-size: 11px !important; }

/* ستون نام محصول */
th.product-heading-th { width: 100% !important; min-width: 300px !important; }
td.product-heading-cell { white-space: normal !important; word-wrap: break-word; font-size: 11px; line-height: 1.6; color: #0f172a; font-weight: 500; }

/* ستون یادداشت */
th.col-notes, td.col-notes { min-width: 180px !important; width: 180px !important; }

/* نرم کردن کادرهای فیلتر و حل مشکل فلش کشویی */
.filter-cell-custom { display: flex; align-items: center; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; padding-left: 1px; height: 26px; overflow: hidden; }
.filter-cell-custom input { border: none; outline: none; padding: 2px 4px; font-size: 11px; width: 100%; background: transparent; }
.rounded-select { border: 1px solid #cbd5e1; border-radius: 6px; padding: 2px 4px 2px 18px; font-size: 11px; outline: none; height: 26px; width: 100%; cursor: pointer; }
select.inline-edit { padding-left: 18px; cursor: pointer; }

.mode-toggle-btn { background: #e2e8f0; border: none; font-size: 10px; padding: 2px 5px; border-radius: 4px; cursor: pointer; white-space: nowrap; height: 20px; margin-left: 2px; }
.mode-toggle-btn.exclude { background: #fef2f2; color: #ef4444; }

/* دراپ‌داون چک‌باکس */
.multi-select-container { position: relative; width: 100%; text-align: right; }
.multi-select-header { display: flex; align-items: center; justify-content: space-between; background: #fff; cursor: pointer; user-select: none; }
.multi-select-dropdown { display: none; position: absolute; top: 100%; right: 0; width: 140px; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 100; max-height: 170px; overflow-y: auto; padding: 4px; }
.multi-select-dropdown label { display: flex; align-items: center; gap: 6px; padding: 5px; cursor: pointer; font-size: 11px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.multi-select-dropdown label:hover { background: #e2e8f0; border-radius: 4px; }
.multi-select-dropdown.show { display: block; }

/* وضعیت‌ها */
.status-badge { padding: 3px 6px; border-radius: 4px; font-size: 10px; font-weight: bold; display: inline-block; }
.st-زوده { background: #fef3c7; color: #d97706; }
.st-پیگیری { background: #e0f2fe; color: #0284c7; }
.st-انتشار { background: #dcfce7; color: #15803d; }
.st-حذف { background: #ffeeeb; color: #ea580c; }
.st-ضعیف { background: #fef2f2; color: #dc2626; }
.st-تعریف-شخص { background: #f3e8ff; color: #7e22ce; }
.alarm-row, .alarm-row:hover { background-color: #fff7ed !important; }

/* ویرایش خطی */
.inline-edit { width: 100%; padding: 4px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 11px; outline: none; background: #f8fafc; height: 26px; }
.inline-edit:focus { border-color: #3b82f6; background: #fff; }

/* صفحه‌بندی */
.pagination { display: flex; justify-content: center; gap: 4px; padding: 6px 0; background: #f1f5f9; }
.page-btn { background: white; border: 1px solid #cbd5e1; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.page-btn.active { background: #0f172a; color: white; border-color: #0f172a; }