/* ============================================================
   Medical Appointments Plugin – Public Styles
   ============================================================ */

:root {
  --map-primary:    #00a79c;
  --map-primary-d:  #007f76;
  --map-accent:     #27ae60;
  --map-danger:     #e74c3c;
  --map-warn:       #f39c12;
  --map-bg:         #f7f9fc;
  --map-border:     #dce3ed;
  --map-text:       #2c3e50;
  --map-muted:      #7f8c8d;
  --map-radius:     8px;
  --map-shadow:     0 2px 12px rgba(0,0,0,.08);
}

/* ── Wrapper ───────────────────────────────────────────────── */
.map-wrap {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--map-text);
  width: 100%;
}

/* ── Notices ───────────────────────────────────────────────── */
.map-notice {
  padding: 12px 18px;
  border-radius: var(--map-radius);
  border-left: 4px solid var(--map-primary);
  background: #eaf3fb;
  color: var(--map-primary-d);
  margin-bottom: 20px;
}
.map-notice.success { border-color: var(--map-accent); background: #eafaf1; color: #1e8449; }
.map-notice.error   { border-color: var(--map-danger);  background: #fdf2f0; color: #c0392b; }

/* ── Card ──────────────────────────────────────────────────── */
.map-card {
  background: #fff;
  border: 1px solid var(--map-border);
  border-radius: var(--map-radius);
  box-shadow: var(--map-shadow);
  padding: 28px 32px;
  margin-bottom: 24px;
  max-width: 1200px;
  width: 100%;
}
.map-card h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: var(--map-primary);
  border-bottom: 2px solid var(--map-border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

/* ── Form ──────────────────────────────────────────────────── */
.map-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}
.map-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.map-form-group.full { grid-column: 1 / -1; }
.map-form-group label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--map-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.map-form-group input,
.map-form-group select,
.map-form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--map-border);
  border-radius: 6px;
  font-size: .95rem;
  transition: border-color .2s;
  background: var(--map-bg);
}
.map-form-group input:focus,
.map-form-group select:focus,
.map-form-group textarea:focus {
  border-color: var(--map-primary);
  outline: none;
  background: #fff;
}
.map-form-group textarea { resize: vertical; min-height: 80px; }

/* ── Char counter ──────────────────────────────────────────── */
.map-char-count { font-size: .78rem; color: var(--map-muted); text-align: right; }
.map-char-count.over { color: var(--map-danger); font-weight: 700; }

/* ── Slot picker ───────────────────────────────────────────── */
.map-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.map-slot {
  padding: 8px 16px;
  border: 2px solid var(--map-primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--map-primary);
  background: #fff;
  transition: all .18s;
  user-select: none;
}
.map-slot:hover  { background: var(--map-primary); color: #fff; }
.map-slot.active { background: var(--map-primary); color: #fff; font-weight: 700; }
.map-slot.taken  { border-color: var(--map-border); color: var(--map-muted); cursor: not-allowed; background: #f4f4f4; text-decoration: line-through; }

/* ── Buttons ───────────────────────────────────────────────── */
.map-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 24px;
  border: none;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .18s, transform .1s;
}
.map-btn:hover  { opacity: .88; }
.map-btn:active { transform: scale(.97); }
.map-btn-primary { background: var(--map-primary); color: #fff; }
.map-btn-success { background: var(--map-accent);  color: #fff; }
.map-btn-danger  { background: var(--map-danger);  color: #fff; }
.map-btn-warn    { background: var(--map-warn);    color: #fff; }
.map-btn-ghost   { background: transparent; color: var(--map-primary); border: 2px solid var(--map-primary); }
.map-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Doctor panel tabs ─────────────────────────────────────── */
.map-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--map-border);
}
.map-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: .95rem;
  font-weight: 600;
  color: var(--map-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .18s, border-color .18s;
}
.map-tab.active, .map-tab:hover { color: var(--map-primary); border-bottom-color: var(--map-primary); }

.map-tab-content { display: none; }
.map-tab-content.active { display: block; }

/* ── Appointments table ────────────────────────────────────── */
.map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.map-table th {
  background: var(--map-bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--map-muted);
  border-bottom: 2px solid var(--map-border);
}
.map-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--map-border);
  vertical-align: middle;
}
.map-table tr:last-child td { border-bottom: none; }
.map-table tr:hover td { background: #fafcff; }

/* ── Status badges ─────────────────────────────────────────── */
.map-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.map-badge-confirmed   { background: #d5f5e3; color: #1e8449; }
.map-badge-pending     { background: #fef9e7; color: #b7950b; }
.map-badge-rescheduled { background: #eaf3fb; color: #1a6fa8; }
.map-badge-cancelled   { background: #fadbd8; color: #c0392b; }

/* ── Calendar / date-picker wrapper ───────────────────────── */
.map-date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.map-date-nav input[type="date"] {
  padding: 8px 12px;
  border: 1.5px solid var(--map-border);
  border-radius: 6px;
  font-size: .95rem;
  background: var(--map-bg);
}

/* ── Message thread ────────────────────────────────────────── */
.map-thread {
  max-height: 340px;
  overflow-y: auto;
  padding: 16px;
  background: var(--map-bg);
  border: 1px solid var(--map-border);
  border-radius: var(--map-radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.map-msg {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.5;
}
.map-msg-doctor  { background: var(--map-primary); color: #fff; align-self: flex-end; border-radius: 12px 12px 3px 12px; }
.map-msg-patient { background: #fff; border: 1px solid var(--map-border); color: var(--map-text); align-self: flex-start; border-radius: 12px 12px 12px 3px; }
.map-msg-system  { background: #eef0f3; color: var(--map-muted); font-size: .8rem; align-self: center; border-radius: 8px; padding: 6px 12px; font-style: italic; }
.map-msg-time    { font-size: .72rem; opacity: .65; margin-top: 4px; }

.map-msg-compose {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.map-msg-compose textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--map-border);
  border-radius: 6px;
  font-size: .9rem;
  resize: none;
  min-height: 60px;
}

/* ── Spinner ───────────────────────────────────────────────── */
.map-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: map-spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes map-spin { to { transform: rotate(360deg); } }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .map-form-grid { grid-template-columns: 1fr; }
  .map-card { padding: 20px 16px; }
  .map-table th:nth-child(n+4), .map-table td:nth-child(n+4) { display: none; }
}

/* ── Login page ────────────────────────────────────────────── */
.map-login-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.map-login-card {
  background: #fff;
  border: 1px solid var(--map-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.10);
  padding: 40px 40px 32px;
  width: 100%;
  max-width: 420px;
}
.map-login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.map-login-logo img {
  max-height: 64px;
  width: auto;
  margin-bottom: 10px;
}
.map-login-clinic-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--map-primary);
  letter-spacing: -.01em;
}
.map-login-subtitle {
  font-size: .85rem;
  color: var(--map-muted);
  margin: 4px 0 0;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.map-login-card .map-form-group {
  margin-bottom: 18px;
}
.map-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.map-pass-wrap input {
  flex: 1;
  padding-right: 44px !important;
}
.map-toggle-pass {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--map-muted);
  padding: 4px;
  display: flex;
  align-items: center;
}
.map-toggle-pass:hover { color: var(--map-primary); }
.map-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .87rem;
  color: var(--map-muted);
  margin-bottom: 20px;
  cursor: pointer;
}
.map-remember input { width: auto; margin: 0; }
.map-btn-full {
  width: 100%;
  justify-content: center;
  padding: 13px;
  font-size: 1rem;
  border-radius: 8px;
}
.map-login-footer {
  text-align: center;
  margin-top: 18px;
  font-size: .85rem;
}
.map-login-footer a {
  color: var(--map-muted);
  text-decoration: none;
}
.map-login-footer a:hover { color: var(--map-primary); }
.map-login-card .map-notice {
  margin-bottom: 18px;
  font-size: .9rem;
}

/* ── FullCalendar overrides & calendar wrapper ─────────────── */
.map-calendar {
  margin: 4px 0 20px;
  font-size: .88rem;
}
.map-calendar .fc-toolbar-title {
  font-size: 1.05rem !important;
  font-weight: 700;
  color: var(--map-primary);
}
.map-calendar .fc-button {
  background: var(--map-primary) !important;
  border-color: var(--map-primary) !important;
  font-size: .82rem !important;
  padding: 5px 12px !important;
}
.map-calendar .fc-button:hover { opacity: .85; }
.map-calendar .fc-daygrid-day-number { color: var(--map-text); font-weight: 600; }
.map-calendar .fc-daygrid-day.fc-day-today { background: #eaf3fb !important; }
.map-calendar .fc-daygrid-day:hover { background: #f0f6ff; cursor: pointer; }

/* Event dots / pills */
.map-calendar .fc-event {
  border-radius: 4px !important;
  font-size: .78rem !important;
  padding: 1px 5px !important;
  cursor: pointer;
}
.map-cal-event-confirmed   { background: #27ae60 !important; border-color: #27ae60 !important; }
.map-cal-event-pending     { background: #f39c12 !important; border-color: #f39c12 !important; }
.map-cal-event-rescheduled { background: #1a6fa8 !important; border-color: #1a6fa8 !important; }
.map-cal-event-blocked     { background: #e74c3c !important; border-color: #e74c3c !important; }

/* Day detail panel */
.map-day-panel {
  background: #fff;
  border: 1px solid var(--map-border);
  border-radius: var(--map-radius);
  padding: 18px 20px;
  margin-top: 4px;
  animation: map-slide-in .18s ease;
}
@keyframes map-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.map-day-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.map-day-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--map-primary);
}
.map-day-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--map-muted);
  padding: 2px 8px;
  border-radius: 4px;
  transition: background .15s;
}
.map-day-close:hover { background: #f0f0f0; }
.map-btn-sm {
  padding: 5px 10px !important;
  font-size: .78rem !important;
}

/* ── Required field error state ─────────────────────────────── */
.map-form-group.map-field-error label {
  color: var(--map-danger) !important;
}
.map-form-group.map-field-error input,
.map-form-group.map-field-error select,
.map-form-group.map-field-error textarea {
  border-color: var(--map-danger) !important;
  background: #fff8f8;
}
.map-form-group.map-field-error .map-slots-grid {
  border: 2px solid var(--map-danger);
  border-radius: 6px;
  padding: 8px;
}

/* ── Notification item ─────────────────────────────────────── */
.map-notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--map-border);
  cursor: pointer;
  transition: background .15s;
}
.map-notif-item:last-child { border-bottom: none; }
.map-notif-item:hover { background: #f0f6ff; }
.map-notif-name {
  font-weight: 700;
  font-size: .9rem;
  color: var(--map-text);
}
.map-notif-preview {
  font-size: .82rem;
  color: var(--map-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-notif-time {
  font-size: .75rem;
  color: #b0b8c4;
  margin-top: 3px;
}
.map-notif-go {
  display: inline-block;
  margin-top: 6px;
  font-size: .78rem;
  color: var(--map-primary);
  font-weight: 700;
  text-decoration: none;
}

/* ── Button text centering ─────────────────────────────────── */
.map-btn {
  justify-content: center;
  text-align: center;
}

/* ── Messages tab conversation list ───────────────────────── */
.map-conv-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--map-border);
  cursor: pointer;
  transition: background .15s;
}
.map-conv-item:hover { background: #f0f7f7; }
.map-conv-item.active { background: #e6f7f6; border-left: 3px solid var(--map-primary); }
.map-conv-name { font-weight: 700; font-size: .9rem; color: var(--map-text); }
.map-conv-preview { font-size: .8rem; color: var(--map-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-conv-meta { font-size: .75rem; color: #b0b8c4; margin-top: 3px; display: flex; justify-content: space-between; }
.map-conv-unread { background: var(--map-danger); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: .72rem; font-weight: 700; }

/* ── New message highlight animation ──────────────────────── */
.map-msg-new {
  animation: map-msg-highlight 2s ease-out forwards;
}
@keyframes map-msg-highlight {
  0%   { box-shadow: 0 0 0 3px rgba(0,167,156,.6); background: #c8f0ee; }
  100% { box-shadow: none; background: #fff; }
}

/* ── Tab badge inline ──────────────────────────────────────── */
#map-tab-msg-badge {
  display: none;
  background: var(--map-danger);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: .7rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 5px;
}

/* ── Date input larger on desktop ──────────────────────────── */
#map_appt_date {
  font-size: 1.05rem;
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 260px;
  cursor: pointer;
}
@media (min-width: 768px) {
  #map_appt_date {
    font-size: 1.15rem;
    padding: 14px 20px;
    max-width: 320px;
  }
}

/* ── Flatpickr customization ───────────────────────────────── */
.flatpickr-calendar {
  font-family: 'Segoe UI', system-ui, sans-serif !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.12) !important;
  border: 1px solid var(--map-border) !important;
  width: fit-content !important;
}

/* Header row: ‹ [luna + an] › */
.flatpickr-months {
  background: var(--map-primary) !important;
  border-radius: 10px 10px 0 0 !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  height: 46px !important;
  padding: 0 4px !important;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  position: static !important;
  top: auto !important;
  padding: 8px !important;
  height: auto !important;
  fill: #fff !important;
  color: #fff !important;
  flex-shrink: 0 !important;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { fill: #fff !important; }

.flatpickr-month {
  background: transparent !important;
  color: #fff !important;
  flex: 1 !important;
  height: auto !important;
  line-height: normal !important;
  overflow: visible !important;
}
.flatpickr-current-month {
  position: static !important;
  left: auto !important;
  width: 100% !important;
  padding: 0 !important;
  font-size: .95rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  height: auto !important;
  line-height: normal !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: .95rem !important;
  padding: 2px 4px !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin-bottom: 5px !important;
}
.flatpickr-current-month .numInputWrapper { display: none !important; }

/* Custom year select — after › arrow */
.map-year-select {
  background: rgba(255,255,255,.15) !important;
  border: 1px solid rgba(255,255,255,.3) !important;
  border-radius: 4px !important;
  color: #fff !important;
  font-size: .9rem !important;
  font-weight: 700 !important;
  padding: 2px 6px !important;
  cursor: pointer !important;
  outline: none !important;
  width: 68px !important;
  flex-shrink: 0 !important;
  margin: 0 6px !important;
}

/* Weekdays */
.flatpickr-weekdays {
  background: var(--map-primary) !important;
}
.flatpickr-weekday {
  color: rgba(255,255,255,.9) !important;
  font-weight: 600 !important;
}

/* Days */
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--map-primary) !important;
  border-color: var(--map-primary) !important;
}
.flatpickr-day:hover:not(.flatpickr-disabled) {
  background: #e6f7f6 !important;
}
.flatpickr-day.today {
  border-color: var(--map-primary) !important;
}

#map_appt_date,
#map_birth_date { cursor: pointer; }

/* ── Messages tab mobile ───────────────────────────────────── */
@media (max-width: 640px) {
  #map-msg-layout {
    flex-direction: column !important;
    height: auto !important;
  }
  #map-msg-convlist {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--map-border) !important;
    max-height: 300px !important;
  }
  #map-msg-thread-panel {
    min-height: 300px !important;
  }
  /* On mobile: hide thread panel until conversation selected */
  #map-msg-thread-panel.map-hidden-mobile {
    display: none !important;
  }
  #map-msg-convlist.map-hidden-mobile {
    display: none !important;
  }
  #map-msg-back {
    display: inline-block !important;
  }
}

/* Mobile: thread panel hidden initially */
@media (max-width: 640px) {
  #map-msg-thread-panel.map-hidden-mobile {
    display: none !important;
  }
  #map-msg-convlist.map-hidden-mobile {
    display: none !important;
  }
}
/* Desktop: always show both panels */
@media (min-width: 641px) {
  #map-msg-thread-panel.map-hidden-mobile,
  #map-msg-convlist.map-hidden-mobile {
    display: flex !important;
  }
}
