/* YouTube Top 30 Bulgaria Chart - Frontend Styles */

.yt-top-30-chart-frontend {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.chart-header {
    text-align: center;
    margin-bottom: 30px;
}

.chart-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
    font-weight: 600;
}

.chart-last-updated {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

.chart-last-updated small {
    color: #888;
}

/* View Toggle Buttons */
.chart-view-toggle {
    display: inline-flex;
    gap: 0;
    border: 2px solid #0073aa;
    border-radius: 6px;
    overflow: hidden;
    margin-left: 20px;
    vertical-align: middle;
}

.view-toggle-btn {
    background: #fff;
    border: none;
    border-right: 2px solid #0073aa;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:last-child {
    border-right: none;
}

.view-toggle-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #0073aa;
}

.view-toggle-btn:hover {
    background: #e8f4f8;
}

.view-toggle-btn.active {
    background: #0073aa;
}

.view-toggle-btn.active .dashicons {
    color: #fff;
}

.view-toggle-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.yt-top-30-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.yt-top-30-chart-item {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.yt-top-30-chart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chart-position {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #0073aa;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    z-index: 1;
}

.chart-thumbnail {
    position: relative;
    margin-bottom: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.chart-thumbnail img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.yt-top-30-chart-frontend.view-grid .chart-thumbnail img {
    height: auto;
    object-fit: contain;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.chart-thumbnail:hover .play-overlay {
    opacity: 1;
}

.chart-info {
    padding-top: 5px;
}

.chart-metadata {
    display: block;
}

.chart-info h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    line-height: 1.3;
}

.chart-info h3 a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.chart-info h3 a:hover {
    color: #0073aa;
}

.channel-name {
    color: #666;
    font-size: 14px;
    margin: 0 0 5px 0;
    font-weight: 500;
    display: block;
}

.published-date {
    color: #888;
    font-size: 12px;
    margin: 0 0 8px 0;
    font-style: italic;
    display: block;
}

.video-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.video-stats span {
    color: #888;
    font-size: 13px;
    font-weight: 400;
}

.view-count {
    color: #888;
    font-size: 13px;
    font-weight: 400;
}

.like-count {
    color: #0073aa;
}

.comment-count {
    color: #666;
}

/* Top 3 special styling */
.yt-top-30-chart-item:nth-child(1) {
    border: 2px solid #ffd700;
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
}

.yt-top-30-chart-item:nth-child(2) {
    border: 2px solid #c0c0c0;
    background: linear-gradient(135deg, #f8f8f8 0%, #fff 100%);
}

.yt-top-30-chart-item:nth-child(3) {
    border: 2px solid #cd7f32;
    background: linear-gradient(135deg, #fff7f0 0%, #fff 100%);
}

.yt-top-30-chart-item:nth-child(1) .chart-position {
    background: #ffd700;
    color: #333;
}

.yt-top-30-chart-item:nth-child(2) .chart-position {
    background: #c0c0c0;
    color: #333;
}

.yt-top-30-chart-item:nth-child(3) .chart-position {
    background: #cd7f32;
    color: #fff;
}

/* Responsive design */
@media (max-width: 768px) {
    .yt-top-30-chart-frontend {
        padding: 15px;
    }

    .yt-top-30-chart-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .chart-thumbnail img {
        height: 120px;
    }

    .play-overlay {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .chart-view-toggle {
        margin-left: 0;
        margin-top: 10px;
        display: flex;
    }
    
    .chart-header {
        flex-wrap: wrap;
    }

    /* Grid view thumbnails should show full image */
    .yt-top-30-chart-frontend.view-grid .chart-thumbnail {
        height: auto;
    }

    .yt-top-30-chart-frontend.view-grid .chart-thumbnail img {
        width: 100%;
        height: auto;
        object-fit: contain;
        display: block;
    }

    /* View toggle cleanup on mobile */
    .yt-top-30-chart-frontend .chart-view-toggle {
        margin: 12px auto 0;
        justify-content: center;
        border: none;
        background: transparent;
        gap: 8px;
        padding: 0;
    }

    .yt-top-30-chart-frontend .chart-view-toggle .view-toggle-btn {
        border: 1px solid #0073aa;
        border-radius: 6px;
        padding: 8px 12px;
        background: #fff;
    }

    .yt-top-30-chart-frontend .chart-view-toggle .view-toggle-btn:last-child {
        border-right: 1px solid #0073aa;
    }

    .yt-top-30-chart-frontend .chart-view-toggle .view-toggle-btn.active {
        background: #0073aa;
    }

    .yt-top-30-chart-frontend .chart-view-toggle .view-toggle-btn.active .dashicons {
        color: #fff;
    }
}

@media (max-width: 480px) {
    .yt-top-30-chart-frontend h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .chart-thumbnail img {
        height: 100px;
    }

    .chart-info h3 {
        font-size: 14px;
    }

    .video-stats {
        gap: 10px;
        font-size: 12px;
    }

    .published-date {
        font-size: 11px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .yt-top-30-chart-frontend {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .chart-header h2 {
        color: #e0e0e0;
    }

    .chart-last-updated {
        color: #b0b0b0;
    }

    .chart-last-updated small {
        color: #888;
    }

    .yt-top-30-chart-item {
        background: #2d2d2d;
        border-color: #404040;
    }

    .chart-info h3 a {
        color: #e0e0e0;
    }

    .chart-info h3 a:hover {
        color: #4da6ff;
    }

    .channel-name {
        color: #b0b0b0;
    }

    .published-date {
        color: #999;
    }

    .video-stats span {
        color: #999;
    }

    .view-count {
        color: #999;
    }

    .like-count {
        color: #4da6ff;
    }

    .comment-count {
        color: #b0b0b0;
    }

    .yt-top-30-chart-item:nth-child(1) {
        background: linear-gradient(135deg, #3d3d2d 0%, #2d2d2d 100%);
        border-color: #ffd700;
    }

    .yt-top-30-chart-item:nth-child(2) {
        background: linear-gradient(135deg, #353535 0%, #2d2d2d 100%);
        border-color: #c0c0c0;
    }

    .yt-top-30-chart-item:nth-child(3) {
        background: linear-gradient(135deg, #3a2f26 0%, #2d2d2d 100%);
        border-color: #cd7f32;
    }
    
    /* View toggle in dark mode */
    .chart-view-toggle {
        border-color: #4da6ff;
    }
    
    .view-toggle-btn {
        background: #2d2d2d;
        border-right-color: #4da6ff;
    }
    
    .view-toggle-btn .dashicons {
        color: #4da6ff;
    }
    
    .view-toggle-btn:hover {
        background: #3a3a3a;
    }
    
    .view-toggle-btn.active {
        background: #4da6ff;
    }
    
    .view-toggle-btn.active .dashicons {
        color: #1a1a1a;
    }
    
    /* List view dark mode */
    .yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:nth-child(1) {
        background: linear-gradient(90deg, #3d3d2d 0%, #2d2d2d 100%);
    }

    .yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:nth-child(2) {
        background: linear-gradient(90deg, #353535 0%, #2d2d2d 100%);
    }

    .yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:nth-child(3) {
        background: linear-gradient(90deg, #3a2f26 0%, #2d2d2d 100%);
    }
}

/* Skeleton Loading Styles */
.skeleton-loading {
    pointer-events: none;
}

.yt-top-30-chart-item.skeleton {
    cursor: default;
}

.skeleton-thumbnail {
    width: 100%;
    height: 180px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-title {
    height: 20px;
    width: 90%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-channel {
    height: 16px;
    width: 70%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-stats {
    height: 14px;
    width: 60%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 14px;
    width: 150px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* Fade-in animation for loaded content */
.fade-in {
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Dark mode skeleton styles */
@media (prefers-color-scheme: dark) {
    .skeleton-thumbnail,
    .skeleton-title,
    .skeleton-channel,
    .skeleton-stats,
    .skeleton-text {
        background: linear-gradient(90deg, #3a3a3a 25%, #4a4a4a 50%, #3a3a3a 75%);
        background-size: 400% 100%;
    }
}

/* Video Modal Styles */
.yt-video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.yt-video-modal.active {
    display: block;
}

.yt-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.yt-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    z-index: 10000;
}

.yt-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 40px;
    height: 40px;
    transition: transform 0.2s;
}

.yt-modal-close:hover {
    transform: scale(1.2);
}

.yt-modal-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.yt-modal-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Prevent body scroll when modal is open */
body.yt-modal-open {
    overflow: hidden;
}

/* Modal responsive */
@media (max-width: 768px) {
    .yt-modal-content {
        width: 95%;
    }
    
    .yt-modal-close {
        top: -35px;
        font-size: 35px;
    }
}

@media (max-width: 480px) {
    .yt-modal-close {
        top: -30px;
        right: 10px;
        font-size: 30px;
    }
}

/* List View Styles */
.yt-top-30-chart-frontend.view-list .yt-top-30-chart-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.yt-top-30-chart-frontend.view-list .yt-top-30-chart-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    gap: 20px;
}

.yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:hover {
    transform: translateY(0);
}

.yt-top-30-chart-frontend.view-list .chart-position {
    position: static;
    width: 50px;
    height: 50px;
    font-size: 20px;
    flex-shrink: 0;
}

.yt-top-30-chart-frontend.view-list .chart-thumbnail {
    flex-shrink: 0;
    margin-bottom: 0;
}

.yt-top-30-chart-frontend.view-list .chart-thumbnail img {
    width: 150px;
    height: 85px;
}

.yt-top-30-chart-frontend.view-list .chart-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yt-top-30-chart-frontend.view-list .chart-info h3 {
    margin: 0;
}

.yt-top-30-chart-frontend.view-list .video-stats {
    margin-top: 5px;
}

/* Top 3 special styling for list view */
.yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:nth-child(1) {
    border: 2px solid #ffd700;
    background: linear-gradient(90deg, #fff9e6 0%, #fff 100%);
}

.yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:nth-child(2) {
    border: 2px solid #c0c0c0;
    background: linear-gradient(90deg, #f8f8f8 0%, #fff 100%);
}

/* Mobile list view layout overrides */
@media (max-width: 768px) {
    .yt-top-30-chart-frontend.view-list .yt-top-30-chart-item {
        display: grid;
        grid-template-columns: 26px 64px 1fr;
        grid-template-rows: auto auto;
        gap: 8px 12px;
        padding: 10px;
        align-items: start;
    }

    .yt-top-30-chart-frontend.view-list .chart-position {
        grid-column: 1;
        grid-row: 1 / span 2;
        position: static;
        width: 26px;
        height: 26px;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .yt-top-30-chart-frontend.view-list .chart-thumbnail {
        grid-column: 2;
        grid-row: 1 / span 2;
        margin-bottom: 0;
        align-self: center;
    }

    .yt-top-30-chart-frontend.view-list .chart-thumbnail img {
        width: 64px;
        height: 40px;
        object-fit: cover;
    }

    .yt-top-30-chart-frontend.view-list .chart-info {
        grid-column: 3;
        grid-row: 1 / span 2;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding-top: 0;
        min-width: 0;
    }

    .yt-top-30-chart-frontend.view-list .chart-info h3 {
        font-size: 14px;
        line-height: 1.35;
        margin: 0;
        word-break: break-word;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        line-height: 1.4;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .channel-name {
        display: inline;
        font-size: 12px;
        margin: 0;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .published-date {
        display: inline;
        font-size: 11px;
        margin: 0;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .published-date::before {
        content: "•";
        margin: 0 6px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .video-stats {
        display: inline-flex;
        gap: 6px;
        margin: 0;
        flex-wrap: wrap;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .video-stats span {
        font-size: 11px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .video-stats span::before {
        content: "•";
        margin: 0 6px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .video-stats span:first-child::before {
        content: "";
        margin: 0;
    }

    .yt-top-30-chart-frontend.view-list .play-overlay {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .yt-top-30-chart-frontend.view-list .yt-top-30-chart-item {
        grid-template-columns: 22px 56px 1fr;
        gap: 6px 10px;
        padding: 8px;
    }

    .yt-top-30-chart-frontend.view-list .chart-position {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .yt-top-30-chart-frontend.view-list .chart-thumbnail img {
        width: 56px;
        height: 36px;
    }

    .yt-top-30-chart-frontend.view-list .chart-info h3 {
        font-size: 13px;
        line-height: 1.3;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata {
        gap: 4px;
        font-size: 10px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .channel-name {
        font-size: 11px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .published-date {
        font-size: 10px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .published-date::before,
    .yt-top-30-chart-frontend.view-list .chart-metadata .video-stats span::before {
        margin: 0 4px;
    }

    .yt-top-30-chart-frontend.view-list .chart-metadata .video-stats span {
        font-size: 10px;
    }
}

.yt-top-30-chart-frontend.view-list .yt-top-30-chart-item:nth-child(3) {
    border: 2px solid #cd7f32;
    background: linear-gradient(90deg, #fff7f0 0%, #fff 100%);
}

/* Print styles */
@media print {
    .yt-top-30-chart-frontend {
        padding: 0;
        max-width: none;
    }

    .yt-top-30-chart-grid {
        display: block;
    }

    .yt-top-30-chart-item {
        break-inside: avoid;
        margin-bottom: 20px;
        padding: 10px;
    }

    .chart-thumbnail {
        display: none;
    }

    .play-overlay {
        display: none;
    }
    
    .chart-view-toggle {
        display: none;
    }
}