/*
  =========================================================
  FILE: tools/feasibility/feasibility.css
  PURPOSE:
  تنسيق أداة "مساعد دراسة الجدوى الأولية" داخل ConsuTrain.

  DESIGN DIRECTION:
  - الاعتماد على أسطح فاتحة ومنسجمة مع هوية الموقع.
  - تجنب الخلفيات الزرقاء الداكنة داخل الأداة.
  - إبقاء وظائف الأداة كما هي دون تغيير منطق JavaScript.
  =========================================================
*/

.tool-feasibility{
  --ft-bg: #f8fafc;
  --ft-surface: #ffffff;
  --ft-surface-soft: #fffaf0;
  --ft-surface-muted: #f1f5f9;
  --ft-text: #172033;
  --ft-muted: #64748b;
  --ft-border: rgba(15, 23, 42, .10);
  --ft-border-strong: rgba(212, 166, 58, .38);
  --ft-gold: #d4a63a;
  --ft-gold-dark: #9a6b13;
  --ft-green: #18835a;
  --ft-red: #c2414b;
  --ft-shadow: 0 18px 45px rgba(15, 23, 42, .08);
  --ft-radius: 20px;

  box-sizing: border-box;
  max-width: 1240px;
  margin: 28px auto 56px;
  padding: 0 18px 22px;
  color: var(--ft-text);
  font-family: inherit;
  scroll-behavior: smooth;
}

.tool-feasibility *,
.tool-feasibility *::before,
.tool-feasibility *::after{
  box-sizing: border-box;
}

.tool-page-hero{
  background:
    radial-gradient(circle at 15% 15%, rgba(212, 166, 58, .16), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 54%, #fff7e6 100%);
  border-bottom: 1px solid rgba(15, 23, 42, .06);
}

.tool-page-hero .eyebrow{
  color: var(--ft-gold-dark, #9a6b13);
}

.tool-hero-actions{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.btn-primary-soft,
.btn-outline-soft{
  text-decoration: none;
}

.btn-primary-soft{
  background: linear-gradient(135deg, #d4a63a, #f0c66a);
  color: #1f2937;
  border-color: rgba(212, 166, 58, .55);
  font-weight: 800;
}

.btn-outline-soft{
  background: #ffffff;
  color: #334155;
  border-color: rgba(15, 23, 42, .14);
}

.topbar{
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--ft-shadow);
  position: sticky;
  top: 12px;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.brand h2{
  margin: 0 0 6px;
  font-size: clamp(18px, 2vw, 23px);
  color: var(--ft-text);
}

.tool-note{
  margin: 0;
  color: var(--ft-muted);
  font-size: 13px;
  line-height: 1.7;
}

.sub{
  margin: 0;
  color: var(--ft-muted);
  font-size: 13px;
}

.saved{
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ft-gold-dark);
  font-weight: 700;
}

.actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.btn{
  border: 1px solid rgba(212, 166, 58, .42);
  background: #fff9eb;
  color: #2f2a1d;
  padding: 10px 13px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(212, 166, 58, .08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.btn:hover{
  transform: translateY(-1px);
  border-color: rgba(212, 166, 58, .75);
  box-shadow: 0 12px 26px rgba(212, 166, 58, .14);
}

.btn-soft{
  border-color: rgba(15, 23, 42, .12);
  background: #ffffff;
  color: #334155;
  box-shadow: none;
}

.btn-soft:hover{
  border-color: rgba(212, 166, 58, .45);
  background: #fffaf0;
}

.btn-danger{
  border-color: rgba(194, 65, 75, .22);
  background: #fff1f2;
  color: var(--ft-red);
  box-shadow: none;
}

.btn-danger:hover{
  border-color: rgba(194, 65, 75, .42);
  background: #ffe4e6;
}

.tool-free-note{
  margin: 14px 0;
  padding: 13px 16px;
  border: 1px solid rgba(212, 166, 58, .28);
  border-radius: 18px;
  background: #fffaf0;
  color: #4b5563;
  line-height: 1.8;
  font-size: 14px;
}

.tool-service-note{
  margin: 18px 0 0;
  padding: 18px;
  border: 1px solid rgba(212, 166, 58, .30);
  border-radius: var(--ft-radius);
  background: linear-gradient(135deg, #fffaf0, #ffffff);
  box-shadow: var(--ft-shadow);
}

.tool-service-note p{
  margin: 0 0 14px;
  color: var(--ft-muted);
  line-height: 1.9;
}

.tool-tally-embed{
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--ft-border);
  border-radius: 18px;
  background: #ffffff;
}

.tool-tally-embed h2{
  margin: 0 0 10px;
  color: var(--ft-text);
  font-size: clamp(18px, 2vw, 24px);
}

.tool-tally-embed iframe{
  display: block;
  width: 100%;
  min-height: 680px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
}

.layout{
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  padding-top: 2px;
}

.sidebar{
  border: 1px solid var(--ft-border);
  background: var(--ft-surface);
  border-radius: var(--ft-radius);
  padding: 14px;
  height: calc(100vh - 130px);
  position: sticky;
  top: 104px;
  overflow: auto;
  box-shadow: var(--ft-shadow);
}

.sidebar-head{
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #ffffff 78%, rgba(255,255,255,.86));
  padding-bottom: 10px;
  z-index: 2;
}

.sidebar h2{
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--ft-text);
}

#searchBox{
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--ft-border);
  background: #f8fafc;
  color: var(--ft-text);
  outline: none;
}

#searchBox:focus{
  border-color: var(--ft-border-strong);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(212, 166, 58, .11);
}

.sidebar ul{
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.sidebar li a{
  display: block;
  padding: 10px 11px;
  border-radius: 14px;
  color: #475569;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.5;
}

.sidebar li a:hover,
.sidebar li a.active{
  border-color: rgba(212, 166, 58, .34);
  background: #fffaf0;
  color: #1f2937;
}

.content{min-width: 0;}

.card{
  border: 1px solid var(--ft-border);
  background: var(--ft-surface);
  border-radius: var(--ft-radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--ft-shadow);
}

.card-head{margin-bottom: 12px;}
.card h2{margin: 0 0 8px; font-size: 18px; color: var(--ft-text);}
.hint{margin: 0; color: var(--ft-muted); font-size: 13px; line-height: 1.8;}

.q{
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 16px;
  background: #ffffff;
  margin-bottom: 10px;
}

.q:last-child{margin-bottom: 0;}

.q-head{
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.badge{
  min-width: 36px;
  height: 36px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff4d8;
  border: 1px solid rgba(212, 166, 58, .34);
  font-weight: 900;
  color: var(--ft-gold-dark);
}

.q-title{
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #1f2937;
}

.q-meta{
  color: var(--ft-muted);
  font-size: 12px;
  margin-top: 2px;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select{
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--ft-border);
  background: #f8fafc;
  color: var(--ft-text);
  outline: none;
  font-family: inherit;
}

textarea{min-height: 92px; resize: vertical;}

input:focus,
textarea:focus,
select:focus{
  border-color: var(--ft-border-strong);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(212, 166, 58, .11);
}

.row{display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap;}
.sep{border: none; border-top: 1px solid var(--ft-border); margin: 18px 0;}
.table-wrap{overflow: auto;}

.grid{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
  overflow: hidden;
}

.grid th,
.grid td{
  padding: 11px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  text-align: right;
  vertical-align: middle;
}

.grid thead th{
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  border-bottom: 1px solid rgba(212, 166, 58, .24);
  color: #334155;
}

.grid tbody tr:hover td{background: #fffaf0;}
.grid tfoot td{background: #f8fafc; font-weight: 800;}
.right{text-align: right;}

.icon-btn{
  padding: 7px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .12);
  background: #ffffff;
  cursor: pointer;
  color: #334155;
}

.icon-btn:hover{
  border-color: rgba(212, 166, 58, .38);
  background: #fffaf0;
}

.summary-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 8px;
}

.sum-box{
  border: 1px solid rgba(15, 23, 42, .08);
  background: #f8fafc;
  border-radius: 18px;
  padding: 14px;
}

.sum-box .k{color: var(--ft-muted); font-size: 12px;}
.sum-box .v{font-size: 20px; font-weight: 900; margin-top: 7px; color: #1f2937;}

.sum-box.highlight{
  border-color: rgba(212, 166, 58, .34);
  background: linear-gradient(135deg, #fffaf0, #ffffff);
}

.sum-box.highlight .v{color: var(--ft-gold-dark);}

/* Accordion sections */
.fsec{
  border-radius: var(--ft-radius);
  overflow: hidden;
  background: #ffffff;
}

.fsec__sum{
  cursor: pointer;
  padding: 14px 16px;
  background: linear-gradient(135deg, #ffffff, #fffaf0);
  border: 1px solid rgba(212, 166, 58, .22);
  border-radius: 18px;
  list-style: none;
}

.fsec__sum::-webkit-details-marker{display: none;}

.fsec__sum::after{
  content: "+";
  font-weight: 900;
  opacity: .75;
  float: left;
  color: var(--ft-gold-dark);
}

.fsec[open] > .fsec__sum::after{content: "–";}

.fsec[open] > .fsec__sum{
  background: linear-gradient(135deg, #fff8e7, #ffffff);
  border-color: rgba(212, 166, 58, .38);
}

.fsec__body{
  padding: 14px 0 0;
  background: transparent;
}

/* ===== Report for print/export ===== */
.report{
  display: none;
  background: #fff;
  color: #000;
  padding: 28px;
  border-radius: 12px;
}

.report-header{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 2px solid #eee;
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.report-title h1{margin: 0 0 8px; font-size: 22px;}
.report-meta{display: flex; gap: 14px; flex-wrap: wrap; color: #333; font-size: 13px;}

.report-badge{
  border: 1px solid #eee;
  background: #fafafa;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: #444;
  min-width: 150px;
  text-align: center;
}

.report-section{margin: 16px 0; page-break-inside: avoid;}

.report-section h2{
  margin: 0 0 10px;
  font-size: 16px;
  background: #f6f7f9;
  border: 1px solid #e9eaee;
  padding: 10px 12px;
  border-radius: 12px;
}

.report-item{
  padding: 10px 12px;
  border: 1px solid #e9eaee;
  border-radius: 12px;
  margin-bottom: 10px;
}

.report-item .qtxt{font-weight: 800; margin-bottom: 6px;}
.report-item .aval{white-space: pre-wrap; line-height: 1.6;}

.report-table{
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.report-table th,
.report-table td{
  border: 1px solid #e5e7eb;
  padding: 8px;
  text-align: right;
}

.report-table thead th{background: #f3f4f6;}
.report-kpi{display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 10px;}
.report-kpi .box{border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; background: #fafafa;}
.report-kpi .k{font-size: 12px; color: #555;}
.report-kpi .v{font-size: 16px; font-weight: 900; margin-top: 6px;}
.report-footer{margin-top: 20px; border-top: 1px solid #eee; padding-top: 10px; color: #555; font-size: 12px;}

@media print{
  .tool-page-hero,
  #header-placeholder,
  #breadcrumbs-placeholder,
  #footer-placeholder,
  .topbar,
  .tool-free-note,
  .sidebar,
  .content > *:not(#report){
    display: none !important;
  }

  .tool-feasibility{display: none !important;}
  #report{display: block !important;}
}

@media (max-width: 980px){
  .tool-feasibility{margin-top: 18px; padding-inline: 14px;}
  .topbar{position: relative; top: auto; flex-direction: column;}
  .actions{justify-content: flex-start;}
  .layout{grid-template-columns: 1fr;}
  .sidebar{position: relative; top: auto; height: auto;}
  .summary-grid{grid-template-columns: 1fr 1fr;}
}

@media (max-width: 560px){
  .tool-feasibility{padding-inline: 10px;}
  .topbar{padding: 14px;}
  .actions .btn{width: 100%;}
  .tool-hero-actions .btn{width: 100%; text-align: center;}
  .summary-grid{grid-template-columns: 1fr;}
}
