/* ==========================
   TOPページ専用スタイル - High Density & Mobile First
   ========================== */

.top-container {
    width: 100%;
    overflow-x: hidden;
    background-color: #fafafa;
}

/* ==========================
   ヒーローセクション
   ========================== */
.hero-section {
    position: relative;
    /* ヘッダーの高さ分を考慮しつつ、スマホファーストで上部に詰める */
    padding: 3rem 1.5rem 4rem; 
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fdfdfd;
    overflow: hidden;
    /* min-heightは廃止 */
}

/* 背景装飾 */
.hero-background {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hero-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px); /* ぼかしを柔らかく */
    opacity: 0.4;
    animation: pulse 10s infinite alternate;
}

.hero-circle-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #ffdde1, transparent);
    top: -50px;
    left: -50px;
}

.hero-circle-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #fceeff, transparent);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.1); opacity: 0.5; }
}

.hero-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem; /* 要素間の隙間を適度に */
}

/* ヒーローコンテンツ（タイトル等） */
.hero-content {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    font-family: 'Playfair Display', 'Noto Sans JP', serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: #333;
    line-height: 1.25;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.hero-title span {
    display: inline-block;
}

.hero-title-highlight {
    background: linear-gradient(135deg, #d63384 0%, #ff8da1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.hero-subtitle {
    font-size: 1rem;
    color: #777;
    margin: 0 0 1.5rem 0;
    font-weight: 500;
}

/* ==========================
   検索タブ切り替え
   ========================== */
.search-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.25rem;
    border-radius: 12px;
    width: 100%;
    max-width: 550px;
}

.search-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex: 1;
}

.search-tab svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.search-tab:hover {
    color: #555;
    background: rgba(255, 255, 255, 0.5);
}

.search-tab--active {
    background: #fff;
    color: #d63384;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-tab--active svg {
    color: #d63384;
}

/* 検索パネル表示/非表示 */
.search-panel {
    display: none;
    animation: fadeInUp 0.3s ease;
}

.search-panel--active {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ==========================
   検索フォーム (New Structure)
   ========================== */
.search-form {
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
}

/* 検索入力欄 */
.search-input-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.search-input-wrapper:focus-within {
    border-color: #d63384;
    box-shadow: 0 8px 30px rgba(214, 51, 132, 0.15);
    transform: translateY(-2px);
    z-index: 10;
}

.search-icon {
    color: #bbb;
    margin-left: 0.75rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.search-wrapper:focus-within .search-icon {
    color: #d63384;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #333;
    background: transparent;
    padding: 0.5rem 0;
    min-width: 0; /* Flexboxの子要素がはみ出さないように */
}

.search-input::placeholder {
    color: #ccc;
    font-size: 0.95rem;
}

.search-button {
    background: #222;
    color: #fff;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap; /* 重要：文字の折り返しを禁止 */
    flex-shrink: 0;     /* 重要：ボタン幅の縮小を禁止 */
    transition: background 0.2s, transform 0.2s;
    margin-left: 0.5rem;
}

.search-button:hover {
    background: #000;
    transform: translateY(-1px);
}

.search-button .button-arrow {
    transition: transform 0.2s;
}

.search-button:hover .button-arrow {
    transform: translateX(3px);
}

/* ==========================
   ブラウズセクション (High Density Cards)
   ========================== */
.browse-section {
    width: 100%;
    max-width: 550px; /* 検索窓と同じ幅 */
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.browse-label {
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 0.75rem;
    font-weight: 600;
    display: none; /* スマホファーストで高さを稼ぐためデフォルト非表示でも良い */
}

/* グリッドレイアウト */
.discovery-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 常に2列で横並び */
    gap: 1rem;
}

.discovery-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    text-decoration: none;
    display: flex;
    flex-direction: column; /* アイコン上、テキスト下 */
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    height: 100%;
}

.discovery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: rgba(214, 51, 132, 0.2);
}

.card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s;
    flex-shrink: 0;
}

.discovery-card-category:hover .card-icon-wrapper {
    background: #fff0f5;
    color: #d63384;
}

.discovery-card-ingredient:hover .card-icon-wrapper {
    background: #fdf2f8;
    color: #be185d;
}

.card-text {
    width: 100%;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.25rem 0;
}

.card-description {
    font-size: 0.75rem;
    color: #999;
    margin: 0;
}

.card-arrow {
    display: none; /* シンプルにするため削除 */
}

/* ==========================
   レスポンシブ (スマホ最適化)
   ========================== */
@media (max-width: 768px) {
    /* ヒーローセクションをコンパクトに */
    .hero-section {
        padding: 2.5rem 1rem 3rem; /* 上部パディングを調整して高さを抑える */
    }

    .hero-wrapper {
        gap: 1.5rem; /* 間隔を詰める */
    }

    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 0.25rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.25rem;
    }

    /* 検索フォーム */
    .search-wrapper {
        padding: 0.4rem; /* 少しコンパクトに */
    }

    .search-input {
        font-size: 0.9rem;
    }

    .search-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* カード */
    .discovery-cards-container {
        gap: 0.75rem; 
    }
    
    .discovery-card {
        padding: 1rem 0.5rem;
        gap: 0.5rem;
    }
    
    .card-icon-wrapper {
        width: 42px;
        height: 42px;
    }

    .card-icon {
        width: 20px;
        height: 20px;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    /* モバイルでは検索タブのアイコンを非表示にして文字だけに */
    .search-tab svg {
        display: none;
    }
    
    .search-tab {
        padding: 0.65rem 0.5rem;
        font-size: 0.75rem;
    }
}

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

/* ==========================
   トップページ用 詳細フィルター
   ========================== */
.top-filter-section {
    width: 100%;
}

.top-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 2px dashed rgba(214, 51, 132, 0.3);
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.25s ease;
}

.top-filter-toggle:hover {
    background: linear-gradient(135deg, #fff0f5 0%, #fff 100%);
    border-color: #d63384;
    color: #d63384;
    border-style: solid;
}

.top-filter-toggle svg:first-child {
    color: #d63384;
}

.filter-toggle-text {
    flex: 1;
    text-align: left;
}

.top-filter-toggle .toggle-arrow {
    transition: transform 0.25s ease;
    color: #999;
}

.top-filter-section.is-open .top-filter-toggle .toggle-arrow {
    transform: rotate(180deg);
    color: #d63384;
}

.top-filter-section.is-open .top-filter-toggle {
    background: linear-gradient(135deg, #fff0f5 0%, #fff 100%);
    border-color: #d63384;
    border-style: solid;
    color: #d63384;
}

.top-filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
    opacity: 0;
    margin-top: 0;
}

.top-filter-section.is-open .top-filter-content {
    max-height: 350px;
    opacity: 1;
    margin-top: 0.75rem;
}

.top-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem 0.5rem 0.5rem;
    background: white;
    border-radius: 16px;
    margin-top: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

@media (min-width: 480px) {
    .top-filter-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 1rem;
    }
}

.top-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.top-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 0.25rem;
}

.top-filter-select,
.top-filter-input {
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    background: #fafafa;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

/* select要素専用のスタイル */
.top-filter-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
}

/* option要素のスタイル（視認性向上） */
.top-filter-select option {
    padding: 0.5rem;
    background: white;
    color: #333;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* input要素専用のスタイル */
.top-filter-input {
    cursor: text;
}

.top-filter-input::placeholder {
    color: #bbb;
    font-size: 0.8rem;
}

.top-filter-select:hover,
.top-filter-input:hover {
    border-color: #d63384;
    background-color: white;
}

.top-filter-select:focus,
.top-filter-input:focus {
    outline: none;
    border-color: #d63384;
    box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.1);
    background-color: white;
}

/* 含まない成分フィルター */
.exclude-ingredients-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.exclude-ingredients-toggle:hover {
    border-color: #d63384;
    color: #d63384;
}

.exclude-ingredients-toggle .toggle-arrow {
    transition: transform 0.2s ease;
}

.top-filter-group.is-open .exclude-ingredients-toggle .toggle-arrow {
    transform: rotate(180deg);
}

.top-filter-group.is-open .exclude-ingredients-toggle {
    border-color: #d63384;
    color: #d63384;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.exclude-ingredients-content {
    display: none;
    background: #fff;
    border: 1.5px solid #d63384;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.top-filter-group.is-open .exclude-ingredients-content {
    display: block;
}

.exclude-ingredients-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .exclude-ingredients-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.exclude-ingredient-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    background: #f8f8f8;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #555;
    cursor: pointer;
    transition: all 0.15s ease;
}

.exclude-ingredient-item:hover {
    background: #fff0f5;
    color: #d63384;
}

.exclude-ingredient-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #d63384;
    cursor: pointer;
}

.exclude-ingredient-item input[type="checkbox"]:checked + span {
    color: #d63384;
    font-weight: 500;
}

/* 検索送信ボタン */
.search-submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #222 0%, #333 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.search-submit-button:hover {
    background: linear-gradient(135deg, #000 0%, #222 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.search-submit-button svg {
    flex-shrink: 0;
}

/* フィルターリセットボタン */
.filter-reset-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    color: #666;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.filter-reset-button:hover {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-color: #d63384;
    color: #d63384;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.1);
}

.filter-reset-button svg {
    flex-shrink: 0;
}

/* ボタングループ */
.filter-button-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.25rem;
}

/* モバイル調整 */
@media (max-width: 480px) {
    .top-filter-toggle {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .top-filter-grid {
        gap: 0.75rem;
        /* スマホでは2列グリッド（メーカーは全幅、テーマとカテゴリーは横並び） */
        grid-template-columns: 1fr 1fr;
    }
    
    /* メーカーを全幅にする */
    .top-filter-group--full {
        grid-column: 1 / -1;
    }
    
    .top-filter-select {
        padding: 0.75rem 2.5rem 0.75rem 0.875rem;
        font-size: 0.9rem;
        min-height: 44px; /* タップしやすい高さを確保 */
    }
    
    .search-submit-button {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .search-input-wrapper {
        padding: 0.625rem 0.875rem;
    }
}
