/* 閲覧履歴オーバーレイ */
.history-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    transition: transform 0.3s ease;
}

.history-overlay.collapsed {
    transform: translateY(calc(100% - 40px));
}

.history-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
}

.history-overlay-header:hover {
    background: linear-gradient(135deg, #1f1f3a 0%, #1a2744 100%);
}

.history-overlay-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-overlay-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.3s ease;
}

.history-overlay.collapsed .history-overlay-toggle {
    transform: rotate(180deg);
}

.history-overlay-content {
    background: #212529;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.history-overlay-list {
    display: flex;
    gap: 12px;
    padding-bottom: 4px;
}

.history-overlay-item {
    flex-shrink: 0;
    width: 100px;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s ease;
}

.history-overlay-item:hover {
    transform: translateY(-4px);
}

.history-overlay-thumb {
    width: 100px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    background: #333;
}

.history-overlay-item-title {
    font-size: 11px;
    line-height: 1.3;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
}

.history-overlay-empty {
    color: #888;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.history-overlay-clear {
    background: none;
    border: 1px solid #666;
    color: #aaa;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-overlay-clear:hover {
    background: #444;
    color: #fff;
    border-color: #888;
}

/* 検索ボックスエリア */
.search-box-area {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px 0;
    margin-bottom: 20px;
}

.search-box-area .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.search-box-form {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.search-box-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 17px;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.search-box-input::placeholder {
    color: #999;
}

.search-box-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.search-box-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .history-overlay-item {
        width: 80px;
    }

    .history-overlay-thumb {
        width: 80px;
        height: 45px;
    }

    .history-overlay-item-title {
        font-size: 10px;
    }

    .search-box-form {
        flex-direction: column;
    }

    .search-box-btn {
        width: 100%;
    }
}

/* ========================================
   最近見た動画サイドバーウィジェット
   ======================================== */
.sidebar-widget.history-widget {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.sidebar-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 12px 16px;
}

.sidebar-widget-title {
    font-size: 14px;
    font-weight: 600;
}

.sidebar-widget-body {
    padding: 12px;
    background: #f8f9fa;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: #333;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-item-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #ddd;
}

.history-item-title {
    font-size: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.history-empty {
    color: #888;
    font-size: 13px;
    text-align: center;
    padding: 20px 10px;
    margin: 0;
}

.history-clear-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-clear-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.6);
}

/* ========================================
   広告オーバーレイ
   ======================================== */
.ad-overlay {
    position: fixed;
    z-index: 9998;
    display: none;
}

/* bottom bar */
.ad-overlay.bottom {
    left: 0;
    right: 0;
    bottom: 0;
}
.ad-overlay.bottom .ad-overlay-inner {
    margin: 0 auto;
    max-width: 1200px;
    border-radius: 10px 10px 0 0;
}

/* top bar */
.ad-overlay.top {
    left: 0;
    right: 0;
    top: 0;
}
.ad-overlay.top .ad-overlay-inner {
    margin: 0 auto;
    max-width: 1200px;
    border-radius: 0 0 10px 10px;
}

/* right card */
.ad-overlay.right {
    right: 12px;
    bottom: 12px;
    max-width: 320px;
}
.ad-overlay.right .ad-overlay-inner {
    border-radius: 10px;
    flex-direction: column;
    align-items: stretch;
    position: relative;
}
.ad-overlay.right .ad-overlay-text {
    margin-right: 0;
    margin-bottom: 8px;
}
.ad-overlay.right .ad-overlay-cta {
    width: 100%;
    text-align: center;
}
.ad-overlay.right .ad-overlay-close {
    position: absolute;
    top: 4px;
    right: 6px;
}

.ad-overlay-inner {
    background: var(--ad-overlay-bg, #212529);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.ad-overlay-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.ad-overlay-cta {
    display: inline-block;
    background: var(--ad-overlay-cta, #e60073);
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    transition: filter 0.2s ease, transform 0.2s ease;
}
.ad-overlay-cta:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.ad-overlay-close {
    background: transparent;
    color: #bbb;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    line-height: 1;
    transition: color 0.2s ease;
}
.ad-overlay-close:hover {
    color: #fff;
}

@media (max-width: 768px) {
    .ad-overlay.bottom .ad-overlay-inner,
    .ad-overlay.top .ad-overlay-inner {
        border-radius: 10px 10px 0 0;
        flex-wrap: wrap;
    }
    .ad-overlay-text {
        font-size: 13px;
        width: 100%;
        margin-bottom: 8px;
    }
    .ad-overlay-cta {
        flex: 1;
    }
}

/* ========================================
   みんなの検索ワード ウィジェット
   ======================================== */
.search-keywords-widget {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.search-keywords-widget h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e91e63;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-keywords-widget h3::before {
    content: "🔍";
}

.search-keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-keyword-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.search-keyword-item:hover {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(233, 30, 99, 0.3);
}

.search-keyword-item .count {
    font-size: 0.7rem;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 10px;
}

.search-keyword-item:hover .count {
    background: rgba(255, 255, 255, 0.25);
    opacity: 1;
}

/* 検索結果の現在のフィルター表示 */
.current-filter {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #1565c0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.current-filter strong {
    color: #0d47a1;
}

.clear-filter {
    color: #e53935;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 4px 10px;
    background: rgba(229, 57, 53, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.clear-filter:hover {
    background: #e53935;
    color: #fff;
}

/* 検索結果なしの表示 */
.no-videos {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.no-videos p {
    color: #666;
    font-size: 1rem;
    margin-bottom: 10px;
}

.no-videos p:first-child {
    font-size: 1.1rem;
    color: #333;
}

/* ========================================
   検索キーワード インライン表示(検索フォーム直下)
   タグから探すと似たデザイン(少し色違い)
   ======================================== */
.search-keywords-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px 0;
}

.search-keywords-label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 600;
    margin-right: 5px;
}

.search-keyword-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #fff;
    color: #e91e63;
    text-decoration: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid #e91e63;
    transition: all 0.2s ease;
}

.search-keyword-tag:hover {
    background: #e91e63;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.search-keyword-tag:nth-child(4n+3) {
    color: #9c27b0;
    border-color: #9c27b0;
}
.search-keyword-tag:nth-child(4n+3):hover {
    background: #9c27b0;
    color: #fff;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.search-keyword-tag:nth-child(4n+4) {
    color: #ff5722;
    border-color: #ff5722;
}
.search-keyword-tag:nth-child(4n+4):hover {
    background: #ff5722;
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.search-keyword-tag:nth-child(4n+5) {
    color: #00bcd4;
    border-color: #00bcd4;
}
.search-keyword-tag:nth-child(4n+5):hover {
    background: #00bcd4;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.search-keywords-more {
    font-size: 0.85rem;
    color: #888;
    margin-left: 5px;
}

.search-keywords-list,
.search-keywords-hidden {
    display: inline;
}

.search-keywords-toggle {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.search-keywords-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* フリースペース(検索フォーム上) */
.freespace-above-search {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    text-align: center;
}

.freespace-above-search p {
    margin: 0;
    line-height: 1.6;
}

/* 最近検索されたキーワード(黄色タグ) */
.recent-search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.recent-search-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #333;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.recent-search-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(255, 193, 7, 0.4);
}

.recent-search-tag .tag-icon {
    font-size: 0.8rem;
}
