/* Added by integration 2026-03-03 : start
   Appointments module styles.
   Non-destructive, isolated to appointments pages only.
*/

.appointments-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

/* Added by modification 2026-03-03 : start
   v9 layout alignment to match LIT CRM card spacing.
*/
.appt-page-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin: 6px 0 16px;
}

.appt-head-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.appt-filters-card{ margin-bottom: 14px; }

.appt-filters-grid{
  display:grid;
  grid-template-columns: 1.1fr 1.6fr 1fr 1fr auto;
  gap:12px;
  align-items:end;
}

.appt-filters-grid--calendar{
  grid-template-columns: 1.2fr 1fr auto;
}

.appt-filter-actions{ display:flex; flex-direction:column; }

.appt-table-card .card-body{ padding-top: 6px; }

.appt-calendar-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.appt-day-group{
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 14px;
  overflow: hidden;
}

.appt-day-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  background: rgba(241,245,249,.75);
  border-bottom: 1px solid rgba(148, 163, 184, .25);
  font-weight: 800;
}

.appt-day-items{ padding: 10px 12px; display:flex; flex-direction:column; gap:10px; }

.appt-item{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding: 10px 12px;
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  border-radius: 12px;
}

.appt-item .left{ display:flex; flex-direction:column; gap:4px; }
.appt-item .meta{ color: rgba(15,23,42,.65); font-size: 12px; }
.appt-item .title{ font-weight: 800; }
.appt-item .right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }

@media (max-width: 992px){
  .appt-filters-grid{ grid-template-columns: 1fr 1fr; }
  .appt-filters-grid--calendar{ grid-template-columns: 1fr 1fr; }
  .appt-filter-actions{ grid-column: 1 / -1; }
}

@media (max-width: 560px){
  .appt-filters-grid{ grid-template-columns: 1fr; }
  .appt-filters-grid--calendar{ grid-template-columns: 1fr; }
}
/* Added by modification 2026-03-03 : end */

.appointments-toolbar .actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.appt-filters{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.appt-filters .field{
  min-width:180px;
}

.appt-shortcuts{
  display:flex;
  gap:8px;
  align-items:center;
  padding-bottom:2px;
}

.appt-shortcuts .btn{
  padding:6px 10px;
  font-size:12px;
}

.appt-table-actions{
  display:flex;
  gap:6px;
  justify-content:flex-end;
}

.appt-badge{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  border:1px solid rgba(15, 23, 42, .10);
  background:#f8fafc;
  color:#0f172a;
}
.appt-badge.scheduled{ background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.25); color:#1d4ed8; }
.appt-badge.completed{ background: rgba(16,185,129,.10); border-color: rgba(16,185,129,.25); color:#047857; }
.appt-badge.canceled{ background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.25); color:#b91c1c; }
.appt-badge.no_show{ background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.25); color:#b45309; }

/* Calendar */
.appt-cal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.appt-cal-month{
  font-size:18px;
  font-weight:800;
}

.appt-cal-nav{
  display:flex;
  gap:8px;
  align-items:center;
}

.appt-cal-grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:10px;
}

.appt-cal-day{
  background:#fff;
  border:1px solid rgba(148, 163, 184, .35);
  border-radius:14px;
  padding:10px;
  min-height:110px;
  box-shadow: 0 2px 8px rgba(17,24,39,.04);
  display:flex;
  flex-direction:column;
  gap:8px;
}

.appt-cal-day .dtop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.appt-cal-day .dnum{ font-weight:800; color:#0f172a; }
.appt-cal-day.muted{ opacity:.55; background: rgba(241,245,249,.65); }

.appt-cal-events{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.appt-cal-event{
  display:flex;
  gap:8px;
  align-items:flex-start;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,.08);
  background:#f8fafc;
  cursor:pointer;
}
.appt-cal-event:hover{ background:#eef2ff; border-color: rgba(37,99,235,.18); }
.appt-cal-event .time{ font-weight:700; white-space:nowrap; color:#0f172a; font-size:12px; }
.appt-cal-event .title{ font-size:12px; color:#0f172a; }

/* Form */
.appt-form{
  /* We use the existing .form-grid from dashboard.css for layout,
     so keep this wrapper non-opinionated. */
  display:block;
}

.appt-actions{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:14px;
  flex-wrap:wrap;
}

/* Click-anywhere date inputs: reuse existing .field and add pointer cue */
[data-date-wrap]{
  cursor:pointer;
}
[data-date-wrap] input[type="date"],
[data-date-wrap] input[type="datetime-local"]{
  cursor:pointer;
}

/* Added by integration 2026-03-03 : end */


/* Card padding helper (appointments module only) */
.appt-card{ padding:16px; }

/* -------------------------------------------------
   FullCalendar (Calendar page)
   ------------------------------------------------- */

.appt-fullcalendar .fc {
  --fc-border-color: #e2e8f0;
  --fc-page-bg-color: transparent;
  --fc-today-bg-color: rgba(99, 102, 241, 0.06);
}

.appt-fullcalendar .fc .fc-toolbar-title {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
}

.appt-fullcalendar .fc .fc-button {
  background: #334155;
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
}

.appt-fullcalendar .fc .fc-button:hover {
  background: #1f2937;
}

.appt-fullcalendar .fc .fc-button:disabled {
  opacity: 0.6;
}

.appt-fullcalendar .fc .fc-button:focus,
.appt-fullcalendar .fc .fc-button-primary:focus {
  box-shadow: none;
}

.appt-fullcalendar .fc .fc-button-primary:not(:disabled).fc-button-active,
.appt-fullcalendar .fc .fc-button-primary:not(:disabled):active {
  background: #0f172a;
}

.appt-fullcalendar .fc .fc-daygrid-event,
.appt-fullcalendar .fc .fc-timegrid-event {
  font-weight: 700;
}

/* -------------------------------------------------
   Appointment modal (Calendar click)
   ------------------------------------------------- */

.appt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.appt-modal-overlay[aria-hidden="true"] {
  display: none;
}

.appt-modal {
  width: 100%;
  max-width: 1100px;
  background: #f8fafc;
  border-radius: 26px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.35);
  border: 1px solid rgba(226,232,240,0.9);
  padding: 18px;
}

.appt-modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 6px 14px 6px;
}

.appt-modal-title {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
}

.appt-modal-subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

.appt-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid rgba(226,232,240,0.9);
}

.appt-status-pill.is-scheduled { background: #fef3c7; color: #92400e; }
.appt-status-pill.is-completed { background: #dcfce7; color: #166534; }
.appt-status-pill.is-canceled { background: #fee2e2; color: #991b1b; }
.appt-status-pill.is-no_show { background: #e0e7ff; color: #3730a3; }

.appt-modal-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .appt-modal-grid {
    grid-template-columns: 1fr;
  }
}

.appt-modal-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  padding: 16px;
}

.appt-modal-card-title {
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 12px;
}

.appt-modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.appt-modal-fields-2col {
  margin-top: 12px;
}

.appt-modal-fields .field {
  min-width: 0;
}

.appt-modal-fields .field.full {
  grid-column: 1 / -1;
}

.appt-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 14px;
}

.appt-assigned-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 680px) {
  .appt-assigned-grid {
    grid-template-columns: 1fr;
  }
}

.appt-assigned-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
}

.appt-assigned-check {
  transform: scale(1.1);
}

.appt-assigned-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(226,232,240,0.9);
  flex: 0 0 auto;
}

.appt-assigned-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #0f172a;
  background: #e2e8f0;
}

.appt-assigned-name {
  font-weight: 900;
  color: #0f172a;
  line-height: 1.15;
}

.appt-assigned-role {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
}

/* --------------------------------------------------------------------------
   CSP-safe Calendar (vanilla JS)
   -------------------------------------------------------------------------- */
.appt-calendar-error {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 12px;
}

.appt-cal {
  width: 100%;
}

.appt-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.appt-cal-toolbar .left,
.appt-cal-toolbar .right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.appt-cal-title {
  font-weight: 800;
  font-size: 18px;
}

.appt-cal-toolbar button.is-active {
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
}

.appt-cal-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.appt-cal-grid th {
  text-align: left;
  font-size: 12px;
  color: #6b7280;
  padding: 10px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.appt-cal-grid td {
  vertical-align: top;
  padding: 8px 10px;
  height: 120px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.appt-cal-grid tr:last-child td {
  border-bottom: 0;
}

.appt-cal-grid td:last-child,
.appt-cal-grid th:last-child {
  border-right: 0;
}

.appt-cal-grid td.is-other-month {
  background: #fafafa;
  color: #9ca3af;
}

.appt-cal-daynum {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 6px;
}

.appt-cal-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.appt-cal-event {
  font-size: 12px;
  line-height: 1.25;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: pointer;
  background: #eff6ff;
  color: #1d4ed8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.appt-cal-event .time {
  font-weight: 800;
  margin-right: 4px;
}

.appt-cal-more {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}

.appt-cal-event.status-canceled,
.appt-week-event.status-canceled,
.appt-day-event.status-canceled {
  background: #fef2f2;
  color: #991b1b;
}

.appt-cal-event.status-completed,
.appt-week-event.status-completed,
.appt-day-event.status-completed {
  background: #ecfdf5;
  color: #065f46;
}

.appt-cal-event.status-no_show,
.appt-week-event.status-no_show,
.appt-day-event.status-no_show {
  background: #fff7ed;
  color: #9a3412;
}

.appt-week {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.appt-week-day {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
}

.appt-week-label {
  font-weight: 800;
  margin-bottom: 8px;
}

.appt-week-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.appt-week-event,
.appt-day-event {
  font-size: 13px;
  line-height: 1.25;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  background: #eff6ff;
  color: #1d4ed8;
}

.appt-week-event .time,
.appt-day-event .time {
  font-weight: 800;
  margin-right: 6px;
}

.appt-day {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.appt-day-title {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 12px;
}

.appt-day-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Added by modification 2026-03-04
   Calendar month view layout fix

   The month renderer uses a <table class="appt-cal-grid">.
   Earlier iterations used a CSS grid with the same class name, which can
   accidentally force the table into `display:grid` and collapse the layout.
   This override ensures the month table always renders as an actual table
   with evenly sized columns.
   -------------------------------------------------------------------------- */
table.appt-cal-grid{
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

table.appt-cal-grid th,
table.appt-cal-grid td{
  width: 14.285%;
}
/* -------------------------------------------------
   Added by correction 2026-03-05
   Unify Calendar & Index layout to match Create Appointment design
   ------------------------------------------------- */

/* 1. Page header — same height, font weight, spacing as create.php */
.page-head,
.appt-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 20px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.page-head h1,
.appt-page-head h1 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.1;
}

.page-head p.muted,
.appt-page-head p.muted {
  color: #64748b;
  font-size: 15px;
  margin: 2px 0;
}

/* 2. Header actions (Calendar / New Appointment buttons) */
.page-head .actions,
.appt-head-actions,
.page-head > .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.page-head .actions .btn,
.appt-head-actions .btn {
  min-width: 140px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

/* Match Create page's green call-to-action gradient */
.page-head .btn-primary,
.appt-head-actions .btn-primary {
  background: linear-gradient(90deg, #14b8a6, #10b981);
  border: none;
  color: #fff;
}
.page-head .btn-primary:hover {
  background: linear-gradient(90deg, #0d9488, #059669);
}

/* 3. Card & page alignment */
.page > .card,
.page section.card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(226,232,240,.8);
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}

.card-body {
  padding: 16px;
}

/* 4. Unify filter and calendar spacing */
.appt-filters-card {
  margin-bottom: 18px;
}

.appt-fullcalendar {
  border-radius: 14px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
}

/* 5. Light gray page background consistency */
body {
  background-color: #f8fafc;
}
/* -------------------------------------------------
   Added by correction 2026‑03‑05 : View page consistency
   ------------------------------------------------- */

.page[data-appointment-id] {
  margin: 0 auto;
}

.page[data-appointment-id] .page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(226,232,240,0.65);
  padding-bottom: 6px;
}

.page[data-appointment-id] .page-head h1 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

.page[data-appointment-id] .page-head p.muted {
  color: #64748b;
  font-size: 15px;
}

.page[data-appointment-id] .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.page[data-appointment-id] .actions .btn {
  min-width: 140px;
  padding: 10px 18px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(15,23,42,0.08);
}

.page[data-appointment-id] .actions .btn-primary {
  background: linear-gradient(90deg, #14b8a6, #10b981);
  border: none;
  color: #fff;
}

.page[data-appointment-id] .actions .btn-primary:hover {
  background: linear-gradient(90deg, #0d9488, #059669);
}

.page[data-appointment-id] .card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(226,232,240,.8);
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}/* -------------------------------------------------
   Hotfix 2026-03-05
   Restore modal background & field layout for view.php
   ------------------------------------------------- */

/* only affect .appt-modal — do NOT override normal .page layout */
.appt-modal {
  background: #ffffff;                   /* ensure white card background */
  border-radius: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 16px 60px rgba(15,23,42,0.4);
  padding: 24px;
}

/* restore card contrast inside modal */
.appt-modal-card {
  background: #f8fafc;
  border-radius: 20px;
  border: 1px solid rgba(226,232,240,0.9);
  box-shadow: 0 2px 8px rgba(15,23,42,0.1);
  padding: 16px 18px;
}

/* tighten form-grid to look like create.php controls */
.appt-form-grid .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.appt-form-grid .label {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}

.appt-form-grid .input,
.appt-form-grid .select,
.appt-form-grid .textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
}

/* match buttons inside modal to CRM buttons */
.appt-modal-actions .btn-primary {
  background: linear-gradient(90deg, #14b8a6, #10b981);
  color: #fff;
  border: none;
  font-weight: 700;
}
.appt-modal-actions .btn-primary:hover {
  background: linear-gradient(90deg, #0d9488, #059669);
}
.appt-modal-actions .btn-light {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}
.appt-modal-actions .btn-light:hover {
  background: #e2e8f0;
}
/* -------------------------------------------------
   Assigned single view (replaces scroll grid)
   ------------------------------------------------- */
.appt-assigned-single {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.appt-assigned-label {
  color: #64748b;
  font-weight: 500;
}

.appt-assigned-name {
  font-weight: 800;
  color: #0f172a;
}

/* Hide the original grid if still rendered by other pages */
.appt-assigned-grid { display: none !important; }