/* 閲覧履歴オーバーレイ */
.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: 20px 0;
    margin-bottom: 20px;
}

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

.search-box-form {
    display: flex;
    gap: 10px;
}

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

.search-box-input:focus {
    border-color: #007bff;
}

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

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

.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;
    }
}
