/* ========================================
   イベント交換所チェッカー専用スタイル
   ======================================== */

/* メインコンテンツの背景画像設定 */
.main-content {
    min-height: 100vh;
    position: relative;
    --bg-image: none; /* CSS変数で背景画像を管理 */
}

/* 背景 */
.background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}

/* main-content内の子要素を前面に */
.main-content > * {
    position: relative;
    z-index: 1;
}

/* イベント選択エリア */
.event-selector {
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.event-selector label {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.event-select {
    flex: 1;
    max-width: 400px;
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.event-select:hover {
    border-color: #764ba2;
}

.event-select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* イベント情報表示エリア */
.event-info {
    animation: fadeIn 0.5s;
}

.event-info.hidden {
    display: none;
}

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

/* 3カラムレイアウト */
.three-column-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.column {
    flex: 1;
    min-width: 0;
}

.column h2 {
    font-size: 20px;
    color: #000000;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 2px solid #667eea;
}

/* 左カラム */
.column-left {
    flex: 0 0 200px;
}

/* 中央カラム */
.column-center {
    flex: 1;
}

/* 右カラム */
.column-right {
    flex: 0 0 320px;
}

/* 現在のポイント入力セクション */
.current-points-section {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin-bottom: 15px;
    color: white;
}

.current-points-section label {
    display: block;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 8px;
}

.points-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    text-align: right;
    margin-bottom: 5px;
}

/* Chrome, Safari, Edge, Opera の▲▼矢印を非表示 */
.points-input::-webkit-inner-spin-button,
.points-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox の▲▼矢印を非表示 */
.points-input {
    -moz-appearance: textfield;
}

.points-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.point-name {
    font-size: 14px;
    opacity: 0.9;
    display: block;
    text-align: right;
}

/* ポイント操作ボタンとアイコン */
.points-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
}

.points-btn {
    flex: 1;
    padding: 10px 15px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.points-btn-minus {
    background: #f44336;
}

.points-btn-minus:hover {
    background: #da190b;
}

.points-btn-plus {
    background: #4caf50;
}

.points-btn-plus:hover {
    background: #45a049;
}

.point-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

/* サマリーセクション */
.summary-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    transition: all 0.3s;
}

.summary-card:hover {
    transform: translateX(0px);
    box-shadow: 0 0px 0px rgba(0, 0, 0, 1);
}

.summary-label {
    font-size: 16px;
    color: #666;
    margin-bottom: 0px;
}

.summary-value {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.summary-value.highlight {
    color: #667eea;
}

/* 報酬グリッド */
.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

/* 報酬アイテムカード */
.reward-item {
    position: relative; /* 売り切れ表示の基準位置として必要 */
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s;
}

.reward-item:hover {
    transform: scale(105%);
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
}

.reward-item.wanted {
    border-color: #667eea;
    background: #f0f4ff;
    cursor: pointer;
}

.reward-item.unwanted {
    border-color: #ddd;
    background: #f5f5f5;
    cursor: pointer;
}

.reward-item.sold-out {
    opacity: 0.6;
}

/* 売り切れバッジ（JavaScriptで動的に生成） */
.sold-out-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
}

.reward-icon-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    margin-bottom: 0px;
    pointer-events: none;
}

.reward-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
    transition: filter 0.3s;
}

.reward-item.unwanted .reward-icon {
    filter: grayscale(100%) opacity(0.5);
}

.reward-stock-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: rgba(255, 128, 0, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 20px;
    font-weight: bold;
}

.reward-item.unwanted .reward-stock-badge {
    background: rgba(150, 150, 150, 0.9);
}

.reward-name {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    min-height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.reward-item.unwanted .reward-name {
    color: #999;
}

.reward-price {
    font-size: 16px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 6px;
}

.reward-item.unwanted .reward-price {
    color: #999;
}

.reward-status {
    font-size: 12px;
    font-weight: bold;
    padding: 3px 0;
    margin-bottom: 6px;
    border-radius: 3px;
}

.reward-item.wanted .reward-status {
    color: #667eea;
    background: rgba(102, 126, 234, 0);
}

.reward-item.unwanted .reward-status {
    color: #999;
    background: rgba(150, 150, 150, 0);
}

.reward-controls {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.reward-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.reward-btn-decrease {
    background: #4caf50;
    color: white;
}

.reward-btn-decrease:hover {
    background: #45a049;
}

.reward-btn-decrease:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.reward-btn-increase {
    background: #f44336;
    color: white;
}

.reward-btn-increase:hover {
    background: #da190b;
}

.reward-btn-increase:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ミッションアコーディオン */
.mission-accordion {
    margin-bottom: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.mission-accordion-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: background 0.3s;
}

/* 全達成時の背景色 */
.mission-accordion-header.all-completed {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
}

.accordion-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.accordion-icon {
    font-size: 16px;
    transition: transform 0.3s;
}

.accordion-title {
    font-weight: bold;
    font-size: 14px;
}

.accordion-count {
    font-size: 16px;
    font-weight: bold;
    opacity: 0.9;
}

.accordion-actions {
    display: flex;
    gap: 5px;
}

.accordion-check-all,
.accordion-uncheck-all {
    padding: 4px 10px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.accordion-check-all {
    background: rgba(76, 175, 80, 0.9);
}

.accordion-check-all:hover {
    background: rgba(76, 175, 80, 1);
}

.accordion-uncheck-all {
    background: rgba(244, 67, 54, 0.9);
}

.accordion-uncheck-all:hover {
    background: rgba(244, 67, 54, 1);
}

.mission-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mission-accordion-content.open {
    max-height: 2000px;
    padding: 8px;
}

.mission-section-title {
    font-weight: bold;
    font-size: 14px;
    color: #667eea;
    margin: 15px 0 8px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #667eea;
}

/* ミッションセクション */
.mission-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin-bottom: 15px;
    color: white;
}

.mission-summary > div {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px; /* テキストと数値の間に少し間隔 */
}

.mission-summary span:first-child {
    font-size: 14px;
    opacity: 0.9;
}

.mission-summary span:last-child {
    font-size: 18px;
    font-weight: bold;
}

.missions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ミッションアイテム */
.mission-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.mission-item.hidden-completed {
    display: none;
}

.mission-item:hover {
    background: #f9f9f9;
    border-color: #667eea;
}

.mission-item.completed {
    background: #e8f5e9;
    border-color: #4caf50;
}

.mission-item.auto-completed {
    background: #fff3cd;
    border-color: #ffc107;
    cursor: default;
}

.mission-item.auto-completed .mission-name {
    color: #856404;
}

.mission-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
}

.mission-item.completed .mission-checkbox {
    background: #4caf50;
    border-color: #4caf50;
}

.mission-checkbox::after {
    content: '✓';
    font-size: 14px;
    color: white;
    display: none;
}

.mission-item.completed .mission-checkbox::after {
    display: block;
}

.mission-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mission-name {
    font-size: 16px;
    color: #333;
    flex: 1;
}

.mission-item.completed .mission-name {
    color: #2e7d32;
    text-decoration: line-through;
}

.mission-points {
    font-size: 16px;
    font-weight: bold;
    color: #667eea;
    flex-shrink: 0;
}

.mission-item.completed .mission-points {
    color: #4caf50;
}

/* モーダル共通スタイル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 10px;
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding: 30px 30px 0 30px;
    border-radius: 10px 10px 0 0;
}

.modal-close {
    position: sticky;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: #f44336;
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    line-height: 1;
    padding: 0;
    float: right;
    z-index: 11;
}

.modal-close:hover {
    background: #d32f2f;
    transform: none;
}

.modal-content h2 {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.modal-body {
    color: #333;
    line-height: 1.8;
    padding: 0 30px 30px 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body strong {
    color: #667eea;
}

.modal-body h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 20px;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.modal-body li {
    margin-bottom: 8px;
}

/* スクロールバーのスタイル（Webkit系ブラウザ） */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
    .three-column-layout {
        flex-direction: column;
    }
    
    .column-left,
    .column-right {
        flex: 1;
    }
    
    .summary-section {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .summary-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rewards-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

@media (max-width: 480px) {
    .summary-section {
        grid-template-columns: 1fr;
    }
    
    .rewards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
