/* 全体のスタイル */
:root {
    --primary-color: #4a6da7;
    --secondary-color: #8ba3d0;
    --accent-color: #ff6b6b;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --header-bg: var(--primary-color);
    --footer-bg: #333;
    --border-radius: 8px;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダーのスタイル */
.app-header {
    background-color: var(--header-bg);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.app-title {
    font-size: 1.5rem;
    margin: 0;
}

.home-icon {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
}

/* メインコンテンツエリアのスタイル */
main {
    flex-grow: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ホーム画面のカードスタイル */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.menu-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.menu-card h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* フッターのスタイル */
.app-footer {
    background-color: var(--footer-bg);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

.version {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* ページ管理 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* フォームスタイル */
form {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

label, .form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input, select, textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

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

.btn-secondary {
    background-color: #6c757d;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-pay {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-pay:hover {
    background-color: #c82333;
}

/* テーブルスタイル */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--secondary-color);
    color: white;
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* タブのスタイル */
.tabs {
    display: flex;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background-color: #e9ecef;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
}

.tab:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.tab:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.tab.active {
    background-color: var(--primary-color);
    color: white;
}

/* カードセクションスタイル */
.section-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* 収支合計テーブルのスタイル */
.balance-summary-table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.balance-summary-table th,
.balance-summary-table td {
    padding: 10px;
    text-align: right;
}

.balance-summary-table th:first-child,
.balance-summary-table td:first-child {
    text-align: left;
}

.balance-summary-table th {
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.balance-summary-table td {
    border-bottom: 1px solid #eee;
}

.participant-name {
    font-weight: bold;
}

.positive-balance {
    color: #28a745;
    font-weight: bold;
}

.negative-balance {
    color: #dc3545;
    font-weight: bold;
}

.paid-status i {
    color: #28a745;
    margin-right: 5px;
}

/* テーブル視覚強化 */
.balance-summary-table td:nth-child(2),
.balance-summary-table td:nth-child(3) {
    background-color: #f8f9fa;
}

.balance-summary-table td:nth-child(4) {
    font-weight: bold;
}

.positive-balance {
    color: #1e7e34;
    background-color: rgba(40, 167, 69, 0.15) !important;
    padding: 5px 8px !important;
    border-radius: 4px;
    text-align: right;
    font-weight: bold;
}

.negative-balance {
    color: #bd2130;
    background-color: rgba(220, 53, 69, 0.15) !important;
    padding: 5px 8px !important;
    border-radius: 4px;
    text-align: right;
    font-weight: bold;
}

/* テーブルヘッダーの強調 */
.data-table th {
    background-color: #e9ecef;
    color: #495057;
    font-weight: bold;
    border-bottom: 2px solid #dee2e6;
}

/* モバイルビューを無効化して常にPCビューを強制 */
@media screen and (max-width: 768px) {
    /* 固定の幅を設定してズームを促す */
    html, body {
        min-width: 1024px;
        overflow-x: auto;
    }
    
    /* PC表示用のスタイリング */
    main {
        width: 1024px;
        margin: 0 auto;
    }
    
    .shared-event-container {
        width: 100%;
        padding: 20px;
        margin: 20px auto;
    }
    
    /* テーブルのスクロール不要に */
    .table-container {
        width: 100%;
        overflow-x: visible;
    }
    
    /* 全体的に通常サイズで表示 */
    .balance-summary-table,
    .advance-payment-table,
    .expense-matrix {
        font-size: 1rem;
        width: 100%;
    }
    
    .balance-summary-table th,
    .balance-summary-table td,
    .advance-payment-table th,
    .advance-payment-table td,
    .expense-matrix th,
    .expense-matrix td {
        padding: 10px;
    }
    
    /* カードは通常のサイズを維持 */
    .card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    /* ボタンのサイズも通常に */
    .btn-pay {
        padding: 4px 8px;
        font-size: 0.9rem;
    }
}

/* テーブル視認性の向上 */
.balance-summary-table,
.advance-payment-table,
.expense-matrix {
    background-color: white;
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.balance-summary-table th,
.advance-payment-table th,
.expense-matrix th {
    background-color: #f0f4f9;
    color: #333;
    border-bottom: 2px solid #ddd;
    padding: 10px;
    text-align: center;
}

.balance-summary-table td,
.advance-payment-table td,
.expense-matrix td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.balance-summary-table tr:nth-child(even),
.advance-payment-table tr:nth-child(even),
.expense-matrix tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 文字と背景のコントラスト改善 */
.positive-balance {
    color: #1e7e34;
    font-weight: bold;
    background-color: rgba(40, 167, 69, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

.negative-balance {
    color: #bd2130;
    font-weight: bold;
    background-color: rgba(220, 53, 69, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* 既存のコードは維持 */

/* アニメーション */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 収支の差額表示スタイル */
.positive-balance {
    color: green;
    font-weight: bold;
}

.negative-balance {
    color: red;
    font-weight: bold;
}

/* 共有ビュー専用スタイル */
.share-view .app-header,
.share-view .app-footer {
    display: none;
}

.share-view {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f6f9ff 0%, #f0f4fa 100%);
}

.payment-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.payment-amount {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.payment-status {
    display: flex;
    align-items: center;
}

.pay-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.pay-button:hover {
    opacity: 0.9;
}

.paid-status {
    color: green;
    display: flex;
    align-items: center;
}

.paid-status::before {
    content: "✓";
    margin-right: 0.5rem;
}

/* チェックリストスタイル */
.checklist {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist-item {
    display: flex;
    align-items: center;
}

.checklist-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.checklist-item input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.checklist.compact .checklist-item {
    margin-bottom: 0.3rem;
}

.select-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
}

/* タイポグラフィ重視のカジュアルな共有ビュー */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=M+PLUS+Rounded+1c:wght@500;700&display=swap');

/* 共有ビュー関連のスタイル */
body.share-view .header,
body.share-view .footer {
    display: none;
}

body.share-view {
    background: linear-gradient(135deg, #f6f9ff 0%, #f0f4fa 100%);
    font-family: 'Poppins', 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
    color: #333;
    line-height: 1.8;
    letter-spacing: -0.01em;
}

.shared-event-container {
    max-width: 900px;
    margin: 2rem auto 3rem;
    padding: 2.5rem;
    background-color: white;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    animation: fade-in 0.8s ease;
}

.share-view .header-actions {
    display: none;
}

#homeIcon.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 新しい共有ビューのスタイル */
.shared-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.event-emoji {
    font-size: 3.5rem;
    margin-bottom: 0.8rem;
    animation: bounce 1s ease;
}

.event-title {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.event-date {
    font-size: 1.1rem;
    color: #777;
    font-weight: 500;
}

/* モーダル関連のスタイル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #eee;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.btn-close:hover {
    color: #333;
}

/* 支出マトリックス表示用スタイル */
.expense-matrix {
    font-size: 0.9rem;
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

.expense-matrix th {
    vertical-align: top;
    text-align: center;
    white-space: normal;  /* 折り返し許可 */
    word-break: break-word; /* 単語の途中でも折り返し */
    padding: 10px 8px;
    min-width: 100px;
}

.expense-matrix td {
    text-align: right;
    padding: 8px;
    border: 1px solid #eee;
}

.expense-matrix .expense-amount {
    font-size: 0.8rem;
    color: #666;
    display: block;
    margin-top: 4px;
}

.expense-matrix .total-expense {
    font-weight: bold;
    background-color: #f5f5f5;
    color: var(--primary-color);
}

/* 立替情報表示のスタイル */
.advance-payment-table {
    width: 100%;
    margin-bottom: 1rem;
}

.advance-payment-table .payer-name {
    font-weight: bold;
    min-width: 100px;
}

.advance-payment-table .total-paid {
    font-weight: bold;
    color: var(--primary-color);
    text-align: right;
}

.expense-breakdown {
    padding: 5px 0;
}

.expense-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dotted #eee;
}

.expense-item:last-child {
    border-bottom: none;
}

.expense-item .expense-name {
    flex-grow: 1;
    padding-right: 10px;
}

.expense-item .expense-amount {
    white-space: nowrap;
}

/* イベント一覧の支払い詳細スタイル */
.payment-details-content {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.payment-member-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.payment-member-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.payment-member-list li:last-child {
    border-bottom: none;
}

.payment-member-list li.paid {
    color: #28a745;
}

.payment-member-list li.unpaid {
    color: #dc3545;
}

.payment-member-list li.receive {
    color: #17a2b8;
}

.payment-member-list li.neutral {
    color: #6c757d;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-icon {
    font-size: 1.1rem;
}

.status-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.no-payment-needed {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 1rem;
}
