/* ================================================================
   منصة إدارة الجودة والتميز بشركة الحمراء لخدمات حجاج الداخل — Report Form Shared Styles
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --g-dark:  #3d0a0a;
  --g-mid:   #1a4a35;
  --g-main:  #2f6f4f;
  --gold:    #c89d3d;
  --gold-lt: #f0c560;
  --cream:   #f8f5ec;
  --cream2:  #f1ecd9;
  --card:    #fffdf8;
  --text:    #1f2a1f;
  --muted:   #6d745f;
  --border:  #e4dcc9;
  --radius:  14px;
  --shadow:  0 4px 20px rgba(13,36,24,.08);
}

body {
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--cream2); }
::-webkit-scrollbar-thumb { background: var(--g-main); border-radius: 8px; }

/* ── TOPNAV ──────────────────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; right: 0; left: 0; z-index: 900;
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 28px;
  background: var(--g-dark);
  box-shadow: 0 2px 24px rgba(0,0,0,.35);
  animation: fadeDown .4s ease both;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.topnav-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
}

.topnav-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-lt);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(.55); }
}

.topnav-name {
  font-weight: 800; font-size: .95rem;
}

.topnav-back {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.82);
  border-radius: 50px; padding: 6px 18px;
  font-family: inherit; font-size: .82rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: all .22s;
  display: flex; align-items: center; gap: 5px;
}

.topnav-back:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ── CONTAINER ───────────────────────────────────────────────── */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 82px 16px 130px;
}

/* ── HEADER ──────────────────────────────────────────────────── */
.header {
  background: linear-gradient(125deg, var(--g-dark), var(--g-mid));
  border-radius: 18px;
  padding: 26px 24px 20px;
  margin-bottom: 18px;
  position: relative; overflow: hidden;
  box-shadow: 0 12px 40px rgba(13,36,24,.22);
  animation: fadeUp .5s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.header::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(200,157,61,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,157,61,.055) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0%   { background-position: 0 0; }
  100% { background-position: 44px 44px; }
}

.header-inner { position: relative; z-index: 1; }

.page-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(200,157,61,.15);
  border: 1px solid rgba(200,157,61,.3);
  color: var(--gold-lt);
  padding: 4px 16px; border-radius: 50px;
  font-size: .75rem; font-weight: 700;
  margin-bottom: 10px;
}

.page-title {
  color: #fff;
  font-size: clamp(1.05rem, 2.5vw, 1.5rem);
  font-weight: 800; line-height: 1.35;
  margin-bottom: 5px;
}

.page-sub {
  color: rgba(255,255,255,.58);
  font-size: .88rem;
}

/* Metadata row (from sessionStorage) */
.meta-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 12px;
}

.meta-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.78);
  padding: 4px 12px; border-radius: 50px;
  font-size: .78rem; font-weight: 600;
}

.meta-chip svg { width: 12px; height: 12px; opacity: .7; }

/* Summary bar */
.summary {
  margin-top: 12px; padding: 10px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: .88rem; color: rgba(255,255,255,.72);
}

.summary b { color: var(--gold-lt); }
.summary .score-pass { color:#a7f3c7; font-weight:700; }
.summary .score-pass b { color:#d1fbe1; }
.summary .score-fail { color:#ffb3b3; font-weight:700; }
.summary .score-fail b { color:#ffd6d6; }
.summary .score-ok  { color:#a7f3c7; }
.summary .score-ok  b { color:#d1fbe1; }
.summary .score-bad { color:#ffb3b3; }
.summary .score-bad b { color:#ffd6d6; }

/* Action buttons */
.header-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #a07c28);
  color: #fff; border: none;
  border-radius: 10px; padding: 8px 18px;
  font-family: inherit; font-size: .85rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(200,157,61,.3);
  transition: all .22s;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(200,157,61,.45); }

.btn-light {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.82);
  border-radius: 10px; padding: 8px 18px;
  font-family: inherit; font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: all .22s;
}

.btn-light:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ── GROUP / PATH CARD (quality/compliance) ──────────────────── */
.group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeUp .45s ease both;
}

.group-head {
  padding: 14px 18px;
  background: linear-gradient(95deg, var(--g-dark) 0%, #1e5a40 100%);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; cursor: pointer;
  user-select: none;
}

.group-head-left { flex: 1; min-width: 0; }

.group-path-name {
  color: #fff;
  font-size: .96rem; font-weight: 700;
  margin-bottom: 4px;
}

.group-axis-name {
  color: rgba(255,255,255,.5);
  font-size: .78rem;
}

.group-chips {
  display: flex; align-items: center; gap: 7px;
  flex-shrink: 0; flex-wrap: wrap;
  margin-top: 2px;
}

.weight-chip {
  background: rgba(200,157,61,.18);
  border: 1px solid rgba(200,157,61,.35);
  color: var(--gold-lt);
  padding: 3px 10px; border-radius: 50px;
  font-size: .73rem; font-weight: 700;
}

.count-chip {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.65);
  padding: 3px 10px; border-radius: 50px;
  font-size: .73rem; font-weight: 600;
}

.group-chevron {
  color: rgba(255,255,255,.4);
  font-size: 1rem; line-height: 1;
  transition: transform .25s;
  flex-shrink: 0; margin-top: 3px;
}

.group.collapsed .group-chevron { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }

/* ── CRITERION CARD ──────────────────────────────────────────── */
.criterion {
  border-top: 1px solid var(--border);
}

.criterion-header {
  display: flex; align-items: center;
  padding: 13px 18px 11px;
  gap: 10px; cursor: pointer;
  transition: background .18s;
}

.criterion-header:hover { background: rgba(47,111,79,.04); }

.crit-num {
  min-width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g-main), var(--g-mid));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800;
  flex-shrink: 0;
}

.crit-title {
  flex: 1;
  font-size: .93rem; font-weight: 700;
  color: var(--g-dark); line-height: 1.4;
}

.crit-badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.type-badge {
  padding: 2px 9px; border-radius: 50px;
  font-size: .7rem; font-weight: 700;
}

.type-badge--basic      { background: #EFF6FF; color: #2563EB; }
.type-badge--deduction  { background: #FEF2F2; color: #DC2626; }
.type-badge--incentive  { background: #FFFBEB; color: #B45309; }

.crit-weight {
  background: var(--cream2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 8px; border-radius: 50px;
  font-size: .7rem; font-weight: 600;
}

.crit-chevron {
  color: var(--muted);
  font-size: .85rem;
  transition: transform .22s;
  flex-shrink: 0;
}

.criterion.open .crit-chevron { transform: rotate(90deg); }

/* Details panel */
.criterion-details {
  max-height: 0; overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  padding: 0 18px;
  background: var(--cream);
  border-bottom: 1px solid transparent;
}

.criterion.open .criterion-details {
  max-height: 400px;
  padding: 14px 18px;
  border-bottom-color: var(--border);
}

.detail-line {
  font-size: .85rem; color: var(--muted);
  margin-bottom: 7px; line-height: 1.6;
}

.detail-line strong { color: var(--text); font-weight: 700; }

/* Rating & notes section */
.criterion-body {
  padding: 12px 18px 16px;
}

.rating-label {
  font-size: .8rem; font-weight: 700; color: var(--muted);
  margin-bottom: 8px;
}

/* ── STAR RATING ─────────────────────────────────────────────── */
.stars {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
}

.stag {
  font-size: 1.55rem; line-height: 1;
  background: none; border: none;
  cursor: pointer;
  color: #d4c9b0;
  padding: 2px 3px;
  transition: color .15s, transform .15s;
}

.stag:hover        { color: var(--gold-lt); transform: scale(1.15); }
.stag.active       { color: var(--gold); }
.stag.active:hover { color: var(--gold-lt); transform: scale(1.15); }

.stag-labels {
  display: flex; justify-content: space-between;
  font-size: .7rem; color: var(--muted);
  margin-bottom: 10px;
  padding: 0 2px;
}

/* ── NOTES TEXTAREA ──────────────────────────────────────────── */
.notes-wrap { position: relative; }

.notes-label {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  margin-bottom: 5px; display: block;
}

textarea {
  width: 100%; min-height: 68px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit; font-size: .88rem;
  background: #fff;
  color: var(--text);
  resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}

textarea:focus {
  outline: 0;
  border-color: var(--g-main);
  box-shadow: 0 0 0 3px rgba(47,111,79,.1);
}

/* Image upload placeholder */
.img-placeholder {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  background: var(--cream2);
  border: 1.5px dashed var(--border);
  border-radius: 9px;
  padding: 7px 14px;
  font-family: inherit; font-size: .8rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  transition: all .2s;
}

.img-placeholder:hover {
  border-color: var(--g-main);
  color: var(--g-main);
  background: #f0f9f4;
}

/* ── EVIDENCE UPLOAD ─────────────────────────── */
.evid-wrap { margin-top: 10px; }
.evid-note {
  font-size: .72rem; color: var(--muted);
  background: #fff8e0; border: 1px dashed #e0cd7a;
  border-radius: 8px; padding: 6px 10px; margin-bottom: 6px;
}
.evid-controls { display: flex; align-items: center; gap: 8px; }
.evid-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.evid-cell {
  position: relative;
  width: 72px; height: 72px;
  border: 1.5px solid var(--border); border-radius: 8px;
  overflow: hidden; background: #fff;
  box-shadow: 0 2px 6px rgba(13,36,24,.08);
}
.evid-cell img { width: 100%; height: 100%; object-fit: cover; }
.evid-remove {
  position: absolute; top: 2px; inset-inline-end: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(180,30,30,.92); color: #fff;
  border: 0; cursor: pointer; font-weight: 900; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.evid-remove:hover { background: #a81b1b; }

/* ── TOPNAV LOGOS ────────────────────────────── */
.topnav-logos {
  display: flex; align-items: center; gap: 10px;
}
.topnav-logos img {
  height: 36px; width: auto; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.topnav-logos .tl-ministry { height: 48px; }
.topnav-logos .tl-sep {
  width: 1px; height: 30px;
  background: linear-gradient(180deg,transparent,rgba(255,255,255,.35),transparent);
}

/* ── CAMP ITEM CARD ──────────────────────────────────────────── */
.item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow .22s, transform .22s;
  animation: fadeUp .4s ease both;
}

.item-card:hover {
  box-shadow: 0 8px 30px rgba(13,36,24,.12);
  transform: translateY(-1px);
}

.item-card-header {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
}

.item-num {
  min-width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g-main), var(--g-mid));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
  flex-shrink: 0; margin-top: 1px;
}

.item-text {
  flex: 1; font-size: .9rem; line-height: 1.65;
  color: var(--text);
}

.item-text.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-ogient: vertical;
  overflow: hidden;
}

.read-more {
  background: none; border: none;
  color: var(--g-main); font-family: inherit;
  font-size: .78rem; font-weight: 700;
  cursor: pointer; padding: 0; margin-top: 3px;
  display: block;
}

.read-more:hover { text-decoration: underline; }

.item-rating-section { margin-bottom: 12px; }

/* ── BOTTOM BAR ──────────────────────────────────────────────── */
.bottom-bar {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 800;
  background: var(--g-dark);
  border-top: 1px solid rgba(200,157,61,.18);
  padding: 11px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  box-shadow: 0 -4px 24px rgba(0,0,0,.28);
  animation: slideUp .4s ease both;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.bottom-progress {
  flex: 1; min-width: 200px;
}

.bottom-progress-label {
  color: rgba(255,255,255,.6);
  font-size: .8rem; margin-bottom: 5px;
  display: flex; justify-content: space-between;
}

.bottom-progress-label span { color: var(--gold-lt); font-weight: 700; }

.bottom-progress-bar {
  height: 5px; border-radius: 99px;
  background: rgba(255,255,255,.1);
  overflow: hidden;
}

.bottom-progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--g-main), var(--gold));
  transition: width .5s ease;
}

.bottom-actions { display: flex; gap: 8px; align-items: center; }

.btn-save {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.8);
  border-radius: 50px; padding: 9px 22px;
  font-family: inherit; font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: all .22s;
}

.btn-save:hover { background: rgba(255,255,255,.15); color: #fff; }

.btn-save-go {
  background: linear-gradient(135deg, var(--gold), #a07c28);
  color: #fff; border: none;
  border-radius: 50px; padding: 10px 28px;
  font-family: inherit; font-weight: 800; font-size: .92rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(200,157,61,.4);
  transition: all .25s;
  white-space: nowrap;
}

.btn-save-go:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(200,157,61,.55); }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast-rack {
  position: fixed; bottom: 78px; left: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.gf-toast {
  background: #1f2a1f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: .86rem; font-family: inherit;
  display: flex; align-items: center; gap: 8px;
  min-width: 190px; max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  animation: toastIn .28s ease;
  pointer-events: all;
}

.gf-toast--ok   { border-right: 3px solid #c9a84c; }
.gf-toast--err  { border-right: 3px solid #f87171; }
.gf-toast--info { border-right: 3px solid var(--gold); }

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

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav        { padding: 10px 16px; }
  .container     { padding: 72px 12px 120px; }
  .header        { padding: 20px 16px 16px; border-radius: 14px; }
  .criterion-header { padding: 11px 14px 9px; }
  .criterion-body   { padding: 10px 14px 14px; }
  .criterion-details { }
  .criterion.open .criterion-details { padding: 12px 14px; }
  .group-head    { padding: 12px 14px; }
  .item-card     { padding: 14px 14px 12px; }
  .bottom-bar    { padding: 10px 16px; }
}

@media (max-width: 480px) {
  .topnav        { padding: 9px 12px; }
  .topnav-name   { font-size: .82rem; }
  .topnav-back   { padding: 5px 12px; font-size: .75rem; }
  .container     { padding: 64px 10px 110px; }
  .header        { padding: 14px 12px 12px; border-radius: 12px; }
  .page-badge    { font-size: .72rem; }
  .page-title    { font-size: .96rem; }
  .page-sub      { font-size: .8rem; }
  .crit-title    { font-size: .86rem; }
  .stag          { font-size: 1.35rem; }
  .item-card     { padding: 12px 12px 10px; }
  .item-text     { font-size: .84rem; }
  .btn-save-go   { padding: 9px 18px; font-size: .85rem; }
  .bottom-progress { display: none; }
  .crit-weight, .count-chip { display: none; }
}

@media (max-width: 360px) {
  .topnav-back   { display: none; }
  .container     { padding: 58px 8px 100px; }
  .stag          { font-size: 1.2rem; }
  .btn-save-go   { padding: 8px 14px; font-size: .8rem; }
}
