/* ============================================================
   患者アプリ スタイルシート（モバイルファースト・PWA対応）
   テーマカラー: #94434f（メイン）/ #6c2735（アクセント）
   ============================================================ */

/* CSS変数 */
:root {
    --color-primary:      #94434f;
    --color-primary-dark: #6c2735;
    --color-bg:           #f5f5f5;
    --color-white:        #ffffff;
    --color-text:         #333333;
    --color-text-muted:   #666666;
    --color-border:       #e0e0e0;
    --color-danger:       #dc3545;
    --color-success:      #28a745;
    --radius:             12px;
    --shadow:             0 2px 12px rgba(0,0,0,0.13);
}

/* リセット */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    /* iOSのスクロール慣性 */
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.8;
    /* ノッチ・ホームバー対応 */
    padding-bottom: env(safe-area-inset-bottom);
}

body.has-footer-menu {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

a { color: var(--color-primary); text-decoration: none; }

/* ============================================================
   ログインページ
   ============================================================ */
.login-page {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height（iOS対応） */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--color-primary) 60%, var(--color-primary-dark) 100%);
    padding: 24px 16px env(safe-area-inset-bottom);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-img {
    max-width: 160px;
    height: auto;
}

.login-logo-sub {
    color: #fff;
    font-size: 13px;
    margin: 8px 0 0;
}

.login-card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

.login-contact {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 20px 0 0;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    padding-top: env(safe-area-inset-top);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

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

.header-logout {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    transition: background 0.15s;
}

.header-logout:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ロゴ + Betaバッジのラッパー */
.header-logo-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ハンバーガーボタン */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: background 0.15s;
}

.hamburger-btn:hover span { background: #fff; }

/* メニュー外クリック用オーバーレイ */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
}

.nav-overlay.open { display: block; }

/* ドロップダウンメニュー */
.nav-menu {
    position: fixed;
    top: 56px;
    right: 0;
    width: 200px;
    background: var(--color-white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 0 0 0 12px;
    overflow: hidden;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s, transform 0.18s;
}

.nav-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: var(--color-text);
    font-size: 16px;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.12s;
}

.nav-menu a:last-child { border-bottom: none; }

.nav-menu a:hover { background: #f9f0f1; }

.nav-menu a i,
.nav-menu a svg {
    color: var(--color-primary);
    width: 16px;
    height: 16px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.header-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    font-size: 14px;
    padding: 6px 4px;
}

.header-back svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.header-back:hover { color: #fff; }

.header-title {
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    /* 左右の要素の幅に関わらず常に中央に固定する */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none; /* クリックを下の要素に通す */
}

/* ============================================================
   セクション見出し（カード外で使う見出し・黒・カード見出しと余白統一）
   ============================================================ */
.section-heading {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 16px;
}

/* ============================================================
   通知設定ページ
   ============================================================ */
.settings-section {
    margin-bottom: 12px;
}

.settings-section-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
    padding: 0 4px;
}

/* ラジオ選択肢カード */
.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.radio-card input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--color-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.radio-card.selected {
    border-color: var(--color-primary);
    background: #fdf5f5;
}

.radio-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-label-main {
    font-size: 16px;
    font-weight: bold;
    color: var(--color-text);
}

.radio-label-sub {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ============================================================
   お知らせカード
   ============================================================ */
.notice-card {
    background: #fdf8f8;
}

.card-body {
    font-size: 16px;
    color: #333;
    line-height: 1.8;
    margin: 0 0 2em;
}

.card-body-last {
    margin-bottom: 0;
}

/* お知らせカード内の箇条書き */
.notice-list {
    font-size: 16px;
    color: #333;
    line-height: 1.8;
    margin-bottom: 2em;
    padding-left: 1.5em;
    list-style-type: disc;
}

.notice-list li {
    margin-bottom: 0.4em;
}

/* 保存完了メッセージ */
.alert-success {
    background: #f0faf2;
    color: #1e7e34;
    border: 1px solid #c3e6cb;
}

.alert svg {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

/* ============================================================
   メインコンテンツエリア
   ============================================================ */
.app-main {
    padding: 20px 16px 32px;
    max-width: 600px;
    margin: 0 auto;
}

/* あいさつ文 */
.greeting {
    font-size: 22px;
    color: var(--color-text);
    margin: 0 0 16px;
}

/* ============================================================
   カード
   ============================================================ */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card-title {
    font-weight: 500;
    font-size: 18px;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.card-note {
    font-size: 14px;
    color: var(--color-text);
    margin: 16px 0 0;
    line-height: 1.6;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
}

/* ============================================================
   次回予約カード
   ============================================================ */
.appt-date {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-text);
    line-height: 1.4;
}

.appt-more {
    margin-top: 10px;
    font-size: 14px;
}

.appt-more a {
    color: var(--color-primary);
    font-weight: bold;
}

.empty-msg {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 14px;
}

/* ============================================================
   予約一覧ページ
   ============================================================ */
.appt-card {
    position: relative;
}

.appt-card-next {
    border-left: 4px solid var(--color-primary);
}

.appt-badge {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    letter-spacing: 0.05em;
}

.list-note {
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 24px;
    line-height: 1.7;
}

/* ============================================================
   回数券カード
   ============================================================ */
.ticket-row {
    padding: 4px 0;
}

.ticket-row + .ticket-row {
    border-top: 1px solid var(--color-border);
    margin-top: 16px;
    padding-top: 16px;
}

.ticket-progress-wrap {
    margin-bottom: 8px;
}

.ticket-count {
    font-size: 28px;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 10px;
}

.ticket-used {
    color: var(--color-primary);
    font-size: 36px;
}

.ticket-sep {
    color: var(--color-text-muted);
    font-size: 24px;
}

.ticket-total {
    color: var(--color-text-muted);
    font-size: 24px;
}

.ticket-unit {
    font-size: 16px;
    color: var(--color-text-muted);
    margin-left: 4px;
}

/* プログレスバー */
.progress-bar-wrap {
    height: 8px;
    background: #f0e8e9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.ticket-expiry {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 6px;
}

/* ============================================================
   フォーム部品
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 16px; /* iOSズームを防ぐため16px */
    color: var(--color-text);
    background: var(--color-white);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(148, 67, 79, 0.15);
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, opacity 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-primary:active {
    opacity: 0.85;
}

.btn-block {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* ============================================================
   アラート
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.alert-danger {
    background: #fdf2f2;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

/* ============================================================
   プッシュ通知許可バナー
   ============================================================ */
.push-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--color-primary);
    color: #fff;
    padding: 16px;
    text-align: center;
}

.push-banner-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.push-banner-text svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.push-banner-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.6);
    padding: 8px 20px;
    font-size: 14px;
    border-radius: 20px;
}

.push-banner-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* ============================================================
   患者アプリ フッターメニュー
   相談・紹介の導線を画面下に固定表示する
   ============================================================ */
.app-footer-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 18px rgba(0,0,0,0.08);
    padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    gap: 6px;
}

.footer-menu-item {
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--color-primary);
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.35;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.footer-menu-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.9;
    flex-shrink: 0;
}
