/* Video History Styles */
.history-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.history-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.history-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b35;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

/* History Modal */
.history-modal {
    max-width: 800px;
    max-height: 90vh;
    width: 90vw;
    background: #0a0a0a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}

.history-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid #333;
}

.history-modal .modal-header h2 {
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-modal .modal-header h2::before {
    content: '';
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ff6b35, #ff9558);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-modal .close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.history-modal .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* History Controls */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #111;
    border-bottom: 1px solid #333;
}

.clear-history-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 6px;
    color: #ff6b35;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: rgba(255, 107, 53, 0.2);
    border-color: rgba(255, 107, 53, 0.5);
    transform: translateY(-1px);
}

.history-stats {
    color: #999;
    font-size: 14px;
}

.total-videos {
    font-weight: 500;
    color: #fff;
}

/* History List */
.history-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #111;
}

.history-list::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* History Item */
.history-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #111;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-item:hover {
    background: #1a1a1a;
    transform: translateX(4px);
}

.history-thumbnail {
    position: relative;
    width: 120px;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.history-item:hover .history-thumbnail img {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.history-item:hover .play-overlay {
    opacity: 1;
}

.play-overlay svg {
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-channel {
    color: #999;
    font-size: 13px;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.history-time {
    color: #666;
    font-size: 12px;
}

.history-duration {
    color: #999;
    font-size: 12px;
}

.history-category {
    background: rgba(255, 107, 53, 0.2);
    color: #ff6b35;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.history-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-tags .tag {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.history-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.history-actions .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.history-actions .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.history-actions .remove-btn:hover {
    background: rgba(255, 67, 54, 0.2);
    color: #ff4336;
}

/* Empty History */
.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-history svg {
    color: #333;
    margin-bottom: 16px;
}

.empty-history p {
    margin: 8px 0;
    font-size: 16px;
}

.empty-history .empty-subtitle {
    font-size: 14px;
    color: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .history-modal {
        width: 95vw;
        max-height: 95vh;
    }

    .history-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .history-item {
        flex-direction: column;
        gap: 12px;
    }

    .history-thumbnail {
        width: 100%;
        height: 180px;
    }

    .history-actions {
        flex-direction: row;
        justify-content: flex-end;
    }

    .history-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .history-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .history-modal .modal-header {
        padding: 16px 20px;
    }

    .history-modal .modal-header h2 {
        font-size: 20px;
    }

    .history-controls {
        padding: 12px 20px;
    }

    .history-list {
        padding: 4px;
    }

    .history-item {
        padding: 8px;
    }

    .history-thumbnail {
        height: 120px;
    }
}

/* Animation for new items */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-item {
    animation: slideInFromRight 0.3s ease-out;
}

/* Loading state */
.history-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.history-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top-color: #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
