/* ============================================================
   SCHEDMATE — MODAL.CSS (LIGHT • CLEAN • CONSISTENT)
   Shared by module inline modals:
   Clients / Services / Bookings / Calendar Day / Invoices
============================================================ */

.sm-modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 10000;
  display: none;
}

.sm-modal{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 10001;
  padding: 18px;
}

/* Card shell */
.sm-modal-card{
  width: min(640px, 94vw);
  max-height: min(84vh, 820px);
  display: flex;
  flex-direction: column;

  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15,23,42,.20);
  backdrop-filter: blur(14px);
  overflow: hidden;

  transform: translateY(6px);
  opacity: 0;
  animation: smModalIn .16s ease forwards;
}

@keyframes smModalIn{
  to { transform: translateY(0); opacity: 1; }
}

.sm-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(15,23,42,.08);
  background: rgba(15,23,42,.03);
}

.sm-modal-title{
  font-weight: 800;
  font-size: 14px;
}

/* Scrollable content area (fixes “too tall” modals) */
.sm-modal-body{
  padding: 14px;
  overflow: auto;
}

/* Footer actions always on the RIGHT */
.sm-modal-actions{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(15,23,42,.08);
  background: rgba(15,23,42,.02);
}

.sm-modal-actions .sm-btn{
  min-height: 38px;
}

/* Mobile: stack buttons nicely */
@media (max-width: 520px){
  .sm-modal{ padding: 12px; }
  .sm-modal-actions{
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .sm-modal-actions .sm-btn{
    flex: 1 1 auto;
    min-width: 120px;
  }
}

/* Reuse form styles */
.sm-form{ display:grid; gap: 12px; }
.sm-form-row{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; }
.sm-field{ display:grid; gap: 6px; }
.sm-label{ font-size: 12px; color: rgba(15,23,42,.72); font-weight: 700; white-space: normal; overflow: visible; }
.sm-help{ font-size: 12px; color: rgba(15,23,42,.60); margin-top: 4px; }
/* A row is [label | control]. Any helper text is a third child, which would
   otherwise wrap into column 1 and read as if it belonged to the next
   field's label (e.g. the Tags hint appearing under "Notes"). Keep helper
   text in the control column, directly under its own input. */
.sm-form-row > .sm-help{ grid-column: 2; margin-top: 0; }
@media (max-width: 640px){
  .sm-form-row > .sm-help{ grid-column: 1; }
}
.sm-input, .sm-select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.9);
  outline: none;
}
.sm-input:focus, .sm-select:focus{
  border-color: rgba(59,130,246,.55);
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}

/* One column on small screens */
@media (max-width: 640px){
  .sm-form-row{ grid-template-columns: 1fr; }
}

/* =========================================================
   MODAL POLISH v2.3 — DEPTH + OVERLAY (Design System aligned)
========================================================= */

/* Softer overlay so modal feels bigger */
.sm-modal-backdrop{
  background: rgba(0,0,0,.46);
  backdrop-filter: blur(2px);
}

/* Slightly richer card surface */
.sm-modal-card{
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 18px;
  box-shadow:
    0 28px 80px rgba(0,0,0,.34),
    inset 0 1px 0 rgba(255,255,255,.04);
}

/* Head/Actions match DS */
.sm-modal-head{
  background: var(--sm-surface);
}
.sm-modal-actions{
  background: var(--sm-surface);
}
/* =========================================================
   DARK MODE — MODAL FORM FIX (SELECT / INPUT / OPTIONS)
========================================================= */

body.dark .sm-modal-card{
  background: #0f172a;
  border-color: rgba(255,255,255,.08);
}

body.dark .sm-label{
  color: #cbd5f5;
}

body.dark .sm-input,
body.dark .sm-select{
  background: rgba(255,255,255,.06);
  color: #e5e7eb;
  border-color: rgba(255,255,255,.12);
}

/* 🔴 THIS IS THE IMPORTANT PART */
body.dark select option{
  background-color: #0f172a;
  color: #e5e7eb;
}

/* selected / hover option */
body.dark select option:checked{
  background-color: #2563eb;
  color: #ffffff;
}

/* placeholders */
body.dark .sm-input::placeholder{
  color: rgba(203,213,245,.55);
}

/* Prevent background scroll when modal is open */
body.sm-modal-open{ overflow:hidden; }
