/* ========================================
   Watanare Gallery Styles
   ポップでカラフルなデザイン
   ======================================== */

:root {
    --watanare-pink: #FF69B4;
    --watanare-light-pink: #FFB6D9;
    --watanare-cyan: #87CEEB;
    --watanare-yellow: #FFD700;
    --watanare-purple: #9370DB;
    --watanare-bg: #FFF5F8;
}

.watanare-gallery-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #FFF5F8 0%, #F0F8FF 100%);
    min-height: 100vh;
}

/* ========================================
   ページヘッダー・ロゴ
   ======================================== */
.gallery-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--watanare-light-pink) 0%, var(--watanare-cyan) 100%);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.3);
    position: relative;
    overflow: hidden;
}

.gallery-header::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--watanare-yellow);
    opacity: 0.3;
    border-radius: 50%;
    top: -30px;
    right: -30px;
}

.gallery-header::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--watanare-cyan);
    opacity: 0.3;
    border-radius: 50%;
    bottom: -20px;
    left: -20px;
}

.page-logo {
    max-width: 600px;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

/* ========================================
   フィルターコンテナ
   ======================================== */
.filter-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 3px solid var(--watanare-light-pink);
}

.filter-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--watanare-pink);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-title::before {
    content: '▶';
    color: var(--watanare-cyan);
    font-size: 0.8em;
}

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

.character-filter-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}

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

.character-filter-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.character-filter-scroll::-webkit-scrollbar-thumb {
    background: var(--watanare-pink);
    border-radius: 10px;
}

.character-filter {
    display: flex;
    gap: 15px;
    min-width: min-content;
}

.character-btn {
    flex-shrink: 0;
    width: 100px;
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.character-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--watanare-pink), var(--watanare-cyan));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.character-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(255, 105, 180, 0.4);
}

.character-btn.active {
    border-color: var(--watanare-pink);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.5);
}

.character-btn.active::before {
    opacity: 0.1;
}

.character-btn img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--watanare-light-pink);
    position: relative;
    z-index: 1;
}

.character-btn .all-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--watanare-pink);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.character-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    position: relative;
    z-index: 1;
}

.character-btn.active .character-name {
    color: var(--watanare-pink);
}

/* ========================================
   テキストフィルター
   ======================================== */
.text-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.filter-group {
    background: linear-gradient(135deg, #FFF 0%, #FFF5F8 100%);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid var(--watanare-light-pink);
}

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

.filter-btn {
    padding: 8px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--watanare-cyan);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: 0;
}

.filter-btn:hover::before {
    width: 200%;
    height: 200%;
}

.filter-btn:hover {
    color: white;
    border-color: var(--watanare-cyan);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--watanare-pink), var(--watanare-purple));
    color: white;
    border-color: var(--watanare-pink);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

.filter-btn span {
    position: relative;
    z-index: 1;
}

/* ========================================
   ソート
   ======================================== */
.sort-container {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px dashed var(--watanare-light-pink);
}

.sort-container label {
    font-weight: 600;
    color: var(--watanare-pink);
    font-size: 0.95rem;
}

.sort-select {
    padding: 10px 35px 10px 15px;
    border: 2px solid var(--watanare-light-pink);
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: 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='%23FF69B4' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--watanare-pink);
    box-shadow: 0 2px 10px rgba(255, 105, 180, 0.2);
    outline: none;
}

/* ========================================
   ギャラリー（Masonry Layout）
   ======================================== */
.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 15px;
}

.gallery-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: white;
}

.gallery-link::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--watanare-pink), var(--watanare-cyan), var(--watanare-yellow));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 15px;
}

.gallery-link:hover::before {
    opacity: 1;
}

.gallery-link:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 105, 180, 0.3);
}

.gallery-link img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
}

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

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

.gallery-title {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
}

/* ========================================
   ローディング・メッセージ
   ======================================== */
.loading-indicator {
    text-align: center;
    padding: 40px;
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 105, 180, 0.2);
    border-top: 4px solid var(--watanare-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.loading-indicator p {
    color: var(--watanare-pink);
    font-weight: 600;
}

.no-more-posts {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 0.95rem;
}

.no-more-posts p {
    background: white;
    display: inline-block;
    padding: 15px 30px;
    border-radius: 25px;
    border: 2px dashed var(--watanare-light-pink);
}

/* ========================================
   TOPに戻るボタン
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, var(--watanare-pink), var(--watanare-purple));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255, 105, 180, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.6);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 768px) {
    .watanare-gallery-page {
        padding: 15px;
    }

    .gallery-header {
        padding: 30px 15px;
    }

    .page-logo {
        max-width: 100%;
    }

    .filter-container {
        padding: 20px;
    }

    .text-filters {
        grid-template-columns: 1fr;
    }

    .character-btn {
        width: 90px;
    }

    .character-btn img,
    .character-btn .all-text {
        height: 60px;
        width: 60px;
    }

    .gallery-masonry {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .sort-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}

@media (min-width: 1200px) {
    .gallery-masonry {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ========================================
   アニメーション効果
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: fadeInUp 0.5s ease forwards;
}

.gallery-item:nth-child(n) {
    animation-delay: calc(0.05s * (var(--item-index, 0)));
}
