/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: #f4f4f9;
    color: #333;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Header and Search */
header {
    background-color: #fff;
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 {
    margin: 0;
    font-size: 2rem; /* PC表示時のタイトルフォントサイズを大きく */
    color: #2c3e50;
}

.search-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.simple-search-container {
    display: flex;
    align-items: center;
    gap: 0.1rem; /* Space between search box and buttons */
    width: 100%;
    max-width: 900px; /* Adjust as needed to accommodate all elements in one line */
    justify-content: center;
    flex-wrap: nowrap; /* Force items onto a single line */
}

.simple-search-container .combobox-component {
    flex: 1; /* Allow it to grow and shrink, taking available space */
    margin-bottom: 0; /* Override default margin */
    max-width: 500px; /* Keep a reasonable max-width for the search box on larger screens */
}

#toggle-advanced-search,
#reset-button,
#blog-search-button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem; /* ボタンのフォントサイズを小さく */
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap; /* Prevent text wrapping */
    flex: 0 0 auto; /* No grow, no shrink, size based on content */
}

#toggle-advanced-search,
#reset-button {
    background-color: #7d5fff;
}

#blog-search-button {
    background-color: #1abc9c;
}

#toggle-advanced-search:hover,
#reset-button:hover {
    background-color: #6a4ce0;
}

#blog-search-button:hover {
    background-color: #16a085;
}


/* Combobox Component Styles */
.combobox-component {
    position: relative;
    width: 100%;
    max-width: 400px; /* Adjust as needed */
    margin-bottom: 0.1rem;
}

.combobox-component .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.combobox-component .input-wrapper:focus-within {
    border-color: #7d5fff;
    box-shadow: 0 0 8px rgba(125, 95, 255, 0.2);
}

.combobox-input {
    flex-grow: 1;
    padding: 0.6rem 1rem;
    padding-right: 3rem; /* Space for toggle button */
    font-size: 0.9rem; /* 検索ボックスのフォントサイズを小さく */
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.toggle-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: color 0.2s ease;
}

.toggle-button:hover {
    color: #7d5fff;
}

.toggle-button .arrow-icon {
    width: 20px;
    height: 20px;
}

.suggestions-list {
    position: absolute;
    top: 100%; /* Position below the input */
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 200px; /* Max height for scrollbar */
    overflow-y: auto;
    z-index: 1000; /* Ensure it's above other content */
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
}

/* サジェストリストのスクロールバーのスタイル */
.suggestions-list::-webkit-scrollbar {
    width: 8px;
}
.suggestions-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.suggestions-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}
.suggestions-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.suggestions-list div {
    padding: 0.25rem 1rem; /* リスト間の間隔を少なく */
    font-size: 0.8rem; /* フォントサイズを小さく */
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease;
}

.suggestions-list div:hover,
.suggestion-active {
    background-color: #dbeafe; /* Tailwind's blue-200 */
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

#advanced-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
    min-width: 180px;
}

.filter-group label {
    font-weight: bold;
    font-size: 0.875rem;
    color: #555;
    text-align: left;
}

/* Main Content */
main {
    padding: 2rem;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.concert-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.concert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.concert-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #e2e8f0;
}

.concert-info {
    padding: 1.5rem;
}

.concert-info h2 {
    margin-top: 0;
    font-size: 1.25rem;
    color: #34495e;
}

.concert-info p {
    margin: 0.5rem 0;
    line-height: 1.6;
    font-size: 0.875rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: animatetop 0.4s;
}

@keyframes animatetop {
    from {top:-300px; opacity:0} 
    to {top:0; opacity:1}
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#modal-body {
    display: flex;
    flex-direction: column;
}
#modal-gallery { order: 1; }
#modal-text-content { order: 2; }

.modal-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-button {
    background-color: #7d5fff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}
.nav-button:hover { background-color: #6a4ce0; }

.modal-gallery {
    display: none;
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px;
    align-items: center;
    justify-content: center;
}

#modal-image {
    width: 100%;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
    border-radius: 4px;
    background-color: #e2e8f0;
}

.prev-button, .next-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    padding: 16px;
    font-size: 20px;
    border-radius: 50%;
    user-select: none;
    z-index: 2;
}
.prev-button { left: 10px; }
.next-button { right: 10px; }

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem; /* モバイル表示時のタイトルフォントサイズ */
    }

    .simple-search-container {
        flex-direction: column;
        gap: 0.8rem;
    }

    .simple-search-buttons {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }

    .simple-search-container .combobox-component {
        flex: 1; /* Allow search box to take remaining space */
        max-width: none; /* Remove max-width constraint for mobile */
    }

    .simple-search-container #toggle-advanced-search,
    .simple-search-container #reset-button {
        flex: 0 0 auto; /* Prevent buttons from growing or shrinking */
        font-size: 0.8rem; /* Even smaller font size for buttons */
        padding: 0.4rem 0.8rem; /* Even smaller padding for buttons */
        min-width: 60px; /* Minimum width for buttons on small screens */
    }

    .combobox-input {
        font-size: 0.8rem; /* Smaller font size for input */
        padding: 0.5rem 0.8rem; /* Adjust padding for smaller font */
        padding-right: 2rem; /* Adjust space for toggle button */
    }

    .toggle-button {
        padding: 0.2rem; /* Smaller padding for toggle button */
    }

    .toggle-button .arrow-icon {
        width: 16px;
        height: 16px;
    }

    #advanced-search-filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 0.4rem; /* Reduced gap */
    }
    .filter-group {
        width: calc(50% - 0.2rem); /* Adjusted for new gap */
        min-width: 150px;
    }

    .display-controls {
        gap: 0.5rem; /* Reduced gap */
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    .display-controls label,
    .display-controls select,
    .display-controls .view-btn {
        font-size: 0.8rem; /* Make font smaller to fit */
        padding: 0.3rem 0.6rem; /* Further reduce padding */
    }
}

/* Larger screen adjustments */
@media (min-width: 1024px) {
    .modal-content {
        max-width: 1100px; /* Adjust max-width for larger screens */
    }

    #modal-body {
        flex-direction: row; /* Side-by-side layout */
        gap: 2rem;
        align-items: flex-start; /* Align items to the top */
    }

    #modal-gallery {
        order: 1;
        flex: 1 1 40%; /* Allocate less space to the gallery */
        max-width: 500px; /* Reduce max-width for the gallery */
        margin: 0; /* Reset margin */
    }

    #modal-text-content {
        order: 2;
        flex: 1 1 60%; /* Allocate more space to the text */
        max-height: 75vh; /* Allow text content to scroll */
        overflow-y: auto;
        padding-right: 1rem; /* Add some padding for the scrollbar */
    }

    #modal-image {
        max-height: 70vh; /* Adjust max-height of the image */
    }
}

.highlight {
    background-color: yellow;
    font-weight: bold;
}

/* Display Controls */
.display-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.sort-control, .view-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.display-controls label {
    font-weight: bold;
    font-size: 0.875rem;
    color: #555;
}

.display-controls select,
.display-controls .view-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    border: 1px solid #ccc;
    border-radius: 20px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.display-controls .view-btn.active {
    background-color: #7d5fff;
    color: white;
    border-color: #7d5fff;
}

.display-controls .view-btn:not(.active):hover {
    background-color: #f0f0f0;
}

/* Styles for year headings */
.year-heading {
    width: 100%;
    grid-column: 1 / -1; /* Span all columns */
    font-size: 1.5rem;
    color: #34495e;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #7d5fff;
}

/* List View Styles */
.gallery-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gallery-container.list-view .concert-card {
    display: flex;
    align-items: center;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid #eee;
    padding: 0.75rem 1rem;
    gap: 1rem;
    transition: background-color 0.2s ease;
}

.gallery-container.list-view .concert-card:hover {
    transform: none;
    box-shadow: none;
    background-color: #f9f9f9;
}

.gallery-container.list-view .concert-card img {
    display: none; /* Hide image in list view */
}

.gallery-container.list-view .concert-info {
    padding: 0;
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.gallery-container.list-view .concert-info h2 {
    font-size: 1rem;
    margin: 0;
}

.gallery-container.list-view .concert-info p {
    font-size: 0.875rem;
    margin: 0;
    min-width: 100px; /* Ensure date has enough space */
    text-align: right;
    color: #555;
}

.view-toggle .view-btn {
    border-radius: 20px;
}