/* ===================================================================
   Capora Chart Maker — style.css
   این فایل مکمل articles/style.css است (رنگ‌ها، هدر، باکس‌های tip/example
   از همان‌جا به ارث می‌رسند). اینجا فقط اجزای اختصاصی نمودارساز است.
   =================================================================== */

.cm-grid{ display:grid; grid-template-columns:1fr; gap:18px; margin:26px 0 50px; }
@media (min-width:920px){
  .cm-grid{ grid-template-columns:380px 1fr; align-items:start; }
}

.cm-panel{
  background:var(--surface); border:1px solid var(--border); border-radius:20px;
  padding:18px; box-shadow:var(--shadow); margin-bottom:16px;
}
.cm-panel h2{ font-size:12.5px; font-weight:800; color:var(--secondary); margin-bottom:12px; display:flex; align-items:center; gap:6px; }

.panel-head-row{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.panel-head-row h2{ margin-bottom:0; }
.reset-link{
  border:none; background:transparent; color:var(--secondary); font-family:inherit; cursor:pointer;
  font-size:10.5px; font-weight:700; padding:4px 2px; white-space:nowrap;
}
.reset-link:hover{ color:var(--red); }
.autosave-note{ font-size:10px; color:var(--secondary); margin:10px 0 0; text-align:center; opacity:.85; }

/* قالب‌های آماده */
.tpl-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.tpl-card{
  border:none; cursor:pointer; border-radius:14px; padding:12px 6px; text-align:center;
  color:#fff; font-family:inherit; font-size:10.5px; font-weight:800; line-height:1.5;
  transition:transform .12s;
}
.tpl-card:hover{ transform:translateY(-2px); }
.tpl-card .ic{ font-size:19px; display:block; margin-bottom:4px; }
.tpl-card.t1{ background:linear-gradient(135deg,#6366f1,#4338ca); }
.tpl-card.t2{ background:linear-gradient(135deg,#f59e0b,#d97706); }
.tpl-card.t3{ background:linear-gradient(135deg,#10b981,#059669); }

/* نوع نمودار */
.ctype-row{ display:flex; flex-wrap:wrap; gap:6px; }
.ctype-btn{
  border:1px solid var(--border); background:var(--card); color:var(--text);
  font-family:inherit; font-size:11px; font-weight:700; padding:7px 12px; border-radius:20px; cursor:pointer;
}
.ctype-btn.active{ background:var(--primary); border-color:var(--primary); color:#fff; }

/* تب‌های سه‌گانه ورودی داده */
.input-tabs{ display:flex; gap:6px; margin-bottom:14px; background:var(--card); padding:4px; border-radius:14px; }
.itab{
  flex:1; border:none; background:transparent; cursor:pointer; font-family:inherit;
  font-size:11.5px; font-weight:800; padding:9px 6px; border-radius:11px; color:var(--secondary);
}
.itab.active{ background:var(--surface); color:var(--primary); box-shadow:0 2px 8px rgba(30,41,59,.08); }
.itab-panel{ display:none; }
.itab-panel.active{ display:block; }

.field{ margin-bottom:10px; }
.field label{ display:block; font-size:11px; font-weight:700; color:var(--secondary); margin-bottom:5px; }
.field input[type=text]{
  width:100%; border:1px solid var(--border); background:var(--card); border-radius:10px;
  padding:9px 11px; font-family:inherit; font-size:12.5px; color:var(--text);
}

/* چند سری داده (مقایسه تا ۴ سری) */
.series-count-row{ display:flex; gap:6px; margin-bottom:8px; }
.series-count-btn{
  flex:1; border:1px solid var(--border); background:var(--card); color:var(--text);
  font-family:inherit; font-size:11px; font-weight:800; padding:8px 4px; border-radius:10px; cursor:pointer;
}
.series-count-btn.active{ background:var(--primary); border-color:var(--primary); color:#fff; }
.series-hint{ font-size:10.5px; color:var(--secondary); margin:0 0 10px; line-height:1.8; }
.series-editor-row{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.series-editor-row:empty{ display:none; }
.series-chip{
  display:flex; align-items:center; gap:6px; background:var(--card); border:1px solid var(--border);
  border-radius:12px; padding:5px 8px; flex:1; min-width:110px;
}
.series-chip input[type=color]{ width:22px; height:22px; padding:0; border:none; border-radius:50%; cursor:pointer; flex-shrink:0; }
.series-chip input[type=text]{
  border:none; background:transparent; font-family:inherit; font-size:11.5px; font-weight:700;
  color:var(--text); width:100%; padding:2px; min-width:0;
}
.series-type-btn{
  border:1px solid var(--border); background:var(--surface); border-radius:8px; cursor:pointer;
  font-size:13px; padding:3px 6px; flex-shrink:0; line-height:1;
}

/* پاپ‌آپ انتخاب نوع نمودار هر سری */
.capora-modal-overlay{
  position:fixed; inset:0; background:rgba(20,18,40,.55); display:flex; align-items:center; justify-content:center;
  z-index:999; padding:20px;
}
.capora-modal{
  background:var(--surface); border-radius:16px; padding:18px; max-width:340px; width:100%;
  box-shadow:0 20px 50px rgba(0,0,0,.3);
}
.capora-modal h4{ font-size:13.5px; font-weight:800; margin-bottom:8px; color:var(--text); }
.capora-modal p{ font-size:11px; color:var(--secondary); line-height:1.8; margin-bottom:14px; }
.capora-modal-options{ display:flex; flex-direction:column; gap:8px; margin-bottom:12px; }
.modal-opt-btn{
  text-align:right; border:1.5px solid var(--border); background:var(--card); color:var(--text);
  font-family:inherit; font-size:12px; font-weight:700; padding:10px 12px; border-radius:10px; cursor:pointer;
}
.modal-opt-btn.active{ border-color:var(--primary); background:var(--primary); color:#fff; }
.capora-modal-close{
  width:100%; border:none; background:var(--card); color:var(--secondary); font-family:inherit;
  font-size:11.5px; font-weight:700; padding:9px; border-radius:10px; cursor:pointer;
}

.table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
table.data-editor{ width:100%; border-collapse:collapse; margin-bottom:8px; }
table.data-editor th{ font-size:10px; color:var(--secondary); font-weight:700; text-align:right; padding:4px; white-space:nowrap; }
table.data-editor td{ padding:3px; }
table.data-editor input[type=text]{
  width:100%; min-width:64px; border:1px solid var(--border); background:var(--card); border-radius:8px;
  padding:6px 8px; font-family:inherit; font-size:12px; color:var(--text);
}
table.data-editor input[type=color]{ width:100%; padding:0; height:30px; border-radius:8px; cursor:pointer; border:1px solid var(--border); }
.row-actions{ display:flex; gap:8px; margin-top:6px; }
.mini-btn{
  border:1px dashed var(--border); background:transparent; color:var(--secondary); font-family:inherit;
  font-size:11px; font-weight:700; padding:7px 10px; border-radius:10px; cursor:pointer; flex:1;
}
.mini-btn:hover{ border-color:var(--primary); color:var(--primary); }
.mini-btn.danger:hover{ border-color:var(--red); color:var(--red); }

/* آپلود اکسل */
.excel-drop{
  border:2px dashed var(--border); border-radius:16px; padding:26px 16px; text-align:center;
  cursor:pointer; transition:.15s; margin-bottom:10px;
}
.excel-drop:hover, .excel-drop.dragover{ border-color:var(--primary); background:rgba(99,102,241,.05); }
.excel-drop .xi{ font-size:28px; display:block; margin-bottom:8px; }
.excel-drop b{ font-size:13px; display:block; margin-bottom:3px; }
.excel-drop span{ font-size:11px; color:var(--secondary); }
.excel-sample-link{
  display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:800;
  color:var(--primary); text-decoration:none; margin-top:8px; cursor:pointer; background:none; border:none; font-family:inherit;
}
.excel-status{ font-size:11.5px; font-weight:700; margin-top:8px; padding:8px 12px; border-radius:10px; display:none; }
.excel-status.ok{ display:block; background:rgba(16,185,129,.1); color:var(--green); }
.excel-status.err{ display:block; background:rgba(239,68,68,.1); color:var(--red); }

/* ورود سریع متنی */
.quick-textarea{
  width:100%; min-height:150px; border:1px solid var(--border); background:var(--card);
  border-radius:12px; padding:12px; font-family:inherit; font-size:12.5px; color:var(--text);
  resize:vertical; direction:rtl; line-height:1.9; margin-bottom:10px;
}
.quick-hint{ font-size:11px; color:var(--secondary); margin-bottom:8px; line-height:1.8; }

/* تم رنگی و کلیدها */
.palette-row{ display:flex; gap:8px; flex-wrap:wrap; }
.swatch{ width:30px; height:30px; border-radius:50%; cursor:pointer; border:2px solid transparent; }
.swatch.active{ border-color:var(--text); }

.toggles{ display:flex; flex-direction:column; gap:8px; margin-top:14px; }
.toggle-row{ display:flex; align-items:center; justify-content:space-between; font-size:12px; font-weight:700; }
.switch{ position:relative; width:38px; height:22px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.switch .slider{ position:absolute; inset:0; background:var(--border); border-radius:20px; cursor:pointer; transition:.15s; }
.switch .slider::before{ content:''; position:absolute; width:16px; height:16px; right:3px; top:3px; background:#fff; border-radius:50%; transition:.15s; }
.switch input:checked + .slider{ background:var(--primary); }
.switch input:checked + .slider::before{ transform:translateX(-16px); }

/* پیش‌نمایش و خروجی */
.preview-card{
  background:var(--surface); border:1px solid var(--border); border-radius:22px;
  padding:20px; box-shadow:var(--shadow); min-height:460px; display:flex; flex-direction:column;
}
.preview-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.preview-head h3{ font-size:15px; font-weight:900; }
.export-row{ display:flex; gap:8px; flex-wrap:wrap; }
.export-btn{
  border:none; cursor:pointer; font-family:inherit; font-size:11.5px; font-weight:800;
  padding:10px 18px; border-radius:12px; display:inline-flex; align-items:center; gap:6px; transition:transform .12s;
}
.export-btn:hover{ transform:translateY(-2px); }
.export-btn:disabled{ opacity:.6; cursor:wait; transform:none; }
.export-btn.png{ background:var(--primary); color:#fff; }
.export-btn.pdf{ background:var(--surface); color:var(--primary); border:1.5px solid var(--primary); }
.export-btn.copy{ background:var(--surface); color:var(--secondary); border:1.5px solid var(--border); }
.export-btn.share{ background:var(--surface); color:var(--secondary); border:1.5px solid var(--border); }

.export-btn.compare{
  background:var(--surface); color:var(--purple, #7c3aed); border:1.5px solid var(--purple, #7c3aed);
}
.export-btn.compare:disabled{ opacity:.45; cursor:not-allowed; }
.before-status{
  font-size:11px; color:var(--secondary); background:var(--card); border:1px solid var(--border);
  border-radius:10px; padding:8px 10px; margin-bottom:10px; line-height:1.8;
}
.before-status.filled{ color:var(--primary); border-color:var(--primary); font-weight:700; }

.more-tpl-select{
  width:100%; margin-top:8px; border:1px dashed var(--border); background:var(--card); color:var(--secondary);
  font-family:inherit; font-size:11.5px; font-weight:700; padding:9px 10px; border-radius:10px; cursor:pointer;
}

.chart-host{ position:relative; flex:1; min-height:360px; }
.chart-host canvas{ width:100% !important; height:100% !important; }
.export-note{ text-align:center; font-size:10.5px; color:var(--secondary); margin-top:10px; }

@media (max-width:600px){
  .tpl-grid{ grid-template-columns:repeat(3,1fr); }
  .preview-card{ min-height:380px; }
}
