/* ====================
   Events Page
   ==================== */

/* ========== 横スクロール検索フィルター ========== */
.search-filters {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 20px auto;
    padding: 0 var(--spacing-lg);
    box-sizing: border-box;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
}

.filter-buttons::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    border: 2px solid #d81b60;
    background: white;
    color: #d81b60;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.filter-btn:hover {
    background: #d81b60;
    color: white;
}

.filter-btn.active {
    background: #d81b60;
    color: white;
}

/* ========== モーダル共通スタイル ========== */
.filter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

.filter-modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    background: white;
    z-index: 1;
    border-radius: 20px 20px 0 0;
}

.filter-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    flex: 1;
    text-align: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-clear {
    background: none;
    border: none;
    color: #d81b60;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.filter-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.filter-modal-footer {
    padding: 16px 20px 80px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
    z-index: 10;
}

.apply-filter-btn {
    width: 100%;
    padding: 16px;
    background: #00d26a;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
}

.apply-filter-btn:hover {
    background: #00b85a;
}

/* ========== エリア選択スタイル ========== */
.region-section {
    margin-bottom: 0;
}

.region-header {
    background: #2c3e80;
    color: white;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.prefecture-list {
    background: white;
}

.prefecture-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.prefecture-item:hover {
    background: #f8f8f8;
}

.prefecture-item:last-child {
    border-bottom: none;
}

.prefecture-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.prefecture-item .checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}

.prefecture-item input[type="checkbox"]:checked ~ .checkmark {
    background: #d81b60;
    border-color: #d81b60;
}

.prefecture-item input[type="checkbox"]:checked ~ .checkmark::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.prefecture-item span:last-child {
    font-size: 15px;
    color: #333;
    flex: 1;
}

.prefecture-item input[type="checkbox"]:checked ~ span:last-child {
    color: #d81b60;
    font-weight: 600;
}

/* 地域の順番を調整 */
.region-section:nth-child(1) { order: 1; }
.region-section:nth-child(2) { order: 2; }
.region-section:nth-child(3) { order: 3; }
.region-section:nth-child(4) { order: 4; }
.region-section:nth-child(5) { order: 5; }
.region-section:nth-child(6) { order: 6; }
.region-section:nth-child(7) { order: 7; }
.region-section:nth-child(8) { order: 8; }
.region-section:nth-child(9) { order: 9; }
.region-section:nth-child(10) { order: 10; }

/* ========== カード形式イベント一覧 ========== */
.events-list {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg) calc(var(--spacing-2xl) + 30px); /* フッター分の余白を追加 */
    box-sizing: border-box;
}

.no-events {
    text-align: center;
    color: #666;
    font-size: 18px;
    padding: 40px 20px;
}

/* ========== 日付フィルターモーダル ========== */
.date-modal-content {
    max-width: 800px;
}

.date-modal-body {
    display: block;
    padding: 0;
}

/* 曜日フィルター */
.weekday-filter {
    display: flex;
    gap: 8px;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    justify-content: center;
    flex-wrap: wrap;
}

.weekday-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.weekday-btn:hover {
    border-color: #d81b60;
    color: #d81b60;
}

.weekday-btn.active {
    background: #d81b60;
    border-color: #d81b60;
    color: white;
}

/* カレンダー */
.date-calendar {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.calendar-month {
    margin-bottom: 30px;
}

.calendar-month-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    color: #999;
    font-weight: 600;
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.calendar-day:hover {
    background: #f8f8f8;
}

.calendar-day.sunday {
    color: #d81b60;
}

.calendar-day.saturday {
    color: #4a90e2;
}

.calendar-day.past {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-day.past:hover {
    background: transparent;
}

.calendar-day.selected {
    background: #d81b60;
    color: white;
    border-color: #d81b60;
    transform: scale(1.1);
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.empty:hover {
    background: transparent;
}

/* スマホ対応 */
@media (max-width: 768px) {
    .date-modal-content {
        max-height: 90vh;
    }
    
    .weekday-filter {
        padding: 15px;
        gap: 6px;
    }
    
    .weekday-btn {
        width: 40px;
        height: 40px;
        font-size: 13px;
    }
    
    .date-calendar {
        padding: 15px;
    }
    
    .calendar-grid {
        gap: 6px;
    }
    
    .calendar-day {
        font-size: 13px;
    }
}

@media (min-width: 769px) {
    .filter-modal {
        align-items: center;
    }
    
    .filter-modal-content {
        border-radius: 20px;
        max-height: 80vh;
        max-width: 900px;
    }
    
    .filter-modal-header {
        border-radius: 20px 20px 0 0;
    }
    
    .filter-modal-footer {
        padding: 16px 20px;
    }
    
    /* PC版で5列表示 */
    .filter-modal-body {
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    }
    
    /* PC版：日付モーダルの調整 */
    .date-modal-content {
        max-width: 600px;
    }
    
    .weekday-btn {
        width: 50px;
        height: 50px;
        font-size: 15px;
    }
    
    .calendar-day {
        font-size: 16px;
        padding: 12px;
    }
    
    .calendar-day.selected {
        transform: scale(1.05);
    }
    
    .calendar-grid {
        gap: 10px;
    }
    
    .calendar-weekday {
        font-size: 14px;
        padding: 10px 0;
    }
}

/* 時間帯モーダル */
.time-modal-content {
    max-width: 500px;
    width: 90%;
}

.time-slots {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 0;
}

.time-option {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-option:hover {
    border-color: #d81b60;
    background-color: #fff5f8;
}

.time-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
}

.time-option input[type="checkbox"]:checked + .time-label {
    color: #d81b60;
    font-weight: bold;
}

.time-option input[type="checkbox"]:checked ~ .time-label {
    color: #d81b60;
}

.time-option:has(input:checked) {
    border-color: #d81b60;
    background-color: #fff5f8;
}

.time-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.time-name {
    font-size: 18px;
    font-weight: 500;
}

.time-range {
    font-size: 14px;
    color: #666;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .time-modal-content {
        width: 95%;
        max-width: none;
    }
    
    .time-option {
        padding: 12px;
    }
    
    .time-name {
        font-size: 16px;
    }
    
    .time-range {
        font-size: 13px;
    }
}

/* ========================================
   レベルフィルターモーダル（PC・スマホ両方で横書き）
   ======================================== */

.level-modal-content {
    max-width: 500px;
    width: 90%;
}

.level-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 0;
    justify-content: center;
}

.level-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    flex: 0 1 auto;
}

.level-option:hover {
    border-color: #d81b60;
    background-color: #fff5f8;
}

.level-option input[type="radio"] {
    display: none;
}

.level-option:has(input:checked) {
    border-color: #d81b60;
    background-color: #d81b60;
}

.level-option:has(input:checked) .level-label {
    color: #ffffff;
    font-weight: bold;
}

.level-label {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .level-modal-content {
        width: 95%;
        max-width: none;
    }
    
    .level-options {
        gap: 8px;
    }
    
    .level-option {
        padding: 12px 16px;
        min-width: 70px;
    }
    
    .level-label {
        font-size: 16px;
    }
}

/* ========== リセットボタン ========== */
.reset-btn {
    background: #ff6b9d !important;
    color: white !important;
    font-weight: 600;
}

.reset-btn:hover {
    background: #ff4081 !important;
}

/* ========== 絞り込み中の表示バー ========== */
.active-filters-bar {
    background: #fff0f5;
    border-left: 4px solid #ff6b9d;
    padding: 12px 15px;
    margin: 15px auto;
    max-width: var(--container-max-width);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-sizing: border-box;
}

.active-filters-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.filters-label {
    font-weight: 600;
    color: #d81b60;
    white-space: nowrap;
}

.filter-tag {
    background: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 13px;
    color: #333;
}

.clear-filters-btn {
    background: none;
    border: 2px solid #ff6b9d;
    color: #ff6b9d;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.3s;
}

.clear-filters-btn:hover {
    background: #ff6b9d;
    color: white;
}

/* スマホ対応 */
@media (max-width: 768px) {
    .active-filters-bar {
        padding: 10px 12px;
        margin: 12px 12px;
    }
    
    .filter-tag {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .clear-filters-btn {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* ========== レスポンシブグリッドレイアウト ========== */
@media (min-width: 768px) {
    .events-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .event-card {
        margin-bottom: 0;
    }
}

@media (min-width: 1200px) {
    .events-list {
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
    }
}

/* ========== 検索ボックス ========== */
.search-box-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: #FF69B4;
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #f8f8f8;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-type {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

@media (max-width: 768px) {
    .search-box-container {
        max-width: 100%;
    }
}

/* ========== 検索バー行（検索ボックス + PCボタン横並び） ========== */
.search-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-bar-row .search-box-container {
    flex: 1;
    max-width: none;
    margin-bottom: 0;
}

/* PC: イベント作成ボタン */
.create-event-btn-pc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 11px 22px;
    background: linear-gradient(135deg, #f06292, #d81b60);
    color: #fff;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(216, 27, 96, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
    border: none;
    cursor: pointer;
}
.create-event-btn-pc:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(216, 27, 96, 0.45);
    color: #fff;
}
.create-event-btn-pc:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(216, 27, 96, 0.3);
    color: #fff;
}

/* スマホ: フローティングアクションボタン（PC では非表示） */
.create-event-fab {
    display: none;
}

@media (max-width: 768px) {
    .create-event-btn-pc {
        display: none;
    }
    .search-bar-row .search-box-container {
        margin-bottom: 0;
    }
    .create-event-fab {
        display: flex;
        position: fixed;
        bottom: 80px;
        right: 18px;
        height: 52px;
        padding: 0 22px;
        border-radius: 26px;
        background: linear-gradient(135deg, #f06292, #d81b60);
        color: #fff;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 0.04em;
        white-space: nowrap;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-decoration: none;
        box-shadow:
            0 4px 20px rgba(216, 27, 96, 0.55),
            0 2px 6px rgba(0, 0, 0, 0.12);
        z-index: 900;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
        border: none;
        cursor: pointer;
    }
    .create-event-fab:hover,
    .create-event-fab:active {
        transform: scale(1.05) translateY(-1px);
        box-shadow:
            0 6px 26px rgba(216, 27, 96, 0.65),
            0 3px 10px rgba(0, 0, 0, 0.15);
        color: #fff;
    }
}

/* ========================================
   主催者検索スタイル
   ======================================== */

.search-container {
    padding: 20px;
    flex-shrink: 0;
}

.host-results {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    -webkit-overflow-scrolling: touch;
}

.host-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.host-item:last-child {
    border-bottom: none;
}

.host-item:hover {
    background: #f5f5f5;
}

.host-item strong {
    color: #2e7d32;
    font-size: 14px;
}

.host-item small {
    font-size: 12px;
}

#selectedHost {
    margin-top: 10px;
}

@media (max-width: 768px) {
    .search-container {
        padding: 15px;
    }
    
    .host-results {
        max-height: 250px;
    }
    
    .host-item {
        padding: 10px 12px;
    }
    
    .host-item strong {
        font-size: 13px;
    }
    
    .host-item small {
        font-size: 11px;
    }
}

/* 選択中のフィルターボタン */
.filter-btn.active {
    background-color: #4CAF50;
    color: white;
    font-weight: 600;
}

/* 選択中のバッジ表示 */
.selected-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 20px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    background: #4CAF50;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.remove-badge {
    background: none;
    border: none;
    color: white;
    margin-left: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    padding: 0;
    line-height: 1;
}

.remove-badge:hover {
    color: #ffdddd;
}

/* スマホ対応 */
@media (max-width: 768px) {
    .filter-badge {
        font-size: 12px;
        padding: 5px 10px;
    }
}