/* Videos Page - White background like YouTube, SUNDUS brand colors */
:root {
    --sundus-teal: rgb(24, 78, 80);
    --sundus-teal-hover: rgb(30, 95, 98);
    --sundus-gold: #DAA14C;
    --sundus-gold-hover: #c8913d;
}

body {
    background: #fff;
    color: #212121;
    font-family: 'Roboto', 'Arial', sans-serif;
    margin: 0;
    padding: 0;
}

.page-wrapper {
    background: #fff;
}

/* Videos page - ensure main header and footer visible (sticky-header shown on scroll only) */
.main-header,
.main-footer {
    display: block !important;
    visibility: visible !important;
}
.main-header .main-box {
    display: flex !important;
}

/* YouTube-Style Top Bar (unused - styles kept for reference) */
.youtube-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #212121;
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid #303030;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 200px;
}

.menu-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    transition: background 0.2s;
}

.menu-icon:hover {
    background: #303030;
}

.youtube-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #fff;
}

.youtube-logo-icon {
    width: 90px;
    height: 20px;
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.youtube-logo-icon::before {
    content: "SUNDUS";
    color: #fff;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 640px;
    margin: 0 auto;
}

.search-container {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 640px;
}

.search-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    background: #121212;
    border: 1px solid #303030;
    border-right: none;
    border-radius: 40px 0 0 40px;
    color: #fff;
    font-size: 16px;
    outline: none;
}

.search-input:focus {
    border-color: #1c62b9;
}

.search-input::placeholder {
    color: #888;
}

.search-button {
    height: 40px;
    width: 64px;
    background: #303030;
    border: 1px solid #303030;
    border-left: none;
    border-radius: 0 40px 40px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
}

.search-button:hover {
    background: #404040;
}

.voice-search {
    width: 40px;
    height: 40px;
    margin-left: 8px;
    background: #181818;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
}

.voice-search:hover {
    background: #303030;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: flex-end;
}

.header-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    transition: background 0.2s;
    position: relative;
}

.header-icon:hover {
    background: #303030;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #c00;
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 500;
}

.create-icon {
    font-size: 16px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #065fd4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

/* Main Content Area - flows below main site header, white like YouTube */
.youtube-main {
    margin-top: 0;
    padding: 24px;
    max-width: 1920px;
    margin-left: auto;
    margin-right: auto;
    min-height: 60vh;
    background: #fff;
}

.youtube-main-top {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
}

/* Video Player Section (Left) */
.video-player-section {
    flex: 1;
    min-width: 0;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.main-plyr-root {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.main-plyr-root .plyr {
    width: 100%;
    height: 100%;
}

.main-plyr-root .plyr__video-wrapper {
    height: 100%;
}

.main-plyr-root .plyr--video .plyr__video-wrapper iframe {
    width: 100%;
    height: 100%;
}

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

.video-info {
    padding: 0 8px;
}

.video-title {
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    margin-bottom: 8px;
    color: #212121;
}

.video-main-date {
    margin: 0 0 16px;
    font-size: 14px;
    color: #606060;
}

.video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.video-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #606060;
    font-size: 14px;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 4px;
}

.video-description-block {
    margin-top: 20px;
    padding: 18px 16px;
    background: #f9f9f9;
    border: 1px solid #ececec;
    border-radius: 10px;
    color: #3d3d3d;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.video-description-block:empty {
    display: none;
}

.channel-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--sundus-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 500;
    flex-shrink: 0;
}

.channel-details {
    flex: 1;
}

.channel-name {
    font-size: 14px;
    font-weight: 500;
    color: #212121;
    margin-bottom: 4px;
}

.channel-subscribers {
    font-size: 12px;
    color: #606060;
}

.subscribe-button {
    padding: 10px 16px;
    background: var(--sundus-teal);
    color: #fff;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.2s;
}

.subscribe-button:hover {
    background: var(--sundus-gold);
}

.video-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f2f2f2;
    border: none;
    border-radius: 18px;
    color: #212121;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.action-button:hover {
    background: #e5e5e5;
}

.action-button i {
    font-size: 16px;
}

.action-button.liked,
.action-button.active {
    background: var(--sundus-teal);
    color: #fff;
}

.action-button.liked:hover,
.action-button.active:hover {
    background: var(--sundus-gold);
    color: #fff;
}

.subscribe-button.subscribed {
    background: #e5e5e5;
    color: #606060;
}

.subscribe-button.subscribed:hover {
    background: #d3d3d3;
    color: #212121;
}

.action-button.loading,
.subscribe-button.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.action-button:disabled,
.subscribe-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Sidebar (Right) */
.video-sidebar {
    width: 402px;
    flex-shrink: 0;
}

.sidebar-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}

.sidebar-tab {
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #606060;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s;
}

.sidebar-tab:hover {
    background: #f2f2f2;
    color: #212121;
}

.sidebar-tab.active {
    background: var(--sundus-teal);
    color: #fff;
}

.sidebar-tab-arrow {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #606060;
    transition: background 0.2s;
}

.sidebar-tab-arrow:hover {
    background: #f2f2f2;
    color: #212121;
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-item {
    display: flex;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.video-item:hover {
    background: #f9f9f9;
}

.video-thumbnail {
    position: relative;
    width: 168px;
    height: 94px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

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

.video-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 500;
}

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

.video-item-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #212121;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-item-channel {
    font-size: 12px;
    color: #606060;
    margin-bottom: 4px;
}

.video-item-meta {
    font-size: 12px;
    color: #606060;
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-item-options {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #606060;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.video-item:hover .video-item-options {
    opacity: 1;
}

.video-item-options:hover {
    background: #e5e5e5;
    color: #212121;
}

.new-badge {
    display: inline-block;
    background: var(--sundus-gold);
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 2px;
    margin-left: 4px;
}

/* Responsive Design */
@media (max-width: 1312px) {
    .video-sidebar {
        width: 360px;
    }
}

@media (max-width: 1024px) {
    .youtube-main-top {
        flex-direction: column;
    }
    
    .video-sidebar {
        width: 100%;
    }
    
    .header-center {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .header-center {
        display: none;
    }
    
    .header-left {
        min-width: auto;
    }
    
    .header-right {
        min-width: auto;
    }
    
    .youtube-main {
        padding: 16px;
    }
    
    .video-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .video-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .action-button {
        flex: 1;
        justify-content: center;
    }
}

/* Loading State */
.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: #fff;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    color: #212121;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.close-modal {
    color: #606060;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close-modal:hover {
    color: #212121;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #212121;
}

.form-group {
    margin-bottom: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    color: #212121;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--sundus-teal);
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--sundus-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: var(--sundus-gold);
}

.modal-switch {
    text-align: center;
    margin-top: 15px;
    color: #606060;
    font-size: 14px;
}

.modal-switch a {
    color: var(--sundus-teal);
    text-decoration: none;
}

.modal-switch a:hover {
    color: var(--sundus-gold);
    text-decoration: underline;
}

.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.message.success {
    background: #0f5132;
    color: #d1e7dd;
    display: block;
}

.message.error {
    background: #842029;
    color: #f8d7da;
    display: block;
}

/* All Videos Grid Section */
.all-videos-section {
    width: 100%;
    margin-top: 40px;
    padding: 0 24px;
}

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

.section-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: #212121;
    margin: 0;
}

.section-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.video-count {
    font-size: 14px;
    color: #606060;
}

.videos-manage-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--sundus-teal);
    text-decoration: none;
}

.videos-manage-link:hover {
    text-decoration: underline;
    color: var(--sundus-gold);
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    width: 100%;
}

.video-grid-item {
    cursor: pointer;
    transition: transform 0.2s;
}

.video-grid-item:hover {
    transform: translateY(-2px);
}

.video-grid-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
}

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

.video-grid-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-grid-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.video-grid-play-overlay i {
    color: #fff;
    font-size: 24px;
    margin-left: 4px;
}

.video-grid-info {
    padding: 0 4px;
}

.video-grid-title {
    font-size: 16px;
    font-weight: 500;
    color: #212121;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-grid-channel {
    font-size: 14px;
    color: #606060;
    margin-bottom: 4px;
}

.video-grid-meta {
    font-size: 13px;
    color: #606060;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Load More Button */
.load-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
    padding: 20px 0;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--sundus-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(24, 78, 80, 0.3);
}

.load-more-btn:hover {
    background: var(--sundus-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.load-more-count {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 400;
}

.load-more-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #606060;
    font-size: 14px;
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid #e5e5e5;
    border-top-color: var(--sundus-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* All videos: Previous / Next pagination */
.videos-grid-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    padding: 16px 0;
}

.videos-grid-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--sundus-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.videos-grid-page-btn:hover:not(:disabled) {
    background: var(--sundus-gold);
}

.videos-grid-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.videos-grid-page-info {
    font-size: 14px;
    color: #606060;
    min-width: 11em;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .all-videos-section {
        padding: 0 16px;
    }
    
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .youtube-main-top {
        flex-direction: column;
    }
    
    .video-player-section {
        width: 100%;
    }
    
    .video-sidebar {
        width: 100%;
        margin-top: 24px;
    }
}
