/* ==========================
   UIコンポーネント
========================== */

/* ===== タイトルとテキスト要素 ===== */
.main-title {
    font-size: 3rem;
    font-family: serif;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center; /* 中央揃え */
}

.subtitle {
    display: inline;
    font-size: 2rem;
    font-style: italic;
    margin-left: 10px;
}

.byline {
    font-size: 1rem;
    margin-top: 5px;
    font-style: italic;
    opacity: 0.8;
}

/* playback-gradientのスタイル調整 */
.playback-gradient {
    display: inline-block;
    position: relative;
    min-width: 140px; /* 最小幅を設定 */
    text-align: center;
}

/* ===== フォーム要素 ===== */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px auto; /* 上部マージンを通常に戻す */
    max-width: 600px;
}

.search-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
}

.search-options {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.search-options-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 15px;
    flex-wrap: wrap;
}

.sorting-options-inline {
    display: flex;
    align-items: center;
}

.sorting-options-inline label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

.sorting-options-inline input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

.search-input {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    flex-grow: 1;
}

.search-button, .ai-button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    min-width: 45px;
    min-height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-container .search-button {
    margin-right: 10px;
}

.search-container .ai-button {
    margin-left: 10px;
}

.search-button {
    background-color: #d6d5cd;
    color: #333;
}

.search-button:hover {
    background-color: #c6c5bd;
    transform: translateY(-2px);
}

.ai-button {
    background-color: #ddd7be;
    color: #333;
}

.ai-button:hover {
    background-color: #cdc7ae;
    transform: translateY(-2px);
}

.search-button-content, .ai-button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.search-icon, .ai-icon {
    font-size: 20px;
}

/* ===== ボタン ===== */
.button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    font-size: 0.9rem;
    margin: 5px;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button:active {
    transform: translateY(1px);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.button-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px auto;
    max-width: 600px;
}

/* DMMバナー */
.dmm-button {
    background-color: transparent;
    border: none;
    padding: 0;
    display: inline-block;
    transition: all 0.3s ease;
    overflow: hidden; /* ウィジェットのオーバーフローを制御 */
    width: 132.5px; /* 指定されたボタンサイズ */
    height: 110.4px; /* 指定されたボタンサイズ */
}

/* DMMウィジェットのサイズ調整 - 指定サイズ表示 */
.dmm-button .widget-banner {
    transform: none; /* スケール調整を無効化 */
    transform-origin: top left; /* 左上を基準 */
    display: block;
    width: 100%;
    height: 100%;
}

/* ウィジェット内の画像も指定サイズ表示 */
.dmm-button .widget-banner img {
    max-width: 132.5px !important; /* 指定されたサイズ */
    max-height: 110.4px !important; /* 指定されたサイズ */
    width: 132.5px !important; /* 固定幅 */
    height: 110.4px !important; /* 固定高さ */
    object-fit: contain; /* アスペクト比を維持してフィット */
}

.dmm-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.dmm-button:hover .widget-banner {
    opacity: 0.9;
}

/* DMMバナー2 - 同じ仕様 */
.dmm-button-2 {
    background-color: transparent;
    border: none;
    padding: 0;
    display: inline-block;
    transition: all 0.3s ease;
    overflow: hidden; /* ウィジェットのオーバーフローを制御 */
    width: 132.5px; /* 指定されたボタンサイズ */
    height: 110.4px; /* 指定されたボタンサイズ */
}

/* DMMウィジェット2のサイズ調整 - 指定サイズ表示 */
.dmm-button-2 .widget-banner {
    transform: none; /* スケール調整を無効化 */
    transform-origin: top left; /* 左上を基準 */
    display: block;
    width: 100%;
    height: 100%;
}

/* ウィジェット2内の画像も指定サイズ表示 */
.dmm-button-2 .widget-banner img {
    max-width: 132.5px !important; /* 指定されたサイズ */
    max-height: 110.4px !important; /* 指定されたサイズ */
    width: 132.5px !important; /* 固定幅 */
    height: 110.4px !important; /* 固定高さ */
    object-fit: contain; /* アスペクト比を維持してフィット */
}

.dmm-button-2:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.dmm-button-2:hover .widget-banner {
    opacity: 0.9;
}

/* ショッピングボタン */
.mercari-button, .rakuten-button, .yahoo-button {
    color: white;
    transition: all 0.3s ease;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
}

.mercari-button {
    background-color: #ff0211;
}

.mercari-button:hover {
    background-color: #e60000;
}

.rakuten-button {
    background-color: #bf0000;
}

.rakuten-button:hover {
    background-color: #a00000;
}

.yahoo-button {
    background-color: #ff0033;
    font-size: 0.8rem;
}

.yahoo-button:hover {
    background-color: #e6002e;
}

.dyson-button {
    color: white;
    text-decoration: none; /* 下線を削除 */
    background-color: black; /* 背景色を黒に設定 */
    align-items: center; /* 垂直方向の中央揃え */
    justify-content: center; /* 水平方向の中央揃え */
    border-radius: 5px; /* 角丸 */
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

/* 画像を適切に中央配置 */
.dyson-button img {
    max-width: 100%; /* ボタン内の幅を80%まで調整 */
    max-height: 100%; /* ボタン内の高さを80%まで調整 */
    object-fit: contain; /* 画像の比率を維持 */
}
.dyson-button:hover {
    filter: brightness(1.2); /* ホバー時に少し明るく */
}


.asus-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white; /* 背景色 */
    border-radius: 5px;
    border: 1px solid black;
    overflow: hidden; /* はみ出た部分を隠す */
    transition: transform 0.2s, background-color 0.3s;
}

/* 画像の高さ方向の真ん中30%を表示 */
.asus-button img {
    width: 100%;
    height: 150%; /* 画像を大きくして中央部分を切り取る */
    object-fit: cover;
    object-position: center 35%; /* 高さの中央付近を表示 */
}

/* ホバー時のエフェクト */
.asus-button:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.animega-button {
    background-color: #0078D7; /* ソフマップの青色 */
    font-size: 1.0rem;
}

.animega-button:hover {
    background-color: #005ea6; /* ホバー時に暗い青 */
    transform: scale(1.05);
}


.recolet-button {
    background-color: #0078D7; /* ソフマップの青色 */
}

.recolet-button:hover {
    background-color: #005ea6; /* ホバー時に暗い青 */
    transform: scale(1.05);
}



/* ===== カード ===== */
.card {
    width: 100%;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    position: relative;
    height: 150px;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.25);
}

.card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover img {
    transform: scale(1.05);
}

.card-content {
    padding: 5px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 0.9rem;
    font-weight: bold;
    line-height: 1.3;
    max-height: 3.9em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-shadow: 
        -2px -2px 0 #000,  
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 8px #000; /* 黒い縁取りを強化 */
    color: white;
    background-color: transparent; /* 背景を透明に */
    padding: 5px;
    border-radius: 4px;
    font-weight: 800; /* 文字を太くして読みやすく */
}

.card-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: auto;
}

.card-detail {
    margin-bottom: 5px;
}

.card-published-date {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.75rem;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 3px 6px;
    border-radius: 3px;
    z-index: 1;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.card-description {
    font-size: 0.85rem;
    color: #555;
    margin-top: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* リンクカード */
.link-card {
    margin: 5px;
    text-align: center;
    flex: 0 0 120px;
    max-width: 120px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.link-card:hover {
    transform: translateY(-5px);
}

.link-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: 8px;
    border-radius: 8px;
    transition: transform 0.2s;
    width: 120px;
    height: 80px;
    position: relative;
}

.link-button:hover {
    transform: translateY(-5px);
}

.link-button img {
    width: 110px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 6px;
}

.link-button span {
    text-align: center;
    font-weight: bold;
    font-size: 12px;
}

/* 画像が無い場合のスタイル */
.link-button:not(:has(img)) {
    background: linear-gradient(to bottom, #d0ebff, #a0d8ef);
    justify-content: center;
}

.link-button:not(:has(img)) span {
    color: #000;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    padding: 0 4px;
}

.link-button:not(:has(img)):hover {
    background: linear-gradient(to bottom, #a0d8ef, #d0ebff);
}

/* プレースホルダー */
.no-image-placeholder {
    width: 100%;
    height: 120px;
    background-color: #f1f1f1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #777;
    font-size: 13px;
    font-style: italic;
}

/* ===== タブナビゲーション ===== */
.tab .tab-link {
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 3px;
    margin: 0 5px;
    transition: background-color 0.3s;
    font-size: 0.9rem;
}

.tab .tab-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.tab .tab-link.active {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ===== ウィジェット ===== */
/* TradingViewウィジェット */
.tradingview-widget-container {
    position: fixed;
    top: 200px; /* bylineの下端に合わせて配置: カウントダウン(50px) + ヘッダーコンテンツ(~150px) */
    left: 0;
    width: 100%;
    height: 85px; /* 下側に15px伸ばす */
    z-index: 950;
    background-color: transparent; /* 背景を透明に変更 */
    overflow: visible; /* スクロールが見えるように変更 */
    display: block !important; /* 常に表示 */
    pointer-events: auto; /* マウスイベントを有効化 */
    min-height: 85px; /* 最小高さも調整 */
    max-height: 85px; /* 最大高さも調整 */
    transition: opacity 0.3s ease;
}

.tradingview-widget-container__widget {
    height: 75px !important; /* 高さを60pxから75pxに拡大 */
    width: 100% !important;
    max-width: 100% !important;
    min-height: 75px !important; /* 最小高さも同様に調整 */
    max-height: 75px !important; /* 最大高さも同様に調整 */
    overflow: visible !important; /* スクロールが見えるように変更 */
    display: block !important;
    margin-bottom: 0 !important;
    white-space: nowrap !important; /* テキストが折り返されないようにする */
    background-color: rgba(19, 23, 34, 0.9) !important; /* ウィジェット本体のみに背景色を設定、少し透過 */
    border-radius: 4px !important; /* 角を丸くする */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important; /* 少し浮かせる */
}

.tradingview-widget-container iframe {
    height: 75px !important; /* 高さを75pxに拡大 */
    width: 100% !important;
    max-width: 100% !important;
    min-height: 75px !important; /* 最小高さも同様に調整 */
    max-height: 75px !important; /* 最大高さも同様に調整 */
    border: none !important;
    overflow: visible !important; /* スクロールが見えるように変更 */
    display: block !important;
    pointer-events: auto !important; /* マウスイベントが有効になるように */
}

.tradingview-widget-copyright {
    font-size: 11px !important;
    line-height: 1.1 !important;
    margin: 0 !important;
    padding: 0 5px !important;
    text-align: right !important;
    color: rgba(217, 217, 217, 0.7) !important; /* ダークテーマに合わせたテキスト色、透過を追加 */
    position: absolute !important; /* 絶対位置に変更 */
    bottom: 3px !important; /* ウィジェット下端からの位置を調整 */
    right: 0 !important; /* 右揃え */
    width: 100% !important; /* 幅を100%に設定 */
    height: 15px !important; /* 高さを明示的に設定 */
    opacity: 0.7 !important; /* 少し透過 */
}

.tradingview-widget-copyright .blue-text {
    color: #2962FF !important;
}

/* 関税発動タイマー */
.activation-timer-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    z-index: 950;
    background-color: #1e222d;
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.activation-timer-widget {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    font-size: 12px; /* ラベル拡大 */
    color: #f0f0f0;
    height: 100%;
    padding: 0 20px;
    flex-wrap: nowrap;
    min-width: 800px;
}

.countdown-section {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.countdown-source {
    font-size: 9px;
    margin-left: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.countdown-source a {
    color: #888;
    text-decoration: none;
}

.countdown-source a:hover {
    color: #f0f0f0;
    text-decoration: underline;
}

.activation-timer-label {
    color: #f0f0f0;
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
    min-width: 80px;
}

.activation-timer-display {
    font-weight: bold;
    color: #e53935;
    white-space: nowrap;
    font-family: 'Share Tech Mono', monospace;
    width: auto;
    text-align: center;
    display: inline-block;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    font-feature-settings: "tnum";
    -webkit-font-feature-settings: "tnum";
    font-size: 1.8em; /* コンテナ高さ50pxに合わせて拡大 */
    line-height: 1;
    text-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000, 0 0 15px #ff0000;
    flex-shrink: 0;
}

/* レスポンシブデザイン対応 - TradingViewウィジェット */
@media (max-width: 768px) {
    .tradingview-widget-container {
        top: 130px; /* 相互関税発動タイマー分調整 */
        height: 85px !important;
        background-color: transparent;
    }
    
    .tradingview-widget-container__widget,
    .tradingview-widget-container iframe {
        height: 75px !important;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.5rem;
    }
    
    .activation-timer-widget {
        flex-direction: row;
        gap: 12px;
        font-size: 10px;
        flex-wrap: nowrap;
        min-width: 600px;
        justify-content: space-between;
    }
    
    .activation-timer-display {
        width: auto;
        font-size: 1.2em;
        line-height: 1;
    }
    
    .activation-timer-label {
        font-size: 9px;
        min-width: 60px;
    }
    
    .search-options-inline {
        margin-left: 0;
        gap: 10px;
        justify-content: center;
        margin-top: 10px;
    }
    
    .sorting-options-inline label {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tradingview-widget-container {
        top: 120px; /* 相互関税発動タイマー分調整 */
        height: 85px !important;
        background-color: transparent;
    }
    
    .tradingview-widget-container__widget,
    .tradingview-widget-container iframe {
        height: 75px !important;
    }
    
    .tradingview-widget-copyright {
        font-size: 9px !important;
        color: rgba(217, 217, 217, 0.7) !important;
    }
    
    .main-title {
        font-size: 2rem;
        flex-direction: column;
        align-items: center;
    }
    
    .subtitle {
        font-size: 1.2rem;
        margin-left: 0;
        margin-top: 5px;
    }
    
    .activation-timer-container {
        height: 50px;
    }
    
    .activation-timer-widget {
        flex-direction: column;
        gap: 2px;
        font-size: 9px;
        flex-wrap: nowrap;
        min-width: auto;
        justify-content: center;
    }
    
    .activation-timer-display {
        width: auto;
        font-size: 1.0em;
        line-height: 1;
    }
    
    .activation-timer-label {
        font-size: 8px;
        min-width: auto;
    }
}

/* カードオーバーレイ */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0); /* 100%透過（不透明度0%） */
    padding: 8px;
    color: #fff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 1;
}

.card:hover .card-overlay {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.4); /* ホバー時は少し暗く */
}

/* お勧め動画カードの幅と間隔を検索結果と同じに統一 */
#recommended-videos .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    gap: 15px;
}

#recommended-videos .card {
    width: 225px;
    max-width: 225px;
}

/* お勧め動画のカテゴリ間の空間を狭める */
.category-group {
    margin-bottom: 10px; /* カテゴリ間の間隔を狭める */
}

.category-title {
    margin-bottom: 5px; /* カテゴリタイトルとカードの間隔を狭める */
    font-size: 1.1rem;
    color: #333;
    font-weight: bold;
}

/* お勧め動画タブの下部マージンを30pxに設定 */
#recommended-videos.tab-content {
    margin-bottom: 30px;
}

/* お勧め動画のresults-gridの下部マージンを20pxに設定 */
#recommended-videos .results-grid {
    margin-bottom: 20px;
}

/* お勧め動画のcardsの下部マージンを20pxに設定 */
#recommended-videos .cards:last-child {
    margin-bottom: 20px;
}

/* 統一推薦システム用スタイル */
.item-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-type-badge.video {
    background-color: rgba(255, 0, 0, 0.8);
}

.item-type-badge.link {
    background-color: rgba(0, 123, 255, 0.8);
}

.item-type-badge.goods {
    background-color: rgba(40, 167, 69, 0.8);
}

/* グッズ表示用グリッドコンテナ */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px auto;
    max-width: 1200px;
    padding: 0 20px;
}

.affiliate-container {
    border: 1px solid #95A5A6;
    border-radius: 0.75rem;
    background-color: #FFFFFF;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.affiliate-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.affiliate-container img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 8px;
}

.affiliate-comment {
    margin: 10px 0;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
        padding: 0 15px;
    }
    
    .affiliate-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 10px;
    }
    
    .affiliate-container {
        padding: 12px;
    }
    
    .item-type-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* ===== プルダウンメニューのセンタリング ===== */
.videos-header,
.links-header,
.goods-header {
    text-align: center;
    margin-bottom: 20px;
}

.videos-category-filter,
.links-category-filter,
.goods-category-filter {
    display: inline-block;
    margin: 10px auto;
}

.videos-header h2,
.links-header h2,
.goods-header h2 {
    display: inline-block;
    margin-right: 20px;
    margin-bottom: 0;
}

/* ===== グッズハイライト ===== */
.goods-highlight {
    border: 3px solid #ff6b6b !important;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5) !important;
    transform: scale(1.05);
    transition: all 0.3s ease;
    background-color: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
}

.goods-highlight::before {
    content: "🎯 指定された商品";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ff6b6b;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}
