/**
 * Martin Video Player CSS
 * Responsive video player styles
 */

.martin-video-player {
    position: relative;
    width: 100%;
    margin: 1rem 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mvp-video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

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

/* Custom control overlay */
.mvp-controls-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.martin-video-player:hover .mvp-controls-overlay {
    opacity: 1;
}

.mvp-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 18px;
    font-family: Arial, sans-serif;
    font-weight: bold;
}


.mvp-download-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mvp-download-btn:focus {
    outline: 3px solid #ffff00;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Fullscreen styles */
.martin-video-player:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
}

.martin-video-player:-moz-full-screen {
    width: 100vw !important;
    height: 100vh !important;
}

.martin-video-player:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
}

.martin-video-player:-webkit-full-screen .mvp-video-container {
    padding-bottom: 0;
    height: 100vh;
}

.martin-video-player:-moz-full-screen .mvp-video-container {
    padding-bottom: 0;
    height: 100vh;
}

.martin-video-player:fullscreen .mvp-video-container {
    padding-bottom: 0;
    height: 100vh;
}

/* Loading state */
.mvp-video:not([poster]):not([src]) {
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
                linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* Error message */
.mvp-error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 16px 0;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .martin-video-player {
        margin: 0.5rem 0;
        border-radius: 4px;
    }

    .mvp-controls-overlay {
        opacity: 1; /* Always visible on mobile */
        top: 8px;
        right: 8px;
        gap: 6px;
    }

    .mvp-fullscreen-btn,
    .mvp-download-btn {
        width: 40px;
        height: 40px;
    }

    .mvp-fullscreen-btn svg,
    .mvp-download-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mvp-download-btn {
        background: #000000;
        border: 2px solid #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    .mvp-download-btn:hover {
        background: #ffffff;
        color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mvp-controls-overlay {
        transition: none;
    }

    .mvp-download-btn {
        transition: none;
    }

    .mvp-download-btn:hover {
        transform: none;
    }
}

/* HEVC Notification Overlay */
.mvp-hevc-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.mvp-hevc-notification {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mvp-hevc-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.mvp-hevc-notification h4 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mvp-hevc-notification h5 {
    color: #fc6e6e;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mvp-hevc-notification p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mvp-hevc-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.mvp-try-software-btn,
.mvp-download-video-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mvp-try-software-btn {
    background: #007cba;
    color: white;
}

.mvp-try-software-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.mvp-try-software-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.mvp-download-video-btn {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.mvp-download-video-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.mvp-hevc-status {
    min-height: 24px;
    font-size: 14px;
}

.mvp-loading {
    color: #007cba;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.mvp-success {
    color: #28a745;
    font-weight: 500;
}

.mvp-error {
    color: #dc3545;
    font-weight: 500;
    line-height: 1.4;
}

/* Performance Indicator */
.mvp-performance-indicator {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 193, 7, 0.9);
    color: #856404;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    z-index: 20;
    font-family: monospace;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 193, 7, 0.5);
}

/* FFmpeg-specific indicator */
.mvp-performance-indicator.ffmpeg {
    background: rgba(76, 175, 80, 0.9);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.5);
}

/* H265Web-specific indicator (faster, real-time) */
.mvp-performance-indicator.h265web {
    background: rgba(33, 150, 243, 0.9);
    color: #0d47a1;
    border: 1px solid rgba(33, 150, 243, 0.5);
}

/* Progress bar for heavy operations */
.mvp-progress-bar {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.mvp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #0056b3);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Loading animation for heavy operations */
.mvp-loading.heavy {
    position: relative;
    padding-bottom: 20px;
}

.mvp-loading.heavy::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        #007cba 25%,
        #007cba 75%,
        transparent 100%
    );
    border-radius: 2px;
    animation: loading-slide 2s ease-in-out infinite;
}

@keyframes loading-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile Responsiveness for HEVC Overlay */
@media (max-width: 768px) {
    .mvp-hevc-notification {
        padding: 20px;
        max-width: 320px;
    }

    .mvp-hevc-notification h4 {
        font-size: 16px;
    }

    .mvp-hevc-notification p {
        font-size: 13px;
    }

    .mvp-hevc-actions {
        flex-direction: column;
        gap: 10px;
    }

    .mvp-try-software-btn,
    .mvp-download-video-btn {
        padding: 14px 20px;
        font-size: 14px;
    }

    .mvp-performance-indicator {
        top: 8px;
        left: 8px;
        padding: 3px 6px;
        font-size: 10px;
    }
}

/* High Contrast Mode Support for HEVC Elements */
@media (prefers-contrast: high) {
    .mvp-hevc-notification {
        border: 2px solid #000;
    }

    .mvp-try-software-btn {
        border: 2px solid #005a87;
    }

    .mvp-download-video-btn {
        border: 2px solid #333;
    }

    .mvp-performance-indicator {
        border: 2px solid #856404;
        background: #fff3cd;
    }
}

/* Reduced Motion Support for HEVC Elements */
@media (prefers-reduced-motion: reduce) {
    .mvp-hevc-overlay {
        transition: none;
    }

    .mvp-hevc-notification {
        animation: none;
    }

    .mvp-loading {
        animation: none;
    }

    .mvp-try-software-btn:hover,
    .mvp-download-video-btn:hover {
        transform: none;
    }
}

/* Three dots menu styles */
.mvp-menu-container {
    position: relative;
    display: inline-block;
}

.mvp-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 18px;
    font-family: Arial, sans-serif;
    font-weight: bold;
}

.mvp-menu-button:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mvp-menu-button:focus {
    outline: 3px solid #ffff00;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mvp-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    z-index: 20;
    animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mvp-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.2s ease;
    border-radius: 0;
}

.mvp-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.mvp-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.mvp-menu-item:only-child {
    border-radius: 8px;
}

.mvp-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mvp-menu-item:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile adjustments for three dots menu */
@media (max-width: 768px) {
    .mvp-menu-button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .mvp-menu-dropdown {
        min-width: 160px;
        right: -8px;
    }

    .mvp-menu-item {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* High contrast mode support for menu */
@media (prefers-contrast: high) {
    .mvp-menu-button {
        background: #000000;
        border: 2px solid #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    .mvp-menu-button:hover {
        background: #ffffff;
        color: #000000;
    }

    .mvp-menu-dropdown {
        background: #000000;
        border: 2px solid #ffffff;
    }

    .mvp-menu-item:hover {
        background: #ffffff;
        color: #000000;
    }
}

/* Reduced motion support for menu */
@media (prefers-reduced-motion: reduce) {
    .mvp-menu-button {
        transition: none;
    }

    .mvp-menu-button:hover {
        transform: none;
    }

    .mvp-menu-dropdown {
        animation: none;
    }

    .mvp-menu-item {
        transition: none;
    }
}

/* Print styles */
@media print {
    .martin-video-player {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .mvp-controls-overlay,
    .mvp-hevc-overlay,
    .mvp-performance-indicator,
    .mvp-menu-dropdown {
        display: none;
    }
}