/**
 * 仮)会員機能：公開画面用CSS
 * 共通フォームスタイル（common-form.css）を使用
 */

/* === メッセージ表示 === */
.barom-member-message {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    border-left: 4px solid;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 成功メッセージ */
.barom-member-message.is-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* エラーメッセージ */
.barom-member-message.is-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* 情報メッセージ */
.barom-member-message.is-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* 警告メッセージ */
.barom-member-message.is-warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

/* === ページ全体の余白を削除 === */
.page-template-default.page .l-mainContent__inner {
    max-width: 100%;
    padding: 0;
}

body.page-id-member .l-article {
    padding: 2rem 1rem;
}

/* === マイページ === */
.barom-my-page {
    max-width: 800px;
    margin: 0 auto;
}

/* ヘッダー - ウェルカムメッセージとログアウト */
.my-page-header {
    margin-bottom: 1.5em;
}

.member-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
    padding: 1em 0;
}

.welcome-text {
    margin: 0;
    font-size: 1.2em;
    font-weight: 500;
}

.member-name {
    font-weight: bold;
    color: #667eea;
}

.logout-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9em;
    padding: 0.5em 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.logout-link:hover {
    color: #fff;
    background: #dc3545;
    border-color: #dc3545;
}

/* ポイントサマリー - 上部に大きく表示 */
.points-summary {
    margin-bottom: 1.5em;
}

.points-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2em;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.points-balance {
    margin-bottom: 0.5em;
}

.points-number {
    font-size: clamp(2.5em, 5vw, 3.5em);
    font-weight: bold;
    line-height: 1;
    word-break: keep-all;
    white-space: nowrap;
}

.points-unit {
    font-size: 1.5em;
    margin-left: 0.3em;
    opacity: 0.9;
}

.points-breakdown {
    margin-top: 0.5rem;
    font-size: 0.9em;
}

.pending-points {
    margin: 0;
    color: #333;
    font-weight: 500;
}

.pending-points span {
    color: #f39c12;
    font-weight: 600;
    margin-left: 0.3em;
}

.monthly-visits {
    margin: 0;
    font-size: 1em;
    opacity: 0.9;
}

/* QRスキャンメインセクション - 最も重要な機能 */
.qr-scan-main {
    margin-bottom: 2em;
}

.qr-scan-button {
    display: block;
    width: 100%;
    padding: 1.5em;
    font-size: 1.3em;
    font-weight: bold;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.qr-scan-button:hover {
    background: #5568d3;
}

/* タブナビゲーション - 会員ページ */
/* 基本スタイルは common-tabs.css から継承 */
/* 会員ページ専用のカスタマイズ */

/* タブコンテナをより暗く、境界を明確に */
.barom-my-page .hapb-tabs {
    background: #1e2022; /* さらに暗いグレー */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 2px 6px rgba(0, 0, 0, 0.6); /* 影を大幅に強調 */
}

/* タブコンテンツ部分も同じ暗さに */
.barom-my-page .hapb-tab-content {
    background: #1e2022;
}

/* アクティブなタブボタンも同じ背景色に合わせる */
.barom-my-page .hapb-tab-button.active {
    background: #1e2022;
}

/* タブ内セクション */
.hapb-tab-content .tab-section {
    background: transparent;
    padding: 0;
}

.section-subtitle {
    margin: 0 0 0.75em 0;
    font-size: 1.05em;
    font-weight: 700;
    color: #e0e0e0;
}

/* タブ内の見出し全般 */
.hapb-tab-content h4 {
    color: #e0e0e0 !important;
}

/* 来店履歴リスト */
.check-in-list {
    list-style: none;
    padding: 0 !important;
    padding-left: 0 !important;
    margin: 0;
}

.check-in-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75em 0;
    border-bottom: 1px solid #f0f0f0;
}

.check-in-date {
    color: #666;
    font-size: 0.9em;
}

.check-in-store {
    flex: 1;
    margin: 0 1em;
    font-weight: 500;
}

.check-in-points {
    color: #28a745;
    font-weight: bold;
}

/* ポイント履歴リスト */
.points-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.points-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75em 0;
    border-bottom: 1px solid #f0f0f0;
}

.history-info {
    flex: 1;
}

.history-date {
    display: block;
    color: #666;
    font-size: 0.85em;
    margin-bottom: 0.25em;
}

.history-desc {
    display: block;
    font-size: 0.95em;
}

.history-points {
    font-weight: bold;
    font-size: 1.1em;
}

.history-points.plus {
    color: #28a745;
}

.history-points.minus {
    color: #dc3545;
}

/* 空メッセージ */
.empty-message {
    color: #999;
    text-align: center;
    padding: 2em 0;
}

/* 設定セクション */
.section-description {
    color: #555;
    margin-bottom: 1em;
    font-size: 0.9em;
    line-height: 1.5;
}

.mail-opt-in-control {
    background: #f9f9f9;
    padding: 1em;
    border-radius: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    cursor: pointer;
    margin-bottom: 0.75em;
}

.mail-opt-in-checkbox {
    width: 18px;
    height: 18px;
}

.toggle-text {
    font-size: 0.95em;
    font-weight: 500;
    color: #333;
}

.setting-status {
    margin: 0;
    padding-top: 0.75em;
    border-top: 1px solid #e0e0e0;
    color: #555;
    font-size: 0.85em;
    line-height: 1.5;
}

/* 旧スタイルとの互換性 */
.member-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
}

.my-page-section {
    margin-bottom: 3em;
    padding: 1.5em 0;
}

.my-page-section h3 {
    margin-top: 0;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #eee;
}

/* === ポイント残高表示 === */
.points-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.points-section h3 {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.3);
}

.points-balance {
    text-align: center;
    padding: 2em 0;
}

.points-number {
    font-size: 3em;
    font-weight: bold;
    line-height: 1;
}

.points-unit {
    font-size: 1.2em;
    margin-left: 0.5em;
}

/* === QRスキャンセクション === */
.qr-scan-section p {
    margin-bottom: 1em;
    color: #666;
}

.qr-scan-container {
    max-width: 520px;
    margin: 0 auto;
}

.qr-scan-button {
    display: block;
    width: 100%;
    padding: 1em;
    font-size: 1.1em;
}

/* QRスキャナーUI - 全画面オーバーレイ */
.qr-ui {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: #000;
}

.qr-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.qr-message {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 1em 2em;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 1.1em;
    text-align: center;
    border-radius: 8px;
    white-space: nowrap;
}

#qr-stop {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1em 2.5em;
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
}

#qr-stop:hover {
    background: #fff;
}

/* === 来店履歴テーブル === */
.check-in-history-table,
.points-history-table {
    width: 100%;
    border-collapse: collapse;
}

.check-in-history-table th,
.check-in-history-table td,
.points-history-table th,
.points-history-table td {
    padding: 0.75em;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.check-in-history-table th,
.points-history-table th {
    font-weight: bold;
}

.points-plus {
    color: #28a745;
    font-weight: bold;
}

.points-minus {
    color: #dc3545;
    font-weight: bold;
}

/* === 来店カレンダー === */
.check-in-calendar {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
}

.check-in-calendar th {
    padding: 0.5em;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
}

.check-in-calendar td {
    padding: 0;
    text-align: center;
    vertical-align: top;
    border: 1px solid #f0f0f0;
    height: 70px;
    position: relative;
}

.calendar-day.is-today {
    border: 2px solid #ffc107;
}

.day-number {
    font-size: 0.9em;
    padding: 4px;
    color: inherit;
}

.check-in-markers {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 4px;
}

.check-in-marker {
    width: 24px;
    height: 24px;
    background: #28a745;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

/* === 確認画面用スタイル === */
/* common-form.css のスタイルをそのまま使用 */

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
    .barom-my-page {
        padding: 0 0.5em;
    }

    /* ウェルカムメッセージ - スマホで見やすく */
    .member-welcome {
        padding: 0.8em 0;
    }

    .welcome-text {
        font-size: 1em;
    }

    .logout-link {
        font-size: 0.85em;
        padding: 0.4em 0.8em;
    }

    /* ポイントカード - スマホで大きく表示 */
    .points-card {
        padding: 1.5em;
    }

    .points-number {
        font-size: 2.8em;
    }

    .points-unit {
        font-size: 1.2em;
    }

    .monthly-visits {
        font-size: 0.95em;
    }

    /* QRスキャンボタン - スマホでタップしやすく */
    .qr-scan-button {
        padding: 1.2em;
        font-size: 1.1em;
    }

    /* カレンダー - スマホでコンパクトに */
    .check-in-calendar td {
        height: 50px;
        font-size: 0.85em;
    }

    .check-in-marker {
        width: 18px;
        height: 18px;
        font-size: 0.65em;
    }

    .day-number {
        font-size: 0.8em;
        padding: 2px;
    }

    /* 確認画面のレスポンシブは共通フォームのスタイルを継承 */

    /* 設定セクション - モバイル最適化 */
    .section-subtitle {
        font-size: 1em;
        margin-bottom: 0.5em;
    }

    .section-description {
        font-size: 0.85em;
        margin-bottom: 0.75em;
    }

    .mail-opt-in-control {
        padding: 0.875em;
    }

    .toggle-text {
        font-size: 0.9em;
    }

    .setting-status {
        font-size: 0.8em;
        padding-top: 0.6em;
    }
}

/* 極小画面（iPhone SE等） */
@media (max-width: 375px) {
    .points-number {
        font-size: 2.3em;
    }

    .qr-scan-button {
        font-size: 1em;
        padding: 1em;
    }
}

/* === 履歴カレンダー：月切り替えコントロール === */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    background: transparent;
}

.history-nav-btn {
    background: transparent;
    border: none;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: normal;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: inherit;
    min-width: auto;
}

.history-nav-btn:hover {
    opacity: 0.7;
}

.history-nav-btn:active {
    opacity: 0.5;
}

.current-month-display {
    font-size: 1rem;
    font-weight: bold;
    color: inherit;
    flex: 1;
    text-align: center;
}

.arrow-left, .arrow-right {
    font-size: 0.8rem;
}

/* 履歴件数バッジ */
.history-count-badge {
    display: inline-block;
    background: #667eea;
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* ローディングスピナー */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-size: 0.95rem;
}

.loading-spinner::before {
    content: "⏳ ";
    display: inline-block;
}

/* エラーメッセージ */
.error-message {
    text-align: center;
    padding: 1.5rem;
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    margin: 1rem 0;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .history-controls {
        gap: 0.5rem;
        padding: 0.4rem 0;
    }

    .history-nav-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.85rem;
        gap: 0.3rem;
    }

    .current-month-display {
        font-size: 0.9rem;
        flex: 1;
    }

    .arrow-left, .arrow-right {
        font-size: 0.7rem;
    }
}
