/**
 * Gallery Master - ギャラリーCSS（デフォルトテンプレート）
 */

/* CSS変数（各ギャラリーで上書き可能） */
.agm-gallery-page {
    --agm-main: #FF69B4;
    --agm-sub: #87CEEB;
    --agm-bg: #FFF5F8;
    --agm-text: #333333;
    --agm-light-main: #FFB6D9;
}

/* ベーススタイル */
.agm-gallery-page {
    background: var(--agm-bg);
    min-height: 100vh;
    padding-bottom: 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--agm-text);
}

/* ナビゲーションヘッダー */
.gallery-nav-header {
    background: linear-gradient(135deg, var(--agm-main), var(--agm-sub));
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.gallery-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
}

.gallery-nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.gallery-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.9);
    color: var(--agm-text);
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.gallery-nav-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.gallery-nav-btn .nav-btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.gallery-lang-switch {
    display: flex;
    gap: 5px;
    position: absolute;
    right: 0;
}

.gallery-lang-switch .lang-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,0.3);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.gallery-lang-switch .lang-btn:hover {
    background: rgba(255,255,255,0.5);
}

.gallery-lang-switch .lang-btn.active {
    background: #fff;
    color: var(--agm-main);
}

/* ページヘッダー */
.gallery-header {
    text-align: center;
    padding: 40px 20px 30px;
    background: linear-gradient(180deg, var(--agm-bg) 0%, transparent 100%);
    position: relative;
    overflow: visible;
}

.gallery-header .page-logo {
    max-width: 400px;
    max-height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.gallery-header .page-title {
    font-size: 2.5rem;
    color: var(--agm-main);
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* フィルターコンテナ */
.filter-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    overflow: visible;
}

/* キャラクターフィルター */
.character-filter-section {
    margin-bottom: 25px;
}

.filter-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--agm-main);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.character-filter-wrapper {
    position: relative;
}

.character-filter-scroll {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--agm-light-main) transparent;
    padding-bottom: 10px;
}

.character-filter-scroll::-webkit-scrollbar {
    height: 6px;
}

.character-filter-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.character-filter-scroll::-webkit-scrollbar-thumb {
    background: var(--agm-light-main);
    border-radius: 3px;
}

.character-filter {
    display: flex;
    gap: 10px;
    padding: 5px 0;
}

.character-btn {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.character-btn:hover {
    border-color: var(--agm-light-main);
    transform: translateY(-2px);
}

.character-btn.active {
    border-color: var(--agm-main);
    background: linear-gradient(135deg, rgba(255,105,180,0.1), rgba(135,206,235,0.1));
}

.character-btn img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--agm-light-main);
}

.character-btn .char-initial {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--agm-main), var(--agm-sub));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.character-btn .all-text {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--agm-main);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.character-btn .character-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--agm-text);
    white-space: nowrap;
}

.scroll-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.scroll-hint-left {
    left: 0;
    background: linear-gradient(90deg, var(--agm-bg), transparent);
}

.scroll-hint-right {
    right: 0;
    background: linear-gradient(-90deg, var(--agm-bg), transparent);
}

.scroll-arrow {
    font-size: 24px;
    color: var(--agm-main);
}

/* テキストフィルター */
.text-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--agm-main);
    color: var(--agm-main);
}

.filter-btn.active {
    background: var(--agm-main);
    border-color: var(--agm-main);
    color: #fff;
}

/* ソート */
.sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.sort-container label {
    font-weight: 600;
    color: var(--agm-text);
}

.sort-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    font-size: 14px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--agm-main);
}

/* ギャラリーグリッド */
.gallery-masonry {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.gallery-item {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gallery-link {
    display: block;
    position: relative;
    text-decoration: none;
}

.gallery-link img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 40px 15px 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ローディング */
.loading-indicator {
    text-align: center;
    padding: 40px;
}

.loading-indicator .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--agm-light-main);
    border-top-color: var(--agm-main);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    color: var(--agm-main);
    font-weight: 500;
}

/* 終了メッセージ */
.no-more-posts {
    text-align: center;
    padding: 30px;
}

.no-more-posts p {
    display: inline-block;
    padding: 12px 30px;
    background: #fff;
    border-radius: 30px;
    color: #666;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* トップへ戻るボタン */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--agm-main);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--agm-sub);
    transform: translateY(-3px);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .gallery-nav-header {
        padding: 8px 15px;
    }
    
    .gallery-nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .gallery-header {
        padding: 25px 15px 20px;
    }
    
    .gallery-header .page-logo {
        max-width: 280px;
    }
    
    .gallery-header .page-title {
        font-size: 1.8rem;
    }
    
    .filter-container {
        padding: 0 15px;
    }
    
    .character-btn {
        min-width: 70px;
        padding: 8px 10px;
    }
    
    .character-btn img,
    .character-btn .char-initial,
    .character-btn .all-text {
        width: 40px;
        height: 40px;
    }
    
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 15px;
    }
    
    .gallery-item {
        border-radius: 8px;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .text-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        min-width: 100%;
    }
}
