/**
 * Video Tutorials Professional Layout Styles
 * Two-column layout with sticky sidebar and YouTube integration
 * Inspired by partner-discounts design with video-specific features
 */

/* === Main Layout Structure === */
.video-tutorial-content {
    background: #ffffff;
    padding: 40px 0;
}

.video-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.video-main-content {
    flex: 1;
    min-width: 65%;
    max-width: 100%;
}

.video-sidebar {
    flex-basis: 320px;
    flex-grow: 0;
    flex-shrink: 0;
    position: -webkit-sticky;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    height: fit-content;
}

/* === Video Header Styling === */
.video-header {
    margin-bottom: 25px;
}

.video-title {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.video-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #666;
    font-size: 0.95rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.video-meta-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-meta-info a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

.video-meta-info a:hover {
    color: #1e40af;
    text-decoration: underline;
}

/* === Video Player Container === */
.video-player-container {
    margin-bottom: 30px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.responsive-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

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

/* === YouTube Channel Promotional Box === */
.youtube-promo-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #ff0000;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.youtube-promo-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 0, 0, 0.15);
}

.youtube-logo {
    max-width: 120px;
    width: 100%;
    height: auto;
    margin-bottom: 20px;
}

.youtube-promo-box h4 {
    color: #1a1a1a;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.3;
}

.youtube-channel-info {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.youtube-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.youtube-subscribe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: #ff0000;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
}

.youtube-subscribe-btn:hover {
    background: #dc0000;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4);
    color: #ffffff !important;
}

.youtube-subscribe-btn img {
    width: 20px;
    height: 20px;
}

.youtube-channel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: #ffffff;
    color: #ff0000 !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    border: 2px solid #ff0000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.youtube-channel-btn:hover {
    background: rgba(255, 0, 0, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.15);
    color: #ff0000 !important;
}

/* === Recent Videos Section === */
.recent-videos-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.recent-videos-box h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.recent-video-item {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.recent-video-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    border-color: #2563eb;
}

.recent-video-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.recent-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-video-thumbnail::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.7);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.recent-video-title {
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-video-date {
    color: #999;
    font-size: 0.8rem;
}

/* === Table of Contents === */
.video-toc {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-height: 70vh;
    overflow-y: auto;
}

.video-toc h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.video-toc ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.video-toc li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 20px;
}

.video-toc li:before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #2563eb;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.video-toc li:hover:before {
    transform: translateX(3px);
}

.video-toc a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: color 0.2s ease;
    display: block;
}

.video-toc a:hover {
    color: #2563eb;
    text-decoration: none;
}

.video-toc .toc-h3 {
    margin-left: 15px;
    font-size: 0.9rem;
    color: #666;
}

.video-toc .toc-h3:before {
    content: "◦";
    font-size: 1rem;
}

.video-toc a.active {
    color: #2563eb !important;
    font-weight: 600 !important;
    background: rgba(37, 99, 235, 0.1);
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 4px;
}

/* === Video Description Content === */
.video-description-content {
    background: #ffffff;
    padding: 30px 0;
}

.video-description-content h2 {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2563eb;
    scroll-margin-top: 80px;
}

.video-description-content h3 {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    scroll-margin-top: 80px;
}

.video-description-content p {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    font-size: 17px;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.video-description-content ul,
.video-description-content ol {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    font-size: 17px;
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    color: #2c3e50;
}

.video-description-content li {
    margin-bottom: 0.5rem;
}

.video-description-content a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px dotted #2563eb;
    transition: all 0.2s ease;
}

.video-description-content a:hover {
    color: #1e40af;
    border-bottom-style: solid;
}

/* === Video Chapters === */
.video-chapters {
    background: #f8f9fa;
    border-left: 4px solid #2563eb;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.video-chapters h4 {
    margin-top: 0;
    color: #2563eb;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.video-chapters .chapter-note {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 15px;
    font-style: italic;
}

.video-chapters .chapter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.video-chapters .chapter-item:hover {
    background: rgba(37, 99, 235, 0.05);
    transform: translateX(5px);
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.video-chapters .chapter-item.chapter-active {
    background: rgba(37, 99, 235, 0.1);
    border-color: #2563eb;
}

.video-chapters .chapter-time {
    color: #2563eb;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    min-width: 60px;
}

.video-chapters .chapter-title {
    color: #333;
    font-size: 0.95rem;
    flex: 1;
}

.video-chapters .chapter-loading {
    color: #2563eb;
    font-weight: 600;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === Related Videos Section === */
.related-videos-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

.related-videos-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin-bottom: 0.5rem;
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.related-videos-subtitle {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.related-videos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

.related-video-card {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    text-decoration: none !important;
    display: block;
}

.related-video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.15);
    border-color: #2563eb;
}

.related-video-thumbnail-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    overflow: hidden;
}

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

.related-video-card:hover .related-video-thumbnail-container img {
    transform: scale(1.1);
}

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

.related-video-play-button::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 4px;
}

.related-video-card:hover .related-video-play-button {
    background: #ff0000;
    transform: translate(-50%, -50%) scale(1.1);
}

.related-video-content {
    padding: 20px;
}

.related-video-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-video-meta {
    color: #666;
    font-size: 0.9rem;
}

/* === Alert Messages === */
.video-alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.video-alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.video-alert-info {
    background: #d1ecf1;
    border: 1px solid #17a2b8;
    color: #0c5460;
}

.video-alert strong {
    font-weight: 600;
}

.video-alert small {
    display: block;
    margin-top: 4px;
    opacity: 0.9;
}

/* === Mobile Responsiveness === */
@media (max-width: 768px) {
    .video-container {
        flex-direction: column;
        gap: 20px;
        padding: 0 15px;
    }

    .video-main-content {
        min-width: 100%;
        order: 1;
    }

    .video-sidebar {
        position: static;
        width: 100%;
        order: 2;
        margin-top: 30px;
    }

    .video-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .video-meta-info {
        flex-direction: column;
        gap: 8px;
    }

    .youtube-promo-box,
    .recent-videos-box,
    .video-toc {
        padding: 20px;
    }

    .video-description-content h2 {
        font-size: 1.5rem;
    }

    .video-description-content h3 {
        font-size: 1.25rem;
    }

    .video-description-content p,
    .video-description-content ul,
    .video-description-content ol {
        font-size: 16px;
    }

    .related-videos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .related-videos-title {
        font-size: 1.5rem;
    }

    .video-toc {
        display: none;
    }
}

@media (max-width: 576px) {
    .video-tutorial-content {
        padding: 20px 0;
    }

    .video-container {
        padding: 0 10px;
    }

    .video-title {
        font-size: 1.75rem;
    }

    .youtube-promo-box,
    .recent-videos-box,
    .video-toc {
        padding: 15px;
        margin-bottom: 20px;
    }

    .related-videos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .related-videos-section {
        margin-top: 30px;
        padding-top: 20px;
    }

    .recent-video-item {
        flex-direction: column;
        text-align: center;
    }

    .recent-video-thumbnail {
        width: 100%;
        height: 180px;
        margin-bottom: 10px;
    }
}

/* === Loading State === */
.video-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    background: #f8f9fa;
    border-radius: 12px;
}

.video-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* === Share Buttons === */
.video-share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.share-button:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.share-button.facebook { border-color: #1877f2; }
.share-button.facebook:hover { background: rgba(24, 119, 242, 0.1); }

.share-button.twitter { border-color: #1da1f2; }
.share-button.twitter:hover { background: rgba(29, 161, 242, 0.1); }

.share-button.linkedin { border-color: #0077b5; }
.share-button.linkedin:hover { background: rgba(0, 119, 181, 0.1); }

/* === Accessibility === */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}