/* ==========================================================================
   成分検索結果ページ (searchResults.css)
   Brand Aligned & High Density Design
   ========================================================================== */

.main-content-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .main-content-wrapper {
        padding: 3rem 2rem 5rem;
    }
}

/* 検索タイトル */
.search-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    margin-bottom: 0.5rem;
    text-align: center;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    .search-title {
        font-size: 2rem;
    }
}

.disclaimer {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    margin-bottom: 2rem;
    text-align: center;
    line-height: 1.5;
    background: var(--theme-bg-base);
    padding: 1rem;
    border-radius: 12px;
}

/* 検索結果統計 */
.results-count {
    text-align: center;
    color: var(--theme-text-secondary);
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* アイテムグリッド (High Density) */
.items-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* モバイルで2列 */
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .items-container {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.5rem;
    }
}

/* 商品カード */
.item-card {
    background: var(--theme-bg-white);
    border-radius: var(--theme-radius-md);
    box-shadow: var(--theme-shadow-card);
    padding: 1rem; /* パディングを詰め気味に */
    transition: transform var(--theme-transition), box-shadow var(--theme-transition);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--theme-shadow-card-hover);
    border-color: rgba(214, 51, 132, 0.2);
}

.item-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em; /* 2行分確保 */
}

.item-info {
    font-size: 0.75rem;
    color: var(--theme-text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    /* flex-grow: 1 は削除 - カード内の均一性を保つ */
    min-height: 0; /* テキスト量に関わらず固定高さを保つ */
}

.item-info span {
    color: var(--theme-text-primary);
}

.item-price {
    color: var(--primary-dark) !important;
    font-weight: 700;
}

/* カード内の余白を統一 */
.item-card {
    justify-content: space-between; /* ボタンを下に固定 */
}

/* 成分を見るボタン (Brand Color) */
.btn-show-ingredients {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(214, 51, 132, 0.2);
    width: 100%;
}

.btn-show-ingredients:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(214, 51, 132, 0.3);
    filter: brightness(1.05);
}

.no-ingredients {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    margin-top: auto;
    text-align: center;
    padding: 0.75rem 0;
}

/* ==========================================================================
   モーダル (Discovery Loop ready)
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--theme-bg-base);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    margin: 0;
    padding-right: 1.5rem;
}

.modal-close-btn {
    background: var(--theme-bg-base);
    border: none;
    cursor: pointer;
    color: var(--theme-text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    background: var(--accent-rose);
    color: var(--primary-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-info {
    margin-bottom: 2rem;
    background: var(--theme-bg-base);
    padding: 1rem;
    border-radius: 12px;
}

.modal-info p {
    font-size: 0.875rem;
    color: var(--theme-text-secondary);
    margin: 0.5rem 0;
}

.modal-price {
    display: block;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 0.75rem;
}

/* 成分リスト (Explore Link Style) */
.modal-ingredients {
    background: white;
}

.ingredients-title {
    font-size: 0.9375rem;
    color: var(--theme-text-primary);
    margin: 0 0 1rem 0;
    font-weight: 700;
}

.ingredients-list {
    font-size: 0.875rem;
    color: var(--theme-text-secondary);
    line-height: 2.2; /* リンクを押しやすくするために広げる */
}

/* 成分リンク (Discovery Loop) */
.ingredient-explore-link {
    display: inline-block;
    color: var(--theme-link-color);
    text-decoration: none;
    background: var(--theme-bg-base);
    padding: 1px 8px;
    border-radius: 4px;
    margin: 0 2px 4px 0;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.ingredient-explore-link:hover {
    background: var(--accent-rose);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.highlight-ingredient {
    background-color: var(--accent-pink);
    color: var(--primary-dark);
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid rgba(214, 51, 132, 0.2);
}

/* ==========================================================================
   ページネーション & 下部検索 (Reuse logic from common/top)
   ========================================================================== */

.pagination-wrapper {
    margin: 3rem 0;
}

/* 再検索セクションは search_results.blade.php 内で調整 */

@media (max-width: 768px) {
    .items-container {
        gap: 0.75rem;
    }
    
    .item-card {
        padding: 0.875rem;
    }
    
    .item-name {
        font-size: 0.9375rem;
        height: 2.8em;
    }
}

/* ==========================================================================
   ページネーション (モバイル対応 - 表示ページ数を制限)
   ========================================================================== */
.pagination-wrapper {
    margin: 3rem auto 2rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--theme-text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    background: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 10px rgba(214, 51, 132, 0.2);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
    background: var(--theme-bg-base);
}

/* モバイルでページ数を制限表示 */
@media (max-width: 640px) {
    .pagination {
        gap: 0.25rem;
    }
    
    .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }
    
    /* 三点リーダーの表示調整 */
    .page-item.disabled .page-link {
        padding: 0 0.25rem;
        min-width: auto;
        background: transparent;
        border: none;
    }
}

/* ==========================================================================
   再検索セクション (Call to Action)
   ========================================================================== */
.search-again-section {
    margin-top: 2.5rem;
    padding: 4rem 1.5rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-rose), var(--accent-pink));
    border-radius: 32px;
    text-align: center;
    border: 1px solid rgba(214, 51, 132, 0.1);
}

.search-again-title {
    font-family: 'Playfair Display', 'Noto Sans JP', serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    margin-bottom: 0.75rem;
}

.search-again-subtitle {
    font-size: 1rem;
    color: var(--theme-text-secondary);
    margin-bottom: 2.5rem;
}

.search-form-bottom {
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.search-wrapper-bottom {
    background: white;
    border-radius: 60px;
    padding: 0.4rem 0.4rem 0.4rem 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--theme-shadow-card);
    transition: border-color 0.3s;
    border: 2px solid transparent;
}

.search-wrapper-bottom:focus-within {
    border-color: var(--primary-color);
}

.search-icon-bottom {
    color: var(--primary-color);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.search-input-bottom {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--theme-text-primary);
    min-width: 0;
}

.search-button-bottom {
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-button-bottom:hover {
    background: black;
    transform: translateX(2px);
}

/* 人気の検索タグ */
.popular-searches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.popular-tag {
    background: white;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--primary-dark);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.popular-tag:hover {
    background: var(--accent-rose);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--theme-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-to-home:hover {
    color: var(--primary-color);
}

@media (max-width: 640px) {
    .search-again-section {
        padding: 3rem 1rem;
        border-radius: 20px;
        margin-top: 1.5rem;
    }
    
    .search-again-title {
        font-size: 1.5rem;
    }
    
    .search-wrapper-bottom {
        padding: 0.3rem 0.3rem 0.3rem 1rem;
    }
    
    .search-button-bottom span {
        display: none;
    }
}

/* ==========================================================================
   フィルターバー（コンパクト版）
   ========================================================================== */
.filter-bar {
    margin-bottom: 1rem;
    background: var(--theme-bg-base);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
}

.filter-bar-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.filter-bar-toggle:hover,
.filter-bar-toggle.is-open {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-bar-toggle svg:first-child {
    color: var(--primary-color);
}

.toggle-chevron {
    transition: transform 0.2s;
    color: #999;
}

.filter-bar-toggle.is-open .toggle-chevron {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* 適用中フィルタータグ */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.6rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.2s;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-tag:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: scale(1.02);
}

.filter-tag svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.filter-clear-all {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    text-decoration: underline;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s;
}

.filter-clear-all:hover {
    color: var(--primary-color);
}

/* 展開式フィルターパネル */
.filter-panel {
    display: none;
    padding: 0.75rem;
    margin-top: 0.75rem;
    background: white;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.filter-panel.is-open {
    display: block;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-panel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .filter-panel-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

.filter-panel-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-panel-select {
    padding: 0.6rem 2rem 0.6rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #fafafa;
    font-size: 0.85rem;
    color: var(--theme-text-primary);
    cursor: pointer;
    transition: all 0.2s;
    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;
}

.filter-panel-select:hover {
    border-color: var(--primary-color);
    background-color: white;
}

.filter-panel-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(214, 51, 132, 0.1);
    background-color: white;
}

.filter-active-notice {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem;
}

/* 結果カウントのスタイル調整 */
.results-count strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* no-results調整 */
.no-results-container {
    text-align: center;
    padding: 3rem 1rem;
}

.no-results-icon {
    color: var(--theme-text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results {
    font-size: 1.125rem;
    color: var(--theme-text-primary);
    margin-bottom: 0.5rem;
}

.no-results-suggestion {
    font-size: 0.9rem;
    color: var(--theme-text-muted);
}

/* 商品検索用のタイトルアイコン */
.search-title-icon {
    vertical-align: middle;
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* 検索切り替えリンク */
.search-type-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.switch-label {
    font-size: 0.85rem;
    color: var(--theme-text-muted);
}

.switch-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 50px;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--primary-color);
    transition: all 0.2s;
}

.switch-link:hover {
    background: var(--primary-color);
    color: white;
}