/* ================================================================
   JamJam Appointments — Frontend Widget v1.0.0
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600&family=Jost:wght@300;400;500;600&display=swap');

.jma-widget {
  --gold:    #B08D57;
  --gold-d:  #93713F;
  --dark:    #3B2E22;
  --cream:   #F3EEE6;
  --warm:    #FAF8F4;
  --border:  #e3dccf;
  --muted:   #8a8078;
  --text:    #2B2118;
  --success: #4c7a5a;
  /* Every font-family below reads one of these two, so a site can retheme
     the whole widget (see class-jma-public.php print_theme_overrides())
     just by redeclaring these two custom properties on .jma-widget. */
  --jma-font-body:    'Jost', sans-serif;
  --jma-font-heading: 'Cormorant Garamond', serif;
  --jma-label-size:   9px;
  font-family: var(--jma-font-body);
  color: var(--text);
  max-width: 620px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(0,0,0,.10);
}

.jma-widget a, .jma-widget a:hover, .jma-widget a:visited, .jma-widget a:focus {
  color: inherit; text-decoration: none; background: none; border: none; outline: none;
}

/* ── Header ── */
.jma-widget__header { background: var(--dark); padding: 18px 26px; color: #fff; }
.jma-widget__header h2 { font-family: var(--jma-font-heading); font-size: 23px; font-weight: 300; letter-spacing: .02em; margin: 0; }
.jma-widget__header p { font-size: 11px; color: rgba(255,255,255,.6); margin: 3px 0 0; }

.jma-widget__body { padding: 20px 24px; max-height: 72vh; overflow-y: auto; }

/* ── Steps ── */
.jma-steps { display: flex; align-items: center; margin-bottom: 18px; }
.jma-step { display: flex; align-items: center; gap: 5px; flex: 1; }
.jma-step:not(:last-child)::after { content: ''; flex: 1; height: 1px; background: var(--border); margin: 0 5px; }
.jma-step__num {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--muted); flex-shrink: 0; transition: all .2s;
}
.jma-step--active .jma-step__num { background: var(--gold); border-color: var(--gold); color: #fff; }
.jma-step--done   .jma-step__num { background: var(--success); border-color: var(--success); color: #fff; }
.jma-step__label { font-size: calc(var(--jma-label-size) + 1px); color: var(--muted); font-weight: 500; white-space: nowrap; }
.jma-step--active .jma-step__label { color: var(--gold-d); font-weight: 600; }
.jma-step--done   .jma-step__label { color: var(--success); }

/* ── Panels ── */
.jma-panel { display: none; }
.jma-panel--active { display: block; }

.jma-slabel { display: block; font-size: var(--jma-label-size); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.jma-slabel--spaced { margin-top: 18px; }

/* ── Appointment type cards ── */
.jma-type-list { display: flex; flex-direction: column; gap: 10px; }
.jma-type-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; cursor: pointer; transition: all .15s;
}
.jma-type-card:hover { border-color: var(--gold); background: var(--warm); }
.jma-type-card--selected { border-color: var(--gold); background: var(--cream); }
.jma-type-card__main strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.jma-type-card__duration { display: inline-block; font-size: 10px; color: var(--gold-d); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.jma-type-card__main p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.jma-type-card__btn {
  flex-shrink: 0; background: var(--dark); color: #fff; font-size: 10px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; padding: 8px 16px; border-radius: 20px;
}

/* ── Form fields ── */
.jma-field { margin-bottom: 12px; }
.jma-field:last-child { margin-bottom: 0; }
.jma-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.jma-field label { display: block; font-size: var(--jma-label-size); font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.jma-req { color: #c0392b; }
.jma-optional { color: #b7ada2; text-transform: none; font-weight: 400; letter-spacing: 0; }

.jma-field input[type=text], .jma-field input[type=email], .jma-field input[type=tel],
.jma-field input[type=file], .jma-field select, .jma-field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border) !important; border-radius: 4px !important;
  font-family: var(--jma-font-body) !important; font-size: 13px !important; color: var(--text) !important;
  background: var(--warm) !important; outline: none !important; transition: border-color .2s;
  box-sizing: border-box !important; -webkit-text-fill-color: var(--text) !important;
}
.jma-field textarea { resize: vertical; min-height: 64px; }
.jma-field input:focus, .jma-field select:focus, .jma-field textarea:focus {
  border-color: var(--gold) !important; background: #fff !important; -webkit-text-fill-color: var(--text) !important;
}
.jma-field input::placeholder { color: #bcb2a5 !important; opacity: 1; }

.jma-field--checkbox { display: flex; align-items: flex-start; }
.jma-checkbox-label { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text); line-height: 1.5; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; }
.jma-checkbox-label input[type=checkbox] { margin-top: 3px; width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--gold); }
.jma-field--newsletter { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ── Buttons ── */
.jma-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
.jma-btn { padding: 10px 22px; border: none; border-radius: 20px; font-family: var(--jma-font-body); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; cursor: pointer; transition: all .2s; }
.jma-btn--primary { background: var(--dark); color: #fff; }
.jma-btn--primary:hover { background: #2a2018; }
.jma-btn--disabled { background: #ccc !important; cursor: not-allowed; pointer-events: none; }
.jma-btn--back { background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 20px; }
.jma-btn--back:hover { border-color: var(--muted); color: var(--text); }

.jma-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ── Calendar ── */
.jma-cal { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
.jma-cal__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jma-cal__month { font-weight: 600; font-size: 12px; color: var(--text); }
.jma-cal__arrow { background: var(--dark); border: none; border-radius: 20px; width: 32px; height: 22px; cursor: pointer; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: background .2s; color: #fff; line-height: 1; }
.jma-cal__arrow:hover { background: #2a2018; }

.jma-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 32px; gap: 1px; }
.jma-cal__head { display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); height: 22px; }
.jma-cal__day { display: flex; align-items: center; justify-content: center; font-size: 12px; border-radius: 50%; border: 1.5px solid transparent; cursor: default; transition: all .12s; width: 30px; height: 30px; margin: auto; }
.jma-cal__day--available { cursor: pointer; color: var(--text); }
.jma-cal__day--available:hover { border-color: var(--gold); color: var(--gold-d); }
.jma-cal__day--selected { background: var(--gold) !important; color: #fff !important; border-color: var(--gold) !important; }
.jma-cal__day--today { font-weight: 700; }
.jma-cal__day--disabled { color: #e0e0e0; }
.jma-cal__day--unavailable { color: #d8d8d8; text-decoration: line-through; font-size: 10px; }
.jma-cal__day--empty { pointer-events: none; }

/* ── Time slots ── */
.jma-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.jma-slot { padding: 8px 4px; text-align: center; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500; background: var(--warm); transition: all .15s; }
.jma-slot:hover:not(.jma-slot--full):not(.jma-slot--selected) { border-color: var(--gold); color: var(--gold-d); background: #fff; }
.jma-slot--selected { background: var(--gold); color: #fff; border-color: var(--gold); }
.jma-slot--full { background: #f5f5f5; color: #bbb; cursor: not-allowed; text-decoration: line-through; font-size: 10px; }

/* ── "We'll contact you to confirm a time" note (pick_time setting off) ── */
.jma-tbc-note { background: var(--warm); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin-top: 8px; font-size: 13px; color: var(--text); line-height: 1.5; }

/* ── Summary ── */
.jma-summary { background: var(--cream); border-radius: 6px; padding: 12px 16px; margin-bottom: 14px; }
.jma-sumrow { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.jma-sumrow:last-child { border-bottom: none; }
.jma-sumkey { font-size: 10px; color: var(--muted); font-weight: 500; }
.jma-sumval { font-size: 12px; font-weight: 600; text-align: right; }

/* ── Success ── */
.jma-success { text-align: center; padding: 10px 0 4px; }
.jma-success__icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
}
.jma-success h3 { font-family: var(--jma-font-heading); font-size: 25px; font-weight: 400; margin: 0 0 8px; }
.jma-success p { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0; }
.jma-success .jma-ref { color: var(--gold-d); font-weight: 700; }

/* ── Error / loading ── */
.jma-error { background: #fdf1f0; border-left: 3px solid #c0392b; padding: 8px 12px; font-size: 12px; color: #c0392b; border-radius: 0 4px 4px 0; margin-bottom: 12px; display: none; }
.jma-privacy { font-size: 11px; color: var(--muted); margin: 12px 0 0; }
.jma-loader { text-align: center; padding: 12px; color: var(--muted); font-size: 12px; display: none; }
.jma-loader::after { content: ''; display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: jma-spin .7s linear infinite; margin-left: 6px; vertical-align: middle; }
@keyframes jma-spin { to { transform: rotate(360deg); } }

/* ================================================================
   Sitewide floating tab + modal
   ================================================================ */
.jma-floating-tab {
  position: fixed; top: 50%; right: 0; transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl; background: var(--dark, #3B2E22); color: #F3EEE6 !important;
  font-family: 'Jost', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 18px 10px; border-radius: 8px 0 0 8px; text-decoration: none !important; z-index: 99998;
  box-shadow: -2px 0 12px rgba(0,0,0,.15); transition: padding .2s, background .2s;
}
.jma-floating-tab:hover { padding-right: 16px; background: #B08D57; }

.jma-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(30,22,15,.55); z-index: 99999;
  align-items: center; justify-content: center; padding: 24px;
}
.jma-modal-overlay--open { display: flex; }
.jma-modal { position: relative; max-width: 640px; width: 100%; max-height: 90vh; margin: auto; }
.jma-modal .jma-widget { max-width: none; max-height: 90vh; display: flex; flex-direction: column; }
.jma-modal .jma-widget__body { flex: 1; }
/* Sits just inside the card's top-right corner (not floating outside it) so
   it can never be pushed off-screen by a tall modal on a short viewport.
   Every visual property is !important — sites that apply their own global
   button styling (background, radius, opacity-on-hover effects) otherwise
   win the specificity fight against a plain `button` element selector. */
.jma-modal__close {
  position: absolute !important; top: 12px !important; right: 14px !important;
  width: 30px !important; height: 30px !important; min-width: 30px !important; min-height: 30px !important;
  padding: 0 !important; margin: 0 !important; border-radius: 50% !important;
  background: rgba(255,255,255,.92) !important; border: none !important; box-shadow: 0 2px 8px rgba(0,0,0,.25) !important;
  font-size: 17px !important; font-weight: 400 !important; line-height: 1 !important; text-transform: none !important;
  letter-spacing: 0 !important; color: var(--dark, #3B2E22) !important; cursor: pointer !important;
  opacity: 1 !important; visibility: visible !important; z-index: 3 !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
}
.jma-modal__close:hover { background: #fff !important; }

/* ── Responsive ── */
@media (max-width: 560px) {
  .jma-widget { border-radius: 0; }
  .jma-widget__body { padding: 16px 16px; }
  .jma-widget__header { padding: 15px 18px; }
  .jma-slots { grid-template-columns: repeat(3, 1fr); }
  .jma-step__label { display: none; }
  .jma-widget__header h2 { font-size: 20px; }
  .jma-cal__grid { grid-auto-rows: 28px; }
  .jma-cal__day { width: 26px; height: 26px; }
  .jma-field-row { grid-template-columns: 1fr; }
  .jma-floating-tab { padding: 14px 8px; font-size: 11px; }
  .jma-modal { max-height: 94vh; }
  .jma-modal__close { top: 8px; right: 8px; }
}
