/**
 * PikkuMyy 予約画面スタイル
 * 既存デザイン（emerald + stone）を踏襲
 */

/* ---- リセット・基本 ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;
    --stone-50: #fafaf9;
    --stone-100: #f5f5f4;
    --stone-200: #e7e5e4;
    --stone-300: #d6d3d1;
    --stone-400: #a8a29e;
    --stone-500: #78716c;
    --stone-600: #57534e;
    --stone-700: #44403c;
    --stone-800: #292524;
    --white: #fff;
    --bg-page: #fdfaf7;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--bg-page);
    color: var(--stone-700);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- ヘッダー ---- */
.booking-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    height: 48px;
    width: auto;
}

.header-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--emerald-800);
    font-weight: 700;
}

.back-link {
    color: var(--stone-500);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--emerald-700);
}

/* ---- メイン ---- */
.booking-main {
    flex: 1;
    padding: 24px 16px 40px;
}

.booking-container {
    max-width: 640px;
    margin: 0 auto;
}

/* ---- ステップインジケーター ---- */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--stone-200);
    color: var(--stone-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
}

.step.active .step-num {
    background: var(--emerald-600);
    color: var(--white);
}

.step.completed .step-num {
    background: var(--emerald-700);
    color: var(--white);
}

.step-label {
    font-size: 0.7rem;
    color: var(--stone-400);
    transition: var(--transition);
}

.step.active .step-label {
    color: var(--emerald-700);
    font-weight: 600;
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--stone-200);
    margin: 0 4px;
    margin-bottom: 18px;
}

/* ---- ブッキングステップ ---- */
.booking-step {
    display: none;
}

.booking-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--stone-800);
    text-align: center;
    margin-bottom: 20px;
}

/* ---- メニューカード（選択済み） ---- */
.selected-menu-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 2px solid var(--emerald-600);
    display: flex;
    flex-wrap: wrap;
    /* モバイル対応のため折り返し許可 */
    gap: 20px;
    align-items: flex-start;
}

.menu-image-wrapper {
    flex: 0 0 140px;
    /* 固定幅 */
    width: 140px;
    height: 140px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.menu-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.menu-content-wrapper {
    flex: 1;
    min-width: 200px;
    /* 縮小時の最小幅 */
}

.menu-category-badge {
    display: inline-block;
    background: var(--emerald-800);
    color: var(--white);
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    font-weight: 500;
}

.menu-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--stone-800);
    margin-bottom: 8px;
    line-height: 1.4;
}

.menu-desc {
    font-size: 0.85rem;
    color: var(--stone-500);
    margin-bottom: 12px;
}

.menu-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--emerald-700);
}

.menu-duration {
    font-size: 0.85rem;
    color: var(--stone-500);
}

.change-menu-link {
    text-align: center;
    margin-top: 12px;
}

.change-menu-link a {
    color: var(--stone-400);
    font-size: 0.85rem;
    text-decoration: underline;
}

/* ---- メニュー選択（一覧） ---- */
.menu-category-group {
    margin-bottom: 24px;
}

.category-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--emerald-800);
    padding: 8px 16px;
    background: var(--emerald-800);
    color: var(--white);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.menu-select-card {
    background: var(--white);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    /* 画像高さに合わせる */
    gap: 16px;
    border-bottom: 1px solid var(--stone-100);
    transition: var(--transition);
    cursor: pointer;
}

.menu-card-image {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.menu-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.menu-select-info {
    flex: 1;
    min-width: 0;
    /* flexアイテムの縮小を許可 */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.menu-select-card:hover {
    background: var(--stone-50);
}

.menu-select-card.selected {
    border-left: 3px solid var(--emerald-600);
    background: #ecfdf5;
}

.menu-select-card:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    border-bottom: none;
}

.menu-select-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--stone-700);
    margin-bottom: 4px;
}

.menu-select-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--stone-500);
}

.btn-select {
    background: var(--emerald-700);
    color: var(--white);
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    align-self: center;
    /* 親がstretchなのでボタンだけ中央配置 */
}

.btn-select:hover {
    background: var(--emerald-600);
    transform: translateY(-1px);
}

/* ---- カレンダー ---- */
.calendar-wrapper {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--emerald-800);
    color: var(--white);
}

.cal-month-year {
    font-size: 1.1rem;
    font-weight: 700;
}

.cal-nav-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.cal-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.cal-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px;
    gap: 2px;
}

.cal-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stone-500);
    padding: 8px 0;
}

.cal-weekday:first-child {
    color: #ef4444;
}

.cal-weekday:last-child {
    color: #3b82f6;
}

#cal-days {
    display: contents;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.cal-day:hover:not(.past):not(.closed):not(.empty) {
    background: #ecfdf5;
}

.cal-day.empty {
    cursor: default;
}

.cal-day.past,
.cal-day.closed {
    color: var(--stone-300);
    cursor: not-allowed;
}

.cal-day.closed::after {
    content: '休';
    position: absolute;
    bottom: 2px;
    font-size: 0.5rem;
    color: var(--stone-300);
}

.cal-day.today span {
    font-weight: 700;
    color: var(--emerald-600);
}

.cal-day.selected {
    background: var(--emerald-600);
    color: var(--white);
}

.cal-day.selected span {
    color: var(--white);
    font-weight: 700;
}

.cal-day.sunday:not(.past):not(.closed) span {
    color: #ef4444;
}

.cal-day.saturday:not(.past):not(.closed) span {
    color: #3b82f6;
}

.cal-day.selected.sunday span,
.cal-day.selected.saturday span {
    color: var(--white);
}

.selected-date-label {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--emerald-700);
    margin-bottom: 16px;
}

/* ---- タイムスロット ---- */
.slots-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.slots-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--stone-700);
    margin-bottom: 12px;
}

.slots-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--stone-500);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--stone-200);
    border-top: 3px solid var(--emerald-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.slot-btn {
    padding: 10px 4px;
    border: 2px solid var(--emerald-600);
    background: var(--white);
    color: var(--emerald-700);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.slot-btn.available:hover {
    background: #ecfdf5;
    transform: translateY(-1px);
}

.slot-btn.selected {
    background: var(--emerald-600);
    color: var(--white);
    border-color: var(--emerald-600);
}

.slot-btn.unavailable {
    border-color: var(--stone-200);
    color: var(--stone-300);
    cursor: not-allowed;
    background: var(--stone-50);
}

.slots-empty {
    text-align: center;
    padding: 20px;
    color: var(--stone-400);
    font-size: 0.9rem;
}

/* ---- フォーム ---- */
.reservation-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--stone-700);
    margin-bottom: 6px;
}

.required {
    color: #ef4444;
    font-size: 0.75rem;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--stone-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--stone-700);
    transition: var(--transition);
    background: var(--white);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ---- 確認画面 ---- */
.confirm-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--stone-100);
}

.confirm-row:last-child {
    border-bottom: none;
}

.confirm-label {
    font-size: 0.875rem;
    color: var(--stone-500);
    font-weight: 500;
}

.confirm-value {
    font-size: 0.925rem;
    color: var(--stone-800);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.confirm-card hr {
    border: none;
    border-top: 2px solid var(--emerald-100, #d1fae5);
    margin: 4px 0;
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    border: 1px solid #fecaca;
    white-space: pre-line;
}

/* ---- 完了画面 ---- */
.complete-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 24px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.complete-icon {
    width: 64px;
    height: 64px;
    background: var(--emerald-600);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 16px;
}

.complete-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--emerald-800);
    margin-bottom: 8px;
}

.complete-message {
    color: var(--stone-600);
    margin-bottom: 20px;
}

.complete-details {
    background: var(--stone-50);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    text-align: left;
}

.complete-detail-row {
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--stone-700);
}

.complete-detail-row span {
    font-weight: 600;
    color: var(--emerald-700);
    margin-right: 8px;
}

.complete-notice {
    background: #fffbeb;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--stone-600);
    border: 1px solid #fde68a;
}

.phone-link {
    color: var(--emerald-700);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

/* ---- ボタン ---- */
.btn-primary {
    display: inline-block;
    width: 100%;
    padding: 14px 24px;
    background: var(--emerald-700);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
    background: var(--emerald-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--stone-300);
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    background: var(--white);
    color: var(--stone-600);
    border: 2px solid var(--stone-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--stone-50);
    border-color: var(--stone-300);
}

.btn-submit {
    background: var(--emerald-800);
    font-size: 1.1rem;
}

.btn-submit:hover:not(:disabled) {
    background: var(--emerald-700);
}

.btn-back-home {
    display: inline-block;
    width: auto;
    padding: 12px 32px;
}

.step-nav {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.step-nav .btn-primary {
    flex: 1;
}

/* ---- フッター ---- */
.booking-footer {
    background: var(--stone-800);
    color: var(--white);
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
}

/* ---- レスポンシブ ---- */
@media (max-width: 480px) {
    .header-inner {
        padding: 8px 12px;
    }

    .header-logo {
        height: 36px;
    }

    .header-title {
        font-size: 1rem;
    }

    .back-link {
        font-size: 0.75rem;
    }

    .booking-main {
        padding: 16px 10px 32px;
    }

    .step-label {
        font-size: 0.6rem;
    }

    .step-num {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .step-line {
        width: 24px;
    }

    .slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    }

    .confirm-row {
        flex-direction: column;
        gap: 4px;
    }

    .confirm-value {
        text-align: left;
        max-width: 100%;
    }
}

/* ---- 完了画面アクション ---- */
.complete-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.btn-google-cal {
    background: #fff;
    border: 1px solid #dadce0;
    color: #3c4043;
}

.btn-google-cal:hover {
    background: #f8f9fa;
    border-color: #d2e3fc;
}

.btn-copy {
    background: var(--stone-100);
    color: var(--stone-700);
    border: 1px solid var(--stone-200);
}

.btn-copy:hover {
    background: var(--stone-200);
}

.btn-line {
    background: #06C755;
    color: #fff;
    border: 1px solid #06C755;
    /* LINE Green */
}

.btn-line:hover {
    background: #05b34c;
}

/* Icons (using emoji or simple svg later if needed, for now emoji/text is fine, or simple css shapes) */
.action-icon {
    font-size: 1.1rem;
    line-height: 1;
}

@media (min-width: 481px) {
    .complete-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn-action {
        flex: 1;
        min-width: 140px;
    }
}

/* ---- オプション選択ステップ ---- */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.option-card {
    background: var(--white);
    border: 2px solid var(--stone-200);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.option-card:hover {
    border-color: #f59e0b;
    background: #fffdf7;
}

.option-card.selected {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.option-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--stone-300);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition);
    font-size: 0.8rem;
    color: transparent;
}

.option-card.selected .option-checkbox {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

.option-info {
    flex: 1;
    min-width: 0;
}

.option-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--stone-700);
    margin-bottom: 4px;
    line-height: 1.4;
}

.option-desc {
    font-size: 0.8rem;
    color: var(--stone-500);
    margin-bottom: 6px;
}

.option-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
}

.option-price {
    font-weight: 700;
    color: #92400e;
}

.option-duration {
    color: var(--stone-400);
}

.option-badge-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 1px 7px;
    border-radius: 20px;
    margin-right: 6px;
}

/* オプションサマリー */
.options-summary {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.options-summary-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #92400e;
    margin-bottom: 8px;
}

.options-summary-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    color: #92400e;
    padding-top: 8px;
    border-top: 1px solid #fde68a;
    margin-top: 8px;
}

/* 確認画面のオプション */
.confirm-options {
    background: #fffdf7;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 4px;
}

.confirm-option-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 4px 0;
    color: var(--stone-600);
}

.confirm-total-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 0;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--emerald-800);
    border-top: 2px solid var(--emerald-600);
    margin-top: 4px;
}

@media (max-width: 480px) {
    .step-line {
        width: 16px;
    }

    .step-num {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }

    .step-label {
        font-size: 0.55rem;
    }
}