/* Oral Health PS — UI */
:root{
  /* Royal blue colour for primary actions */
  --brand:#4169e1;
  --muted:#6b7280;
  --bg:#f8fafc;
  --card:#ffffff;
  --line:#e5e7eb;
}

.ohc-ps{direction:rtl;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto;background:var(--bg);padding:8px}
.ohc-instruction{margin-top:4px;margin-bottom:8px;color:var(--muted);font-size:0.85rem}
.ohc-card{
  background:var(--card);
  border-radius:22px;
  padding:20px;
  border:1px solid var(--line);
  box-shadow:0 8px 20px rgba(0,0,0,0.06);
}
.ohc-card h2{margin:0 0 14px 0;font-weight:800}
.ohc-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}

/* Horizontal row for grouped fields (province, city, school, class) */
.ohc-row{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}
.ohc-row .ohc-field{
  flex:1 1 220px;
  margin-bottom:0;
}
/* Labels: lighter weight and more spacing */
.ohc-field label{display:block;font-weight:100;margin-bottom:10px;color:#111827;font-size:0.92rem}
.ohc-field{margin-bottom:14px}
/* Inputs: increased border radius and removed visible border colour */
.ohc-field input,
.ohc-field select{
  width:100%;
  padding:14px 16px;
  border:1px solid transparent;
  border-radius:10px !important;
  background:#f9fafb;
  font-size:0.95rem;
  transition:box-shadow 0.2s, border-color 0.2s;
}
.ohc-field input:focus,
.ohc-field select:focus{
  outline:none;
  border-color:var(--brand);
  box-shadow:0 0 0 2px rgba(65,105,225,0.2);
}

/* Province and city selects have a black border */
#ohc_province,
#ohc_city{
  border-color:#000 !important;
}

/* Apply a similar dark border to the grade select so it stands out like province/city */
#ohc_grade{
  border-color:#000 !important;
}
.ohc-actions{grid-column:1/-1;display:flex;gap:12px;align-items:center;margin-top:16px}
/* Primary button: full width, modern look */
.ohc-btn-primary{
  display:block;
  width:100%;
  background:var(--brand);
  color:#fff;
  border:none;
  padding:14px 24px;
  border-radius:14px;
  font-weight:600;
  cursor:pointer;
  font-size:1rem;
  text-align:center;
  transition:background 0.2s ease, transform 0.1s ease;
}
/* Hover and active states for the primary button: darken slightly on hover */
.ohc-btn-primary:hover{background:#3659c7;}
.ohc-btn-primary:active{transform:scale(0.98);}
.ohc-alert{background:#fff3cd;border:1px solid #ffe08a;padding:12px;border-radius:12px}
.mt-16{margin-top:16px}
.split-2{display:grid;grid-template-columns:1fr;gap:14px}
@media (min-width:920px){ .split-2{grid-template-columns:1.2fr .8fr} }

.tooth-toolbar{display:none;gap:8px;align-items:center;margin:8px 0 6px;flex-wrap:wrap}
.tooth-toolbar .tooth-tool{font-size:0.85rem}
.tooth-tool{padding:6px 10px;border:1px solid var(--line);border-radius:10px;background:#fff;cursor:pointer}
.tooth-tool.active{background:var(--brand);color:#fff;border-color:var(--brand)}

.legend{margin-top:8px;display:flex;gap:12px;align-items:center}
.legend-item{border:1px solid var(--line)}
.legend-item{display:inline-block;width:14px;height:14px;border-radius:4px;margin-left:4px}
.legend-item.red{background:#ef4444}.legend-item.blue{background:#3b82f6}.legend-item.black{background:#111827}

/* Required field indicator star */
.ohc-required{
  color:#ef4444;
  margin-right:2px;
}

.ohc-teeth-wrap{border:1px solid var(--line);border-radius:12px;padding:16px;background:#f9fafb}
.ohc-teeth{display:none}
.ohc-teeth.active{display:block}

.ohc-btn{background:#f3f4f6;border:none;padding:8px 12px;border-radius:10px;cursor:pointer}
.ohc-btn-active{background:var(--brand);color:#fff}

/* Secondary button style used for filter/search actions */
.ohc-btn-secondary{
  background:#f3f4f6;
  border:none;
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  color:#111827;
}
.ohc-btn-secondary:hover{
  background:#e5e7eb;
}

/*
 * Styling for the full-screen toggle button (#btnChartFullscreen).
 * This button uses a subtle border and includes a built‑in icon to make the
 * action clearer to users. When hovered the colours darken slightly for
 * better visual affordance.
 */
#btnChartFullscreen{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:#fff;
  color:#374151;
  border:1px solid #d1d5db;
  padding:8px 12px;
  border-radius:6px;
  font-size:0.9rem;
  cursor:pointer;
  transition:all .2s ease;
}
#btnChartFullscreen:hover{
  background:#f3f4f6;
  border-color:#9ca3af;
}
#btnChartFullscreen::before{
  content:'\2922'; /* ⤢ full-screen icon */
  font-size:1.1rem;
  line-height:1;
}

/* Styling for the province/city container displayed above the form */
.ohc-loc-box{
  background:#f9fafb;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:16px;
  margin-bottom:16px;
}
.ohc-loc-box .ohc-field{
  display:flex;
  flex-direction:column;
}
.ohc-loc-box .ohc-field label{
  margin-bottom:4px;
  font-size:0.9rem;
  color:#374151;
}

/* New containers for grouping the fixed and variable fields on the patient form. The
   fixed box holds province, city, school, class and grade and uses a light
   background. The variable box wraps the remaining fields and shares the card
   border and spacing. */
.ohc-fixed-box{
  background:#f9fafb;
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
  margin-bottom:16px;
}
.ohc-variable-box{
  background:#ffffff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
}

/* The tooth elements should not animate when hovered or focused. Set transition to none with
   !important to override any inherited styles that might apply a hover animation. */
.ohc-tooth{cursor:pointer;pointer-events:all;transition:none !important}
/* Remove hover animation on tooth elements */
.ohc-tooth:hover{transform:none}

/* Chips: softer appearance */
.ohc-chip{display:inline-block;padding:8px 14px;border:1px solid var(--line);border-radius:999px;cursor:pointer;margin-inline-end:8px;background:#fff;font-size:0.9rem}
.ohc-chip input{display:none !important}
.ohc-chip.active{background:#eef2ff;border-color:var(--brand);color:var(--brand);font-weight:600}

/* Colour picker popover used when selecting a tooth state */
.tooth-picker{
  display:flex;
  flex-direction:column;
  gap:4px;
  background:#ffffff;
  position:relative;
  border:1px solid var(--line);
  padding:6px 8px;
  border-radius:10px;
  box-shadow:0 4px 12px rgba(0,0,0,0.08);
  z-index:10000;
}
/* Each picker item contains the colour swatch and its label */
.tooth-picker .picker-item{
  display:flex;
  align-items:center;
  gap:6px;
  cursor:pointer;
  padding:4px 6px;
  border-radius:8px;
}
.tooth-picker .picker-item:hover{
  background:#f3f4f6;
}
/*
 * Each swatch within the colour picker should be relatively positioned so that the × icon on
 * the clear option can be centred correctly. Without a positioned ancestor the pseudo
 * element would position itself relative to the page which caused the cross to appear in
 * the middle of the viewport.
 */
.tooth-picker .opt{
  width:18px;
  height:18px;
  border-radius:4px;
  border:1px solid var(--line);
  position:relative;
}
.tooth-picker .opt-red{background:#ef4444;}
.tooth-picker .opt-blue{background:#3b82f6;}
.tooth-picker .opt-black{background:#111827;}
.tooth-picker .opt-clear{background:#ffffff;}
.tooth-picker .opt-clear::after{
  content:'×';
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  font-size:12px;
  color:var(--muted);
}
.tooth-picker .opt-label{
  font-size:0.8rem;
  color:#111827;
}

/* Fullscreen overlay for tooth charts on mobile */
.ohc-teeth-fs{
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  z-index:100000;
  background:#ffffff;
  overflow-y:auto;
  padding:20px;
}
.ohc-fs-body{
  max-width:900px;
  margin:0 auto;
}
/* Replace the top × close button in full screen with a bottom action button */
.ohc-fs-close-wrap{
  margin-top:24px;
  text-align:center;
}
.ohc-fs-close-btn{
  display:inline-block;
  background:#f3f4f6;
  border:none;
  padding:10px 16px;
  border-radius:12px;
  cursor:pointer;
  color:#374151;
  font-size:0.95rem;
  transition:background 0.2s ease;
}
.ohc-fs-close-btn:hover{
  background:#e5e7eb;
}

/* Statistic summary cards displayed on the front-end and admin stats pages */
.ohc-stats-summary{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}
.ohc-stat-card{
  flex:1 1 160px;
  background:#f9fafb;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  text-align:center;
}
.ohc-stat-card h4{
  margin:0 0 6px;
  font-size:0.9rem;
  color:#374151;
  font-weight:600;
}
.ohc-stat-card p{
  margin:0;
  font-weight:700;
  font-size:1.2rem;
  color:#111827;
}

/* Layout for the observer panel top section: two cards side by side on wide screens,
   stacked on narrow screens. Each child .ohc-card grows equally and wraps on small widths. */
.observer-top-grid{
  display:grid;
  gap:14px;
  grid-template-columns:1fr;
}
@media (min-width:900px){
  .observer-top-grid{
    grid-template-columns:1fr 1fr;
  }
}

.table-wrap{overflow:auto}
.table-wrap table{width:100%;border-collapse:collapse;min-width:100%}
.table-wrap th,.table-wrap td{padding:10px;border-bottom:1px solid var(--line)}
.table-wrap th{white-space:nowrap;background:#f9fafb}
/* Reduce font weight of table headers to match field labels */
.table-wrap th{font-weight:600;}

/* Modal overlay for viewing individual charts */
.ohc-modal{
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,0.4);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:100000;
}
.ohc-modal-content{
  background:#fff;
  padding:20px;
  border-radius:16px;
  max-width:90%;
  max-height:90%;
  overflow-y:auto;
  box-shadow:0 10px 25px rgba(0,0,0,0.15);
  position:relative;
}
.ohc-modal-title{margin-top:0;margin-bottom:16px;font-size:1.2rem;font-weight:600;text-align:center}
.ohc-modal-close{
  position:absolute;
  top:10px;
  left:10px;
  background:transparent;
  border:none;
  font-size:1.5rem;
  line-height:1;
  cursor:pointer;
  color:#6b7280;
}
.ohc-modal-close:hover{color:#111827;}
.ohc-chart-wrap{
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
  background:#f9fafb;
  /* Make tooth charts responsive: ensure the embedded SVG scales to the width of its container. */
  display:block;
}

/* Ensure the cloned SVGs in the chart modal scale properly rather than rendering at a tiny default size */
.ohc-chart-wrap svg{
  width:100%;
  height:auto;
}

/* On smaller screens, enlarge the tooth charts slightly to improve visibility.
   Increasing the SVG width beyond 100% makes the ovals appear larger on mobile while
   still fitting within a scrollable container if necessary. */
@media (max-width: 768px){
  .ohc-chart-wrap{
    padding:24px;
  }
  .ohc-chart-wrap svg{
    width:110%;
    max-width:none;
  }
}

/* Custom Jalali datepicker styles */
.ohc-datepicker{
  background:#ffffff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
  box-shadow:0 8px 20px rgba(0,0,0,0.08);
  font-family:inherit;
  min-width:200px;
}
.ohc-datepicker-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:6px;
  font-size:0.9rem;
  font-weight:600;
}
.ohc-datepicker-nav{
  cursor:pointer;
  padding:0 6px;
  font-size:1.1rem;
}
.ohc-datepicker-grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:2px;
  text-align:center;
  font-size:0.8rem;
}
.ohc-datepicker-cell{
  padding:4px 0;
  border-radius:6px;
  user-select:none;
}
.ohc-datepicker-dayname{
  font-weight:600;
  color:var(--muted);
}
.ohc-datepicker-date{
  cursor:pointer;
}
.ohc-datepicker-date:hover{
  background:#f3f4f6;
}
.ohc-datepicker-date.selected{
  background:var(--brand);
  color:#ffffff;
}
