/*
 * Calendar styles: public booking portal and the admin Slot Calendar
 * Author: RaKiBuL HaSaN - CEO & Founder, The One Stop BD (theonestopbd.com)
 * Developer Phone: +8801752986368 | Developer Email: rhs.rakibul@gmail.com
 */

/* ---------- Portal page ---------- */
.portal-body { background: #f1f3f7; }
.portal-top { background: #fff; border-bottom: 3px solid var(--brand); padding: 12px 20px; }
.portal-brand { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px; font-size: 17px; }
.portal { max-width: 1200px; margin: 0 auto; padding: 26px 16px 40px; min-height: 70vh; }
.portal-hero { text-align: center; margin-bottom: 22px; }
.portal-hero h1 { font-size: 30px; margin-bottom: 8px; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 16px 30px; line-height: 1.8; }
.portal-foot a { color: inherit; text-decoration: none; }
.manage-card { max-width: 620px; margin: 0 auto; }
.appt-card { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; }
.portal h2 { margin-top: 26px; }

/* ---------- Calendar cards (one per location) ---------- */
.cal-cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); align-items: start; }
.cal-card { padding: 20px; }
.cal-card h2 { text-align: center; font-size: 20px; margin: 0 0 2px; }
.cal-card .sub { text-align: center; color: var(--muted); margin-bottom: 12px; font-size: 13px; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 12px; font-weight: 700; }
.cal-nav button { border: 0; background: none; font-size: 22px; cursor: pointer; padding: 2px 10px; border-radius: 8px; color: var(--text); }
.cal-nav button:hover:not(:disabled) { background: var(--bg); }
.cal-nav button:disabled { color: #cbd1db; cursor: default; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; }
.cal-day { aspect-ratio: 1 / 0.92; display: grid; place-items: center; border: 0; border-radius: 9px; font: inherit; font-size: 14px; background: #fecaca; color: #fff; cursor: default; padding: 0; position: relative; }
.cal-day.blank { background: transparent; }
.cal-day.free { background: #22c55e; color: #fff; font-weight: 800; cursor: pointer; transition: transform .1s, filter .15s; }
.cal-day.free:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cal-day.free.sel { outline: 3px solid #14532d; outline-offset: 1px; }
.cal-legend { display: flex; gap: 16px; justify-content: center; font-size: 12.5px; color: var(--muted); margin-top: 14px; }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }

/* Times of the chosen day */
.cal-times { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.cal-times h3 { margin: 0 0 10px; font-size: 14px; }
.slot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.slot-btn { border: 0; border-radius: 9px; padding: 9px 4px; font: inherit; font-weight: 700; font-size: 13.5px; background: #22c55e; color: #fff; cursor: pointer; transition: filter .15s; }
.slot-btn:hover { filter: brightness(1.08); }
.slot-btn.taken { background: #fecaca; color: #991b1b; cursor: not-allowed; font-weight: 600; }
.slot-btn small { display: block; font-weight: 500; opacity: .85; font-size: 11px; }

/* ---------- Booking pop-up ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 50; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 520px; position: relative; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); max-height: 94vh; overflow-y: auto; }
.modal-box h2 { margin: 0 0 4px; }
.modal-close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 28px; cursor: pointer; color: var(--muted); }
.modal-sum { background: #ecfdf3; color: #14532d; border-radius: 10px; padding: 10px 14px; font-weight: 600; margin: 8px 0 4px; }

/* ---------- Admin Slot Calendar ---------- */
.adm-cal { max-width: 520px; }
.adm-cal .cal-grid { gap: 5px; }
.adm-cal a.cal-day { text-decoration: none; background: #f1f3f7; color: var(--muted); text-align: center; align-content: center; line-height: 1.15; }
.adm-cal a.cal-day small { display: block; font-size: 10.5px; font-weight: 600; opacity: .9; }
.adm-cal a.cal-day.free { background: #22c55e; color: #fff; }
.adm-cal a.cal-day.full { background: #fecaca; color: #991b1b; }
.adm-cal a.cal-day.sel { outline: 3px solid var(--brand); outline-offset: 1px; }
.adm-cal a.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.adm-layout { display: grid; gap: 20px; grid-template-columns: minmax(300px, 520px) 1fr; align-items: start; }
.slot-row-booked { background: #fff1f2; }
details.walkin summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 12.5px; }
details.walkin form { margin-top: 8px; min-width: 230px; }
details.walkin input { margin-bottom: 6px; }
fieldset.gen { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; margin: 12px 0; }
fieldset.gen legend { font-weight: 700; padding: 0 6px; font-size: 13px; }

@media (max-width: 900px) {
  .adm-layout { grid-template-columns: 1fr; }
  .portal-hero h1 { font-size: 24px; }
}

.change-box { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.change-box summary { cursor: pointer; font-weight: 600; color: var(--brand); }

.notify-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.notify-box .chk { display: inline-block; margin: 0 14px 6px 0; font-weight: 500; }
.notify-box textarea { margin-top: 4px; }

/* ---------- Phone layout of the Slot Calendar (no sideways scrolling, the Walk-in form fits) ---------- */
.adm-layout > * { min-width: 0; }
.adm-cal { width: 100%; }
@media (max-width: 900px) { .adm-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  table.slot-table, table.slot-table tbody, table.slot-table tr, table.slot-table td { display: block; width: 100%; }
  table.slot-table tr:first-child { display: none; }
  table.slot-table tr { border-bottom: 8px solid var(--bg); padding: 6px 4px; }
  table.slot-table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 12px; text-align: right; }
  table.slot-table td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: left; flex: 0 0 70px; }
  table.slot-table td.slot-actions { display: block; text-align: left; }
  table.slot-table td.slot-actions::before { display: none; }
  details.walkin form { min-width: 0; width: 100%; }
  details.walkin input, details.walkin button { width: 100%; }
  .adm-cal .cal-grid { gap: 3px; } .adm-cal a.cal-day small { font-size: 9px; }
}
@media (max-width: 700px) { details.walkin form { display: block; } details.walkin input { display: block; width: 100%; margin-bottom: 8px; } details.walkin button { display: block; width: 100%; } }

/* ---------- Phone layout of the client pages (book.php, client login, client portal, booking page) ---------- */
.cal-cards { grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); }
@media (max-width: 700px) {
  .portal-body { font-size: 16px; }
  .portal { padding-left: 12px; padding-right: 12px; }
  .portal-body input, .portal-body select, .portal-body textarea { font-size: 16px; min-height: 46px; }   /* 16 px: phones do not zoom into the field */
  .portal-body textarea { min-height: 96px; }
  .portal-body .btn { min-height: 46px; padding-top: 11px; padding-bottom: 11px; font-size: 16px; }
  .portal-body .btn.sm { min-height: 42px; font-size: 15px; }
  .portal-body a { padding-top: 2px; padding-bottom: 2px; }
  .portal-body .portal-hero h1 { font-size: 24px; }
  .portal-body .portal-hero .btn, .portal-body .portal-hero form.inline { display: block; width: 100%; margin: 8px 0 0; text-align: center; }
  .portal-body .portal-hero form.inline .btn { width: 100%; }
  .portal-body h2 { font-size: 19px; }
  .portal-body .card { padding: 16px 14px; }
  .cal-card { padding: 16px 10px; }
  .cal-card .cal-grid { gap: 4px; }
  .cal-day { font-size: 15px; }
  .slot-list { grid-template-columns: repeat(2, 1fr); }
  .slot-btn { padding: 13px 4px; font-size: 15.5px; }
  .modal { padding: 0; align-items: start; }
  .modal-box { border-radius: 0; max-width: none; min-height: 100vh; max-height: none; padding: 18px 16px 28px; }
  .modal-close { right: 6px; top: 2px; font-size: 34px; padding: 6px 12px; }
  .appt-card { display: block; }
  .appt-card form, .appt-card .btn { width: 100%; }
  .appt-card form .btn { width: 100%; margin-top: 8px; }
  .change-box summary { padding: 12px 0; font-size: 16px; }
  .bub { max-width: 92%; }
  .chat { max-height: 55vh; }
  .portal-body .table-wrap { overflow-x: auto; }
  .portal-body .manage-card table th { width: auto; display: block; border: 0; padding-bottom: 0; }
  .portal-body .manage-card table td { display: block; padding-top: 2px; }
  .portal-foot, .portal-body footer { font-size: 13px; line-height: 1.6; padding: 14px 12px 26px; }
}
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.portal-call { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; text-decoration: none; color: var(--brand); background: #fff; }
@media (max-width: 700px) { .portal-call { padding: 10px 14px; } .portal-brand b { font-size: 15px; } }

@media (max-width: 700px) { .portal-body p a:not(.btn) { display: inline-block; padding: 10px 4px; } .portal-call { min-height: 42px; display: inline-flex; align-items: center; } }

@media (max-width: 700px) { .portal-body .manage-card th { background: transparent; } .portal-body .manage-card table { width: 100%; } .portal-body .manage-card form .btn { width: 100%; } .portal-body .manage-card form .muted { display: block; margin-top: 8px; } }

/* Wide screens (PC): the client pages are wider and bigger, the two calendars side by side and easy to read */
@media (min-width: 900px) {
  .portal-brand, .portal { max-width: 1180px; }
  .portal-body { font-size: 17px; }
  .portal-hero h1 { font-size: 34px; margin-bottom: 10px; }
  .portal-hero p, .portal-hero .muted { font-size: 17px; }
  .portal-hero { margin-bottom: 24px; }
  .cal-cards { grid-template-columns: repeat(auto-fit, minmax(420px, 540px)); justify-content: center; gap: 28px; }
  .cal-card { padding: 26px 30px; }
  .cal-card h2 { font-size: 24px; }
  .cal-card .sub { font-size: 15px; }
  .portal .cal-day { aspect-ratio: auto; height: 58px; font-size: 18px; border-radius: 12px; }
  .portal .cal-grid { gap: 9px; }
  .portal .cal-dow, .portal .cal-head span { font-size: 14px; }
  .portal .slot-list { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .portal .slot-btn { padding: 13px 8px; font-size: 16px; }
  .portal .card { max-width: 900px; margin-left: auto; margin-right: auto; }
  .portal .cal-cards .card, .portal .cal-cards .cal-card { max-width: none; width: 100%; margin: 0; }      /* auto margins would shrink the card to its content inside the grid */
  .portal-body .btn { font-size: 16px; padding: 11px 20px; }
  .portal-body input, .portal-body select, .portal-body textarea { font-size: 16px; }
  .portal-call { font-size: 16px; padding: 10px 18px; }
}

/* language pop-up and switch, Call + WhatsApp buttons of the public pages */
.lang-pop { position: fixed; inset: 0; background: rgba(15, 23, 42, .62); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lang-box { background: #fff; border-radius: 16px; padding: 26px 22px; width: min(380px, 100%); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.lang-box h2 { margin: 0 0 16px; font-size: 22px; } .lang-box h2 span { font-size: 15px; font-weight: 500; color: #475569; }
.lang-btn { display: block; margin: 10px 0 0; padding: 14px; border-radius: 12px; background: var(--brand, #1f4e9c); color: #fff; font-size: 20px; font-weight: 700; text-decoration: none; }
.lang-switch { text-align: right; margin: 0 0 6px; font-size: 14px; } .lang-switch a { color: var(--brand, #1f4e9c); text-decoration: none; padding: 0 4px; } .lang-switch a.on { font-weight: 800; text-decoration: underline; }
.portal-calls { display: inline-flex; gap: 8px; align-items: center; } .portal-call.wa { color: #15803d; border-color: #86efac; }
@media (max-width: 480px) { .portal-calls { gap: 5px; } .portal-call { padding: 8px 10px; font-size: 13px; } }

.mode-pick { display: grid; gap: 6px; margin: 4px 0; } .mode-pick label { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line, #d1d5db); border-radius: 10px; font-weight: 600; cursor: pointer; } .mode-pick input { width: auto; min-height: 0; }
