* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.calendar-container {
    width: 100%;
    max-width: 1200px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ヘッダー */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background-color: white;
    gap: 20px;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    background: transparent;
    border: none;
    padding: 0;
    transition: transform 0.2s ease;
}

.nav-button:hover {
    transform: scale(1.05);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-button span {
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 0.8px;
}

.arrow-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

.arrow-icon::before {
    content: '';
    width: 10px;
    height: 10px;
    border-top: 2px solid #666;
    border-right: 2px solid #666;
    position: absolute;
}

.arrow-icon.left::before {
    transform: rotate(-135deg);
    margin-left: 3px;
}

.arrow-icon.right::before {
    transform: rotate(45deg);
    margin-right: 3px;
}

.nav-button:hover .arrow-icon {
    background: #ebebeb;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.nav-button:hover .arrow-icon::before {
    border-color: #333;
}

.nav-button:active .arrow-icon {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.year {
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 7.2px;
    margin-bottom: 3px;
}

.month {
    font-weight: bold;
}

.month-number {
    font-size: 36px;
}

.month-label {
    font-size: 22px;
    letter-spacing: 1.8px;
}

/* カレンダー本体 */
.calendar-body {
    background-color: #fbfbfb;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.calendar-body:hover {
    background-color: #f5f5f5;
}

.calendar-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.1s;
    border-radius: 5px;
}

.calendar-scroll-container:hover {
    box-shadow: inset 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.calendar-scroll-container:active {
    cursor: grabbing;
    box-shadow: inset 0 0 0 3px rgba(74, 144, 226, 0.5);
}

.calendar-scroll-container:focus {
    outline: none;
    box-shadow: inset 0 0 0 4px rgba(74, 144, 226, 0.8);
}

.calendar-scroll-container::-webkit-scrollbar {
    display: none;
}

.calendar-grid {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100%;
}

/* 日付行 */
.dates-row {
    display: flex;
    gap: 2px;
}

.date-cell {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    flex-shrink: 0;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 0.8px;
    color: white;
    background-color: #c3c3c3;
}

.date-cell.today {
    background-color: #ff7d7d;
}

.date-cell.closed {
    background-color: #666666;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    font-size: 14px;
    padding: 10px;
    letter-spacing: 0.8px;
}

/* イベントコンテナ */
.events-container {
    display: flex;
    gap: 2px;
    position: relative;
    min-height: 300px;
    background-color: #f4f4f4;
    padding: 10px 0;
    overflow: visible;
}

.day-column {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    flex-shrink: 0;
    position: relative;
    border-right: 2px solid #fbfbfb;
    overflow: visible;
}

.day-column:last-child {
    border-right: none;
}

.day-column.closed-day {
    background-color: #e8e8e8;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

.closed-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #666666;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    letter-spacing: 5px;
    z-index: 1;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.event-bar {
    position: absolute;
    left: 2px;
    right: auto;
    min-height: 40px;
    border-radius: 5px;
    padding: 8px 10px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    overflow: visible;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    animation: slideInEvent 0.5s ease-out;
    animation-fill-mode: both;
    transform-origin: left center;
    z-index: 2;
}

@keyframes slideInEvent {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOutEvent {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
}

.event-bar.removing {
    animation: slideOutEvent 0.2s ease-in forwards !important;
}

.event-bar:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.event-bar:active {
    transform: scale(0.98);
}

.event-bar.filtered-out {
    opacity: 0;
    transform: translateX(-30px) scale(0.8);
    pointer-events: none;
}

.event-bar.filtered-in {
    animation: slideInEvent 0.5s ease-out;
}

.event-bar.hidden {
    animation: fadeOutEvent 0.3s ease-out forwards !important;
    pointer-events: none;
}

@keyframes fadeOutEvent {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }
}

.event-bar-text {
    position: sticky;
    left: 10px;
    max-width: 100%;
}

.event-bar:hover {
    opacity: 0.8;
}

/* スクロールバー */
.scroll-bar-container {
    background-color: #f3f3f3;
    padding: 2px;
    margin-top: 10px;
    border-radius: 3px;
    cursor: pointer;
}

.scroll-bar {
    background-color: #d9d9d9;
    height: 6.79px;
    border-radius: 3px;
    transition: width 0.1s, margin-left 0.1s;
    cursor: grab;
    user-select: none;
}

.scroll-bar:active {
    cursor: grabbing;
}

/* カテゴリフィルタ */
.category-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 15px 30px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
}

.filter-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 20px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.filter-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #2c5f4f;
}

.filter-button:active {
    transform: translateY(0);
}

.filter-button.active {
    background-color: #e8f2ee;
    border-color: #2c5f4f;
    color: #2c5f4f;
    font-weight: bold;
}

.filter-button:not(.active) {
    opacity: 0.6;
}

.filter-button:not(.active):hover {
    opacity: 0.8;
}

.filter-color-badge {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* イベントバーの非表示 */
.event-bar.hidden {
    display: none !important;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 24px;
    color: #222;
    padding-right: 30px;
    line-height: 1.4;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2c5f4f;
}

.modal-label {
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.modal-value {
    font-weight: bold;
    color: #222;
    font-size: 16px;
}

.modal-color-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.loading-overlay[aria-hidden='false'] {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(44, 95, 79, 0.2);
    border-top-color: #2c5f4f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   イベントリストセクション
   ============================================ */
.event-list-section {
    margin-top: 40px;
    padding: 0 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.category-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    padding-left: 15px;
    border-left: 5px solid #ccc;
    /* JSで色を変更 */
    line-height: 1.4;
}

.event-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Event Cards */
.event-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.event-card-image-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.event-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.event-card:hover .event-card-image {
    transform: scale(1.05);
}

.event-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.event-card-date {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.event-card-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
}

.event-card-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-card-footer {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.event-card-link {
    font-size: 14px;
    color: #2c5f4f;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.event-card-link::after {
    content: '→';
    transition: transform 0.2s;
}

.event-card-link:hover::after {
    transform: translateX(3px);
}