/* KissKH Video Player Styles - DooPlay 2.5.5.1 Compatible with ISO 639 Support */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Container Styles */
.kisskh-player-container {
    max-width: 100%;
    margin: 20px auto;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.kisskh-player-wrapper {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 600px;
    color: #fff;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(2px);
}

.player-content {
    position: relative;
    z-index: 10;
    height: 100%;
}

/* Desktop Layout */
.desktop-layout {
    display: grid;
    grid-template-columns: 2fr 400px;
    gap: 0;
    min-height: 600px;
}

.video-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
}

.info-section {
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Mobile Layout */
.mobile-layout {
    display: none;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.video-section-mobile {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    overflow: hidden;
}

.info-section-mobile {
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* JW Player Container */
.jwplayer-container,
.jwplayer-container-mobile {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Show Info */
.show-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.show-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #fff;
}

.show-date {
    font-size: 0.875rem;
    color: #a1a1aa;
    margin-bottom: 8px;
}

.meta-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-tag,
.type-tag,
.iso639-tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-tag.ongoing {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.status-tag.completed {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
}

.type-tag {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.iso639-tag {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

/* Action Buttons with Font Awesome Icons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.action-btn.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.action-btn .icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* Ensure Font Awesome icons display properly */
.action-btn .fas,
.action-btn .far {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

/* Description Section */
.description-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
}

.description-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.description-toggle:hover {
    color: #d1d5db;
}

.description-toggle .arrow {
    transition: transform 0.2s ease;
}

.description-content {
    padding-top: 12px;
    color: #d1d5db;
    line-height: 1.6;
    font-size: 0.875rem;
    display: none;
}

/* Episodes Section */
.episodes-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

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

.episodes-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.episode-count {
    font-size: 0.875rem;
    color: #a1a1aa;
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Scrollbar */
.episode-grid::-webkit-scrollbar {
    width: 4px;
}

.episode-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.episode-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.episode-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Episode Buttons */
.button-wrapper {
    position: relative;
}

.episode-btn {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.episode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.episode-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* CC Icon with SVG Data URL */
.episode-btn .cc-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    opacity: 0.8;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 28 28'%3E%3Cpath fill='%23fff' d='M6.25 4A4.25 4.25 0 0 0 2 8.25v11.5A4.25 4.25 0 0 0 6.25 24h15.5A4.25 4.25 0 0 0 26 19.75V8.25A4.25 4.25 0 0 0 21.75 4zm4.801 5.742c.622.093 1.226.319 1.668.672a.75.75 0 1 1-.937 1.172c-.184-.147-.517-.296-.95-.36a2.8 2.8 0 0 0-1.308.108a2.04 2.04 0 0 0-1.048.79C8.206 12.523 8 13.118 8 14s.206 1.477.476 1.876c.27.397.636.648 1.048.79c.42.143.883.17 1.308.108c.433-.065.766-.213.95-.36a.75.75 0 0 1 .937 1.172c-.442.353-1.046.58-1.668.672a4.3 4.3 0 0 1-2.013-.174a3.53 3.53 0 0 1-1.803-1.366c-.472-.695-.735-1.6-.735-2.718s.263-2.023.735-2.718a3.53 3.53 0 0 1 1.803-1.366a4.3 4.3 0 0 1 2.013-.174m10.167.672a.75.75 0 1 1-.936 1.172c-.183-.147-.517-.296-.95-.36a2.8 2.8 0 0 0-1.308.108a2.04 2.04 0 0 0-1.048.79c-.27.399-.476.994-.476 1.876s.206 1.477.476 1.876c.27.397.637.648 1.049.79c.419.143.882.17 1.306.108c.434-.065.768-.213.95-.36a.75.75 0 0 1 .938 1.172c-.443.353-1.046.58-1.668.672a4.3 4.3 0 0 1-2.013-.174a3.53 3.53 0 0 1-1.803-1.366C15.263 16.023 15 15.118 15 14s.263-2.023.735-2.718a3.53 3.53 0 0 1 1.803-1.366a4.3 4.3 0 0 1 2.013-.174c.622.093 1.226.319 1.668.672'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.episode-btn.active .cc-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 28 28'%3E%3Cpath fill='%23000' d='M6.25 4A4.25 4.25 0 0 0 2 8.25v11.5A4.25 4.25 0 0 0 6.25 24h15.5A4.25 4.25 0 0 0 26 19.75V8.25A4.25 4.25 0 0 0 21.75 4zm4.801 5.742c.622.093 1.226.319 1.668.672a.75.75 0 1 1-.937 1.172c-.184-.147-.517-.296-.95-.36a2.8 2.8 0 0 0-1.308.108a2.04 2.04 0 0 0-1.048.79C8.206 12.523 8 13.118 8 14s.206 1.477.476 1.876c.27.397.636.648 1.048.79c.42.143.883.17 1.308.108c.433-.065.766-.213.95-.36a.75.75 0 0 1 .937 1.172c-.442.353-1.046.58-1.668.672a4.3 4.3 0 0 1-2.013-.174a3.53 3.53 0 0 1-1.803-1.366c-.472-.695-.735-1.6-.735-2.718s.263-2.023.735-2.718a3.53 3.53 0 0 1 1.803-1.366a4.3 4.3 0 0 1 2.013-.174m10.167.672a.75.75 0 1 1-.936 1.172c-.183-.147-.517-.296-.95-.36a2.8 2.8 0 0 0-1.308.108a2.04 2.04 0 0 0-1.048.79c-.27.399-.476.994-.476 1.876s.206 1.477.476 1.876c.27.397.637.648 1.049.79c.419.143.882.17 1.306.108c.434-.065.768-.213.95-.36a.75.75 0 0 1 .938 1.172c-.443.353-1.046.58-1.668.672a4.3 4.3 0 0 1-2.013-.174a3.53 3.53 0 0 1-1.803-1.366C15.263 16.023 15 15.118 15 14s.263-2.023.735-2.718a3.53 3.53 0 0 1 1.803-1.366a4.3 4.3 0 0 1 2.013-.174c.622.093 1.226.319 1.668.672'/%3E%3C/svg%3E");
}

/* Bolt-style Loading State */
.kisskh-loading,
.dooplay-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #fff;
    text-align: center;
    min-height: 400px;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
}

.kisskh-loading .loading-content,
.dooplay-loading .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.kisskh-loading .loading-animation,
.dooplay-loading .loading-animation {
    position: relative;
}

.kisskh-loading .loading-logo,
.dooplay-loading .loading-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    animation: pulse-glow 2s ease-in-out infinite;
    margin-bottom: 16px;
}

.kisskh-loading .loading-spinner,
.dooplay-loading .loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    border: 4px solid transparent;
    border-top: 4px solid #3b82f6;
    border-right: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #fff;
}

.loading-text p {
    font-size: 1rem;
    color: #a1a1aa;
    margin: 0 0 16px 0;
    max-width: 400px;
    line-height: 1.5;
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.loading-dots .dot {
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    animation: bounce 1s infinite;
}

.loading-dots .dot:nth-child(2) {
    background: #8b5cf6;
    animation-delay: 0.1s;
}

.loading-dots .dot:nth-child(3) {
    background: #3b82f6;
    animation-delay: 0.2s;
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
    }
}

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

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-8px);
    }
    70% {
        transform: translateY(-4px);
    }
    90% {
        transform: translateY(-2px);
    }
}

/* DooPlay Error State */
.kisskh-error,
.dooplay-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #fff;
    min-height: 400px;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
}

.error-icon {
    width: 64px;
    height: 64px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 24px;
}

.kisskh-error h3,
.dooplay-error h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #fff;
}

.kisskh-error p,
.dooplay-error p {
    font-size: 1rem;
    color: #a1a1aa;
    margin: 0 0 24px 0;
    max-width: 400px;
    line-height: 1.5;
}

.retry-btn,
.dooplay-retry-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.retry-btn:hover,
.dooplay-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Standard JW Player Styling - Remove Red Shadow */
.jwplayer .jw-controls {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)) !important;
}

.jwplayer .jw-progress {
    background: rgba(255, 255, 255, 0.2) !important;
}

.jwplayer .jw-buffer {
    background: rgba(255, 255, 255, 0.4) !important;
}

.jwplayer .jw-progress-bar {
    background: #fff !important;
}

.jwplayer .jw-knob {
    background: #fff !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    box-shadow: none !important;
}

.jwplayer .jw-captions {
    font-family: 'Inter', Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
}

/* DooPlay JW Player Styling - Remove Red Shadow */
.dooplay-theme .jwplayer .jw-controls {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9)) !important;
}

.dooplay-theme .jwplayer .jw-progress {
    background: rgba(255, 255, 255, 0.2) !important;
}

.dooplay-theme .jwplayer .jw-buffer {
    background: rgba(255, 255, 255, 0.4) !important;
}

.dooplay-theme .jwplayer .jw-progress-bar {
    background: #fff !important; /* Changed from red to white */
}

.dooplay-theme .jwplayer .jw-knob {
    background: #fff !important; /* Changed from red to white */
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    box-shadow: none !important; /* Remove any shadow */
}

.dooplay-theme .jwplayer .jw-captions {
    font-family: 'Inter', Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
}

/* Remove any red shadows or glows from JW Player */
.dooplay-theme .jwplayer,
.dooplay-theme .jwplayer *,
.jwplayer,
.jwplayer * {
    box-shadow: none !important;
}

.dooplay-theme .jwplayer .jw-controls * {
    box-shadow: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .desktop-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-section {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 768px) {
    .desktop-layout {
        display: none;
    }
    
    .mobile-layout {
        display: flex;
    }
    
    .kisskh-player-wrapper {
        min-height: auto;
    }
    
    .action-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .action-btn {
        padding: 10px 6px;
        font-size: 0.7rem;
    }
    
    .episode-grid {
        grid-template-columns: repeat(4, 1fr);
        max-height: 200px;
    }
    
    .jwplayer .jw-captions,
    .dooplay-theme .jwplayer .jw-captions {
        font-size: 14px !important;
    }
    
    .kisskh-loading .loading-logo,
    .dooplay-loading .loading-logo {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .kisskh-loading .loading-spinner,
    .dooplay-loading .loading-spinner {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .mobile-layout {
        padding: 15px;
        gap: 15px;
    }
    
    .info-section-mobile {
        padding: 16px;
        gap: 16px;
    }
    
    .show-title {
        font-size: 1.25rem;
    }
    
    .episode-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .action-btn .icon {
        font-size: 1rem;
    }
    
    .jwplayer .jw-captions,
    .dooplay-theme .jwplayer .jw-captions {
        font-size: 12px !important;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .kisskh-player-container {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .kisskh-player-container {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .spinner-circle {
        animation: none;
    }
    
    .episode-btn:hover {
        transform: none;
    }
    
    .action-btn:hover {
        transform: none;
    }
    
    .pulse-glow,
    .loading-logo {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .kisskh-player-container {
        display: none;
    }
}

/* DooPlay Theme Specific Enhancements */
.dooplay-theme.kisskh-player-container {
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.dooplay-theme .status-tag.ongoing {
    background: linear-gradient(135deg, #10b981, #059669);
}

.dooplay-theme .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dooplay-theme .episode-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* ISO 639 Language Support Indicator */
.iso639-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}