/**
 * IQ YouTube Feed Widget Styles
 */

/* Channel Info Styles */
.iq-youtube-channel-info {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.iq-youtube-channel-image {
    flex: 0 0 80px;
    margin-right: 20px;
}

.iq-youtube-channel-image img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.iq-youtube-channel-details {
    flex: 1;
}

.iq-youtube-channel-name {
    margin: 0 0 10px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.iq-youtube-subscriber-count {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.iq-youtube-channel-description {
    white-space: pre-line;
}

.iq-youtube-channel-description p {
    margin: 0px;
}

.iq-youtube-channel-description a {
    color: #065fd4;
    text-decoration: none;
}

.iq-youtube-channel-description a:hover {
    text-decoration: underline;
}

/* Video Grid Styles */
.iq-youtube-feed-container {
    margin-bottom: 30px;
}

.iq-youtube-feed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 20px;
    margin-bottom: 30px;
}

/* Video Item Styles */
.iq-youtube-video-item {
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.iq-youtube-video-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.iq-youtube-video-thumbnail {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.iq-youtube-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.iq-youtube-video-item:hover .iq-youtube-video-thumbnail img {
    transform: scale(1.05);
}

.iq-youtube-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 0, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.iq-youtube-play-button:before {
    content: '';
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid white;
    margin-left: 5px;
}

.iq-youtube-video-item:hover .iq-youtube-play-button {
    background-color: rgba(255, 0, 0, 1);
}

.iq-youtube-video-title {
    padding: 15px 15px 10px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.iq-youtube-video-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.iq-youtube-video-title a:hover {
    color: #ff0000;
}

.iq-youtube-video-description {
    padding: 0 15px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

/* Video Channel Info Styles */
.iq-youtube-video-channel-info {
    padding: 0 15px 15px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.iq-youtube-video-channel-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 12px;
    margin-bottom: 5px;
}

.iq-youtube-video-subscriber-count {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.iq-youtube-subscribe-button {
    display: inline-block;
    background-color: #ff0000;
    color: white;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 3px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.iq-youtube-subscribe-button:hover {
    background-color: #cc0000;
    color: white;
    text-decoration: none;
}

/* Load More Button Styles */
.iq-youtube-load-more-container {
    text-align: center;
    margin-top: 20px;
}

.iq-youtube-load-more {
    display: inline-block;
    padding: 12px 24px;
    background-color: #ff0000;
    color: white;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.iq-youtube-load-more:hover {
    background-color: #cc0000;
}

/* Error Message Styles */
.iq-youtube-feed-error {
    padding: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Custom Video Modal Styles (YouTube Style) */
.iq-youtube-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.iq-youtube-modal.is-open {
    display: block !important;
    overflow-y: scroll;
    overflow-x: hidden;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Special styles for Elementor editor to ensure modal is visible */
.elementor-editor-active .iq-youtube-modal.is-open,
.elementor-editor-preview .iq-youtube-modal.is-open {
    z-index: 99999 !important; /* Higher z-index to appear above Elementor UI */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.iq-youtube-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: visible;
    z-index: 9999;
}

/* Special styles for Elementor editor to ensure modal overlay is visible */
.elementor-editor-active .iq-youtube-modal.is-open .iq-youtube-modal-overlay,
.elementor-editor-preview .iq-youtube-modal.is-open .iq-youtube-modal-overlay {
    z-index: 99998 !important; /* Just below the modal container */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.iq-youtube-modal-container {
    position: absolute;
    top: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1480px;
    max-height: 85vh;
    margin-bottom: 5vh;
    /* Background color is now controlled by the widget settings */
    overflow: visible;
    display: flex;
    flex-direction: column;
    z-index: 10000;
}

/* Special styles for Elementor editor to ensure modal container is visible */
.elementor-editor-active .iq-youtube-modal.is-open .iq-youtube-modal-container,
.elementor-editor-preview .iq-youtube-modal.is-open .iq-youtube-modal-container {
    z-index: 100000 !important; /* Higher than overlay */
    position: absolute !important;
    top: 5vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 1480px !important;
    max-height: 85vh !important;
    margin-bottom: 5vh !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Top div with close button (no padding) */
.iq-youtube-modal-top {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    z-index: 10001;
    overflow: visible;
}

.iq-youtube-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #333333;
    cursor: pointer;
    padding: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Middle div with YouTube video (no padding) */
.iq-youtube-modal-middle {
    padding: 0;
    overflow: visible;
    background-color: inherit;
}

/* Bottom div with channel info (with padding) */
.iq-youtube-modal-bottom {
    padding: 20px;
    overflow: visible;
    background-color: inherit;
}


/* Video wrapper */
.iq-youtube-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
    margin-bottom: 24px;
}

.iq-youtube-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Video info section */
.iq-youtube-modal-video-info {
    color: #333;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    overflow: visible;
    background-color: inherit;
}

/* Title and channel info row */
.iq-youtube-modal-title-channel-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    overflow: visible;
}

/* Title and metadata */
.iq-youtube-modal-title-container {
    flex: 1;
    min-width: 300px;
    margin-right: 20px;
    color: #333;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.iq-youtube-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.iq-youtube-modal-metadata {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.iq-youtube-modal-views {
    margin-right: 8px;
}

.iq-youtube-modal-date {
    position: relative;
    padding-left: 12px;
}

.iq-youtube-modal-date:before {
    content: '•';
    position: absolute;
    left: 4px;
}


/* Channel section */
.iq-youtube-modal-channel-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    overflow: visible;
}

.iq-youtube-modal-channel-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
}

.iq-youtube-modal-channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.iq-youtube-modal-channel-details {
    flex: 1;
}

.iq-youtube-modal-channel-name {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.iq-youtube-modal-subscriber-count {
    font-size: 13px;
    color: #666;
}

.iq-youtube-modal-subscribe-button {
    display: inline-block;
    background-color: #cc0000;
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 2px;
    text-decoration: none;
    transition: background-color 0.3s ease;
    margin-top: 8px;
}

.iq-youtube-modal-subscribe-button:hover {
    background-color: #ff0000;
    color: white;
    text-decoration: none;
}

/* Description container */
.iq-youtube-modal-description-container {
    margin-top: 12px;
    overflow: visible;
}

.iq-youtube-modal-video-description {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    padding-left: 20px;
}

/* Collapsed description state */
.iq-youtube-modal-video-description.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

/* Expanded description state */
.iq-youtube-modal-video-description.expanded {
    display: block;
}

/* Show more button styles */
.iq-youtube-modal-read-more {
    display: inline-block;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    text-decoration: none;
    text-transform: uppercase;
}

.iq-youtube-modal-read-more:hover {
    color: #333;
}

/* Comments section */
.iq-youtube-modal-comments-section {
    margin: 0 auto;
    padding: 24px;
    color: #333;
    overflow: visible;
    background-color: inherit;
}

.iq-youtube-modal-comments-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.iq-youtube-modal-comments-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.iq-youtube-modal-comments-count {
    font-size: 14px;
    color: #666;
}

.iq-youtube-modal-comments-placeholder {
    color: #666;
    font-size: 14px;
    padding: 16px 0;
}

/* Comment content styles */
.iq-youtube-modal-comments-content {
    margin-bottom: 24px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Scrollbar styles for comments */
.iq-youtube-modal-comments-content::-webkit-scrollbar {
    width: 8px;
}

.iq-youtube-modal-comments-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.iq-youtube-modal-comments-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.iq-youtube-modal-comments-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Individual comment styles */
.iq-youtube-modal-comment {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Comment author section */
.iq-youtube-modal-comment-author {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}

.iq-youtube-modal-comment-author-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.iq-youtube-modal-comment-author-info {
    display: flex;
    flex-direction: column;
}

.iq-youtube-modal-comment-author-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.iq-youtube-modal-comment-date {
    font-size: 12px;
    color: #666;
}

/* Comment text */
.iq-youtube-modal-comment-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 8px;
    padding-left: 52px; /* Aligns with the author name (40px image + 12px margin) */
}

/* Comment likes */
.iq-youtube-modal-comment-likes {
    display: flex;
    align-items: center;
    padding-left: 52px;
}

.iq-youtube-modal-comment-like-count {
    font-size: 12px;
    color: #666;
}

/* No comments message */
.iq-youtube-modal-no-comments {
    font-size: 14px;
    color: #666;
    padding: 16px 0;
    text-align: center;
}

/* Read More Comments button */
.iq-youtube-modal-read-more-comments-container {
    text-align: center;
    margin-top: 16px;
}

.iq-youtube-modal-read-more-comments {
    display: inline-block;
    background-color: #f2f2f2;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 2px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.iq-youtube-modal-read-more-comments:hover {
    background-color: #e5e5e5;
    color: #333;
    text-decoration: none;
}

/* Feed Comments Styles */
.iq-comment-container {
    margin-top: 15px;
    border-top: 1px solid #e5e5e5;
    padding-top: 15px;
}

.iq-comments-trigger {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    border-radius: 4px;
}

.iq-comments-trigger:hover {
    background-color: #f2f2f2;
}

.iq-comments-trigger svg {
    margin-right: 8px;
    color: #666;
}

.iq-comments-trigger p {
    margin: 0;
}

.iq-comments-wrap {
    display: none;
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.iq-comments-loading {
    text-align: center;
    padding: 15px;
    color: #666;
    font-size: 14px;
}

.iq-comment {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f2f2f2;
}

.iq-comment:last-child {
    border-bottom: none;
}

.iq-comment-author {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}

.iq-comment-author-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.iq-comment-author-info {
    display: flex;
    flex-direction: column;
}

.iq-comment-author-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.iq-comment-date {
    font-size: 12px;
    color: #666;
}

.iq-comment-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 8px;
    padding-left: 52px; /* Aligns with the author name (40px image + 12px margin) */
}

.iq-comment-likes {
    display: flex;
    align-items: center;
    padding-left: 52px;
}

.iq-comment-like-count {
    font-size: 12px;
    color: #666;
}

.iq-no-comments {
    text-align: center;
    padding: 15px;
    color: #666;
    font-size: 14px;
}

.iq-comments-error {
    text-align: center;
    padding: 15px;
    color: #d32f2f;
    font-size: 14px;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .iq-youtube-feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .iq-youtube-modal-container {
        width: 98%;
        top: 10px;
    }
    
    .iq-youtube-video-wrapper {
        margin-bottom: 10px;
    }
}

@media (max-width: 767px) {
    .iq-youtube-channel-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 10px;
        margin-bottom: 20px;
    }

    .iq-youtube-channel-image {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .iq-youtube-feed-grid {
        grid-template-columns: 1fr;
    }

    /* Modal responsive styles */
    .iq-youtube-modal-container {
        width: 98%;
        top: 10px;
    }
    
    .iq-youtube-video-wrapper {
        margin-bottom: 10px;
    }
    
    .iq-youtube-modal-title-channel-row {
        flex-direction: column;
    }

    .iq-youtube-modal-title-container {
        margin-right: 0;
        margin-bottom: 15px;
        width: 100%;
    }

    .iq-youtube-modal-channel-info {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Mobile view padding adjustments */
    .iq-youtube-modal-bottom {
        padding: 10px;
    }
    
    .iq-youtube-modal-video-description {
        padding-left: 10px;
    }
    
    .iq-youtube-modal-comments-section {
        padding: 10px;
    }
    
    /* Move "Latest comment" text under "Comments" title */
    .iq-youtube-modal-comments-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .iq-youtube-modal-comments-count {
        margin-top: 5px;
    }
}