/* Mimamori Reservation front-end. Mobile-first. */

/* Reservation-page overrides: hide theme chrome and widen the content column
   when the shortcode is present. `.mmr-booking-page` is added by the
   shortcode class via the body_class filter. */
body.mmr-booking-page > .wp-site-blocks > header,
body.mmr-booking-page > .wp-site-blocks > footer,
body.mmr-booking-page .wp-block-template-part[data-wp-block-name="header"],
body.mmr-booking-page .wp-block-template-part[data-wp-block-name="footer"] {
    display: none !important;
}
body.mmr-booking-page {
    /* Override Twenty Twenty-Five's content/wide size variables so the main
       column grows ~1.5x. Consumers that read these vars (layout-constrained
       blocks) will reflow. */
    --wp--style--global--content-size: 1200px;
    --wp--style--global--wide-size: 1500px;
}
body.mmr-booking-page .wp-block-post-title {
    font-size: 1.75rem;
    line-height: 1.3;
}


.mmr-app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
    color: #1d2327;
    line-height: 1.6;
}

.mmr-app * { box-sizing: border-box; }

.mmr-step-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2271b1;
    color: #1d2327;
}

/* 見出し直下の補足一行（予約可能な期間の案内など）。 */
.mmr-step-note {
    margin: -0.5rem 0 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #646970;
}

.mmr-loading,
.mmr-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #646970;
}

.mmr-back {
    background: none;
    border: none;
    color: #2271b1;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.mmr-back:hover { text-decoration: underline; }

/* Advisor cards */
.mmr-advisors {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 640px) {
    .mmr-advisors { grid-template-columns: 1fr 1fr; }
}

.mmr-advisor-card {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.25rem;
    border: 1px solid #dcdcde;
    background: #fff;
    border-radius: 8px;
    text-align: left;
    transition: border-color 0.15s;
}
.mmr-advisor-card:hover { border-color: #c3c4c7; }
.mmr-advisor-img {
    width: 144px;
    height: 144px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.mmr-advisor-body { flex: 1; min-width: 0; }
.mmr-advisor-name {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.mmr-advisor-name-primary { font-size: inherit; }
.mmr-advisor-name-reading {
    font-size: 0.85rem;
    font-weight: 400;
    color: #646970;
    letter-spacing: 0.02em;
}
.mmr-advisor-profile {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #50575e;
    line-height: 1.65;
}
.mmr-advisor-profile > *:first-child { margin-top: 0; }
.mmr-advisor-profile > *:last-child  { margin-bottom: 0; }
.mmr-advisor-profile p  { margin: 0 0 0.6rem; }
.mmr-advisor-profile ul,
.mmr-advisor-profile ol { margin: 0 0 0.6rem 1.25rem; }
/* 面談場所。プロフィールとボタンの間に控えめに置く */
.mmr-advisor-location {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #50575e;
    line-height: 1.6;
}
.mmr-advisor-location-label {
    flex-shrink: 0;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    background: #f0f0f1;
    font-size: 0.75rem;
    color: #646970;
    letter-spacing: 0.04em;
}
.mmr-advisor-location-value { min-width: 0; }
.mmr-advisor-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.mmr-advisor-actions .mmr-button {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}
/* 予約ボタンのラベルは画面幅で長短を切り替える。既定（PC）は長い方。 */
.mmr-label--narrow { display: none; }

/* Advisor grid switches to single column when photo size would crowd out
   the profile text. */
@media (max-width: 720px) {
    .mmr-advisor-img { width: 96px; height: 96px; }
    .mmr-advisor-card { gap: 1rem; padding: 1rem; }
    /* スマホでは「詳細を見る」と「予約する」を1行に並べる。テーマ側が
       button を全幅にしていても崩れないよう flex-basis を明示する。 */
    .mmr-advisor-actions { flex-wrap: nowrap; }
    .mmr-advisor-actions .mmr-button {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 0.4rem 0.6rem;
    }
    .mmr-label--wide { display: none; }
    .mmr-label--narrow { display: inline; }
}

/* Standalone advisor card (shown above the calendar on the pickSlot screen)
   needs its own bottom margin — inside the .mmr-advisors grid, gap handles it. */
.mmr-screen > .mmr-advisor-card { margin-bottom: 1rem; }

/* 詳細を見る modal */
.mmr-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 28, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9999;
}
.mmr-modal-card {
    background: #fff;
    border-radius: 8px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.mmr-modal-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #e5e5e6;
}
.mmr-modal-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.mmr-modal-name {
    flex: 1;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.mmr-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #646970;
    padding: 0.25rem 0.5rem;
}
.mmr-modal-close:hover { color: #1d2327; }
.mmr-modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.65;
    color: #1d2327;
}
.mmr-modal-body p    { margin: 0 0 0.6rem; }
.mmr-modal-body ul,
.mmr-modal-body ol   { margin: 0 0 0.6rem 1.25rem; }
.mmr-modal-body ul li,
.mmr-modal-body ol li { margin-bottom: 0.15rem; }
.mmr-modal-body h1   { font-size: 1.05rem; margin: 1rem 0 0.35rem; font-weight: 700; }
.mmr-modal-body h2   { font-size: 1rem;   margin: 1rem 0 0.35rem; font-weight: 700; }
.mmr-modal-body h3   { font-size: 0.95rem; margin: 0.9rem 0 0.3rem; font-weight: 700; }
.mmr-modal-body h4   { font-size: 0.9rem; margin: 0.8rem 0 0.3rem; font-weight: 700; }
.mmr-modal-body h1:first-child,
.mmr-modal-body h2:first-child,
.mmr-modal-body h3:first-child,
.mmr-modal-body h4:first-child { margin-top: 0; }
.mmr-modal-body strong { font-weight: 700; }
.mmr-modal-body a    { color: #2271b1; }
.mmr-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid #e5e5e6;
    background: #fafafb;
}
.mmr-modal-foot .mmr-button {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Week grid picker */
.mmr-week-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mmr-week-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mmr-week-nav-btn {
    width: 2rem;
    height: 2rem;
    border: 1px solid #dcdcde;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #1d2327;
}
.mmr-week-nav-btn:hover:not([disabled]) {
    border-color: #2271b1;
    color: #2271b1;
}
.mmr-week-nav-btn[disabled] {
    cursor: not-allowed;
    color: #c3c4c7;
}
.mmr-week-range {
    font-size: 0.95rem;
    font-weight: 500;
    min-width: 14rem;
    text-align: center;
}

.mmr-legend {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
}
.mmr-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #50575e;
}
.mmr-legend-item::before {
    content: '';
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.8;
}
.mmr-legend-open  { color: #2271b1; }
.mmr-legend-taken { color: #8c8f94; }
.mmr-legend-full  { color: #b32d2e; }

/* Week/Month view toggle — segmented button group */
.mmr-view-toggle {
    display: inline-flex;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    overflow: hidden;
    margin-left: auto; /* push to far right inside .mmr-week-header */
}
.mmr-view-toggle-btn {
    background: #fff;
    border: none;
    padding: 0.4rem 0.9rem;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    color: #50575e;
}
.mmr-view-toggle-btn + .mmr-view-toggle-btn { border-left: 1px solid #dcdcde; }
.mmr-view-toggle-btn:hover { background: #f6f7f7; }
.mmr-view-toggle-btn--active {
    background: #1d2327;
    color: #fff;
}
.mmr-view-toggle-btn--active:hover { background: #1d2327; }

/* Month grid */
.mmr-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid #dcdcde;
    border-left: 1px solid #dcdcde;
    font-size: 0.85rem;
}
.mmr-month-dow {
    padding: 0.5rem 0.25rem;
    text-align: center;
    background: #f6f7f7;
    border-right: 1px solid #dcdcde;
    border-bottom: 1px solid #dcdcde;
    font-weight: 600;
    color: #1d2327;
}
.mmr-month-dow--0 { color: #b32d2e; }  /* 日 */
.mmr-month-dow--6 { color: #2271b1; }  /* 土 */

.mmr-month-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 5rem;
    padding: 0.4rem 0.3rem 0.6rem;
    background: #fff;
    border: none;
    border-right: 1px solid #dcdcde;
    border-bottom: 1px solid #dcdcde;
    font: inherit;
    color: inherit;
    cursor: default;
    text-align: center;
    gap: 0.25rem;
}
button.mmr-month-cell:not([disabled]) { cursor: pointer; }
button.mmr-month-cell:not([disabled]):hover {
    background: #f0f6fc;
    box-shadow: inset 0 0 0 2px #2271b1;
}
.mmr-month-cell--muted { background: #fafafb; color: #c3c4c7; }
.mmr-month-cell--past  { color: #c3c4c7; }
.mmr-month-cell--today .mmr-month-day-num {
    background: #1d2327;
    color: #fff;
    border-radius: 999px;
    padding: 0 0.4rem;
    min-width: 1.5rem;
    display: inline-block;
}

.mmr-month-day-num {
    font-size: 0.85rem;
    font-weight: 500;
}
.mmr-month-indicator {
    font-size: 1.15rem;
    line-height: 1;
    font-weight: 700;
}
.mmr-month-indicator--open  { color: #2271b1; }
.mmr-month-indicator--taken {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: #b32d2e;
}
.mmr-month-status {
    font-size: 0.95rem;
    line-height: 1.2;
    font-weight: 700;
}
.mmr-month-inspect-btn {
    margin: 0;
    padding: 0.25rem 0.45rem;
    border: 1px solid transparent;
    border-radius: 3px;
    background: #e9eaec;
    color: #3c434a;
    font: inherit;
    font-size: 0.7rem;
    line-height: 1.2;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.mmr-month-inspect-btn:hover,
.mmr-month-inspect-btn:focus-visible {
    background: #dcdcde;
    color: #1d2327;
}
.mmr-month-inspect-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}
.mmr-month-indicator--none  { color: #dcdcde; font-weight: 400; }

.mmr-full-day-notice {
    margin: 0 0 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid #b32d2e;
    background: #fcf0f1;
    color: #7a1f21;
    font-size: 0.875rem;
    line-height: 1.7;
}

.mmr-week-grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mmr-week-grid {
    display: grid;
    grid-template-columns: 3rem repeat(7, minmax(5rem, 1fr));
    width: 100%;
    min-width: 600px; /* below this, horizontal scroll kicks in */
    border-top: 1px solid #dcdcde;
    border-left: 1px solid #dcdcde;
    font-size: 0.8rem;
}

.mmr-week-corner {
    background: #f6f7f7;
    border-right: 1px solid #dcdcde;
    border-bottom: 1px solid #dcdcde;
}
.mmr-week-day-head {
    background: #f6f7f7;
    border-right: 1px solid #dcdcde;
    border-bottom: 1px solid #dcdcde;
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-weight: 600;
    color: #1d2327;
}
.mmr-week-day-head--today {
    background: #1d2327;
    color: #fff;
}

.mmr-week-time {
    padding-right: 0.35rem;
    padding-top: 0.15rem;
    font-size: 0.75rem;
    color: #646970;
    text-align: right;
    border-right: 1px solid #dcdcde;
}

/* Day column gridlines: pale line at the half-hour, stronger at the hour.
   Pattern period is 3rem = two 1.5rem rows (one hour). */
.mmr-week-col-bg {
    border-right: 1px solid #dcdcde;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(1.5rem - 1px),
        #f3f4f5 calc(1.5rem - 1px),
        #f3f4f5 1.5rem,
        transparent 1.5rem,
        transparent calc(3rem - 1px),
        #dcdcde calc(3rem - 1px),
        #dcdcde 3rem
    );
}

.mmr-slot-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.15rem;
    margin: 1px;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    font-size: 0.78rem;
    line-height: 1.2;
    text-align: left;
    font: inherit;
    font-size: 0.78rem;
    overflow: hidden;
    min-width: 0;
}
.mmr-slot-tile-time {
    font-weight: 600;
    font-size: 0.8rem;
}
.mmr-slot-tile-label {
    opacity: 0.9;
    font-size: 0.7rem;
}

.mmr-slot-tile--open {
    background: #e6f2fa;
    border: 1px solid #a7d0ec;
    color: #135e96;
    cursor: pointer;
}
.mmr-slot-tile--open:hover {
    background: #2271b1;
    border-color: #135e96;
    color: #fff;
}

.mmr-slot-tile--taken {
    background: #f0f0f1;
    border: 1px solid #dcdcde;
    color: #646970;
    cursor: not-allowed;
}

.mmr-slot-tile--full {
    background: #fcf0f1;
    border: 1px solid #e6acad;
    color: #b32d2e;
    cursor: not-allowed;
}

/* Form */
.mmr-form { display: flex; flex-direction: column; gap: 0.85rem; }
.mmr-summary {
    padding: 0.6rem 0.85rem;
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}
.mmr-field { display: flex; flex-direction: column; gap: 0.25rem; }
.mmr-label { font-size: 0.8rem; font-weight: 500; color: #1d2327; }
/* 必須項目の見出しに添えるバッジ。文字で示すので色だけに頼らずに済む。 */
.mmr-req {
    display: inline-block;
    margin-left: 0.4em;
    padding: 0.1em 0.45em;
    border-radius: 3px;
    background: #b32d2e;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.02em;
    vertical-align: middle;
}
.mmr-input {
    padding: 0.4rem 0.65rem;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font: inherit;
    font-size: 0.85rem;
    background: #fff;
    color: inherit;
    width: 100%;
}
.mmr-input:focus {
    outline: 2px solid #2271b1;
    outline-offset: 0;
    border-color: #2271b1;
}
.mmr-input--error { border-color: #b32d2e; background: #fcf0f1; }
.mmr-field-error {
    margin: 0;
    font-size: 0.75rem;
    color: #b32d2e;
}
/* 入力欄の下に添える補足（入力形式など）。エラーより弱い見た目にする。 */
.mmr-field-hint {
    margin: 0;
    font-size: 0.75rem;
    color: #646970;
}

textarea.mmr-input { resize: vertical; min-height: 84px; }

/* 同意チェックの上に置く説明文。読ませたい本文なので行間は広めに。 */
.mmr-consent-note {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.8;
}
.mmr-consent-note-text,
.mmr-consent-note-link {
    margin: 0;
}

.mmr-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: #f6f7f7;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.mmr-consent--error { background: #fcf0f1; color: #b32d2e; }

.mmr-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Reservation confirmation */
.mmr-confirm-lead {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #50575e;
}
.mmr-confirm-list {
    margin: 1rem 0;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.mmr-confirm-row {
    display: grid;
    grid-template-columns: minmax(9rem, 28%) 1fr;
    margin: 0;
    border-bottom: 1px solid #dcdcde;
}
.mmr-confirm-row:last-child { border-bottom: none; }
.mmr-confirm-label,
.mmr-confirm-value {
    margin: 0;
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
}
.mmr-confirm-label {
    background: #f6f7f7;
    font-weight: 600;
}
.mmr-confirm-value {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.mmr-confirm-note {
    margin: 1rem 0 0;
    color: #646970;
    font-size: 0.8rem;
}

@media (max-width: 540px) {
    .mmr-month-status { font-size: 0.8rem; }
    .mmr-month-inspect-btn {
        padding: 0.2rem 0.25rem;
        font-size: 0.62rem;
        white-space: normal;
    }
    .mmr-confirm-row { grid-template-columns: 1fr; }
    .mmr-confirm-label { padding-bottom: 0.35rem; }
    .mmr-confirm-value { padding-top: 0.35rem; }
    .mmr-form-actions { flex-direction: column; }
    .mmr-form-actions .mmr-button { width: 100%; }
}
.mmr-button {
    padding: 0.45rem 1rem;
    border: 1px solid #2271b1;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
}
.mmr-button--primary {
    background: #2271b1;
    color: #fff;
    flex: 1;
}
.mmr-button--primary:hover { background: #135e96; border-color: #135e96; }
.mmr-button--secondary {
    background: #fff;
    color: #2271b1;
}
.mmr-button--secondary:hover { background: #f0f6fc; }

/* Done */
.mmr-done { padding: 1.5rem; background: #edfaef; border-left: 4px solid #00a32a; border-radius: 4px; }
.mmr-done .mmr-step-title { color: #00a32a; border-bottom-color: #00a32a; }
.mmr-done a { color: #2271b1; word-break: break-all; }

/* Error */
.mmr-error { padding: 1.5rem; background: #fcf0f1; border-left: 4px solid #b32d2e; border-radius: 4px; }
.mmr-error p { color: #b32d2e; margin-top: 0; }

/* Cancel flow */
.mmr-cancel-confirm {
    padding: 1.5rem;
    background: #fff8e5;
    border-left: 4px solid #dba617;
    border-radius: 4px;
}
.mmr-cancel-confirm .mmr-step-title {
    color: #996800;
    border-bottom-color: #dba617;
}
.mmr-cancel-confirm .mmr-summary {
    background: #fff;
    border-left-color: #dba617;
}
.mmr-cancel-confirm .mmr-summary p { margin: 0.25rem 0; }
.mmr-warning {
    color: #996800;
    font-size: 0.875rem;
    margin: 0.75rem 0 1rem;
}
.mmr-button--danger {
    background: #b32d2e;
    color: #fff;
    border-color: #b32d2e;
    flex: 1;
}
.mmr-button--danger:hover { background: #952123; border-color: #952123; }

/* Honeypot: never visible to humans (screen readers + keyboard can reach
   disabled tabindex=-1 input, but hidden from mouse/touch users). */
.mmr-hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    pointer-events: none !important;
}
