/* General Body Styles (for standalone HTML, but good to have for reference) */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5; /* Light background for the page */
    /* Removed display: flex, justify-content, align-items from body */
    margin: 0;
    overflow-x: hidden; /* Prevent horizontal scroll from layout issues */
}

/* Wrapper for the player to isolate it from theme styles */
.my-player-wrapper {
    width: 100% !important; /* Ensure it takes full width of its parent */
    max-width: 100% !important; /* Ensure it doesn't overflow */
    margin: 0 auto !important; /* Center it if its parent is wider */
    padding: 0 !important; /* Remove any default padding */
    box-sizing: border-box !important; /* Include padding and border in width */
    display: block !important; /* Ensure it behaves as a block element */
    float: none !important; /* Prevent floating issues */
    clear: both !important; /* Clear any floats before/after it */
    /* Add some vertical margin for spacing if needed, e.g., margin-top: 20px; margin-bottom: 20px; */
}


/* Player Container Styles */
.player-container {
    position: relative; /* Crucial for absolute positioning of controls */
    width: 100% !important; /* Ensure full width within its parent */
    max-width: 100% !important; /* Ensure it doesn't overflow */
    background-color: #000; /* Black background for player */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    aspect-ratio: 16 / 9; /* Maintain 16:9 aspect ratio */
    margin: 0 auto !important; /* Center the player */
    padding: 0 !important; /* Remove any default padding from theme */
    border: none; /* Remove any explicit border */
    box-sizing: border-box !important; /* Include padding and border in the element's total width and height */
    display: block !important; /* Ensure it behaves as a block element */
}

/* Video Element Styles */
.player-container video {
    display: block;
    width: 100% !important; /* Ensure full width */
    height: 100% !important; /* Ensure full height */
    object-fit: contain; /* Ensure video fits within its bounds */
    background-color: #000;
    max-width: 100% !important; /* Ensure video doesn't overflow */
}

/* Custom Controls Container */
.custom-controls {
    position: absolute !important; /* Force absolute positioning */
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, rgba(0, 0, 0, 0) 100%);
    padding: 10px 15px !important; /* Re-add desired padding for controls */
    margin: 0 !important; /* Remove all margin */
    display: flex !important; /* Ensure flex display is applied */
    align-items: center;
    justify-content: flex-start !important; /* Ensure elements start from the left */
    width: 100% !important; /* Explicitly ensure full width */
    box-sizing: border-box !important; /* Include padding and border in the element's total width and height */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none; /* Allow clicks to pass through when hidden */
}

.player-container:hover .custom-controls,
.player-container.controls-visible .custom-controls {
    opacity: 1;
    pointer-events: auto; /* Enable clicks when visible */
}

/* Control Buttons */
.control-button {
    background-color: rgba(60, 60, 60, 0.8) !important; /* Dark grey background for buttons */
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.control-button:hover {
    background-color: rgba(80, 80, 80, 0.9) !important; /* Slightly lighter on hover */
    transform: translateY(-1px);
}

.control-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Play/Pause Button Specifics */
.play-pause-button {
    margin-right: 10px;
    border-radius: 4px !important; /* Ensure square corners on left button */
}

/* Progress Bar */
.progress-bar-container {
    flex-grow: 1 !important; /* Ensure it takes available space */
    min-width: 0 !important; /* Allow it to shrink if needed */
    height: 20px;
    display: flex;
    align-items: center;
    margin: 0 !important; /* Remove all margin */
    padding: 0 15px !important; /* Add back horizontal padding */
    cursor: pointer;
    position: relative;
    box-sizing: border-box !important; /* Ensure padding is included in width */
}

.progress-bar-track {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3) !important; /* Light grey track background */
    border-radius: 2px;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: #007bff !important; /* Blue fill for progress */
    border-radius: 2px;
    position: absolute;
    top: 0;
    left: 0;
}

.progress-bar-thumb {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #007bff !important; /* Blue thumb */
    border-radius: 50%;
    transform: translateX(-50%);
    top: 50%;
    margin-top: -6px;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3) !important; /* Blue shadow */
    pointer-events: none; /* Don't interfere with click on track */
}

/* Time Display */
.time-display {
    color: #fff;
    font-size: 14px;
    margin-left: 10px;
    white-space: nowrap; /* Prevent time from wrapping */
    flex-shrink: 0; /* Prevent time display from shrinking */
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    margin-left: auto !important; /* This pushes it and subsequent elements to the right */
    flex-shrink: 0; /* Prevent volume control from shrinking */
}

.volume-slider {
    width: 80px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3) !important; /* Light grey track background */
    border-radius: 2px;
    margin-left: 10px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background-color: #007bff !important; /* Blue thumb */
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3) !important; /* Blue shadow */
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background-color: #007bff !important; /* Blue thumb */
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3) !important; /* Blue shadow */
}

/* New buttons styling (CC, Settings, PiP) */
.cc-button, .settings-button, .pip-button {
    margin-left: 15px; /* Spacing between new buttons and existing ones */
    flex-shrink: 0;
    background-color: rgba(60, 60, 60, 0.8) !important; /* Dark grey background for buttons */
}

.cc-button:hover, .settings-button:hover, .pip-button:hover {
    background-color: rgba(80, 80, 80, 0.9) !important;
}


/* Fullscreen Button */
.fullscreen-button {
    margin-left: 15px;
    flex-shrink: 0; /* Prevent fullscreen button from shrinking */
    background-color: rgba(60, 60, 60, 0.8) !important; /* Dark grey background for button */
    border-top-right-radius: 8px !important; /* Rounded corner for top right */
    border-bottom-right-radius: 8px !important; /* Rounded corner for bottom right */
    border-top-left-radius: 0 !important; /* No rounded corner for top left */
    border-bottom-left-radius: 0 !important; /* No rounded corner for bottom left */
}

.fullscreen-button:hover {
    background-color: rgba(80, 80, 80, 0.9) !important;
}

/* Overlaid Play Button (when video is paused/not started) */
.overlaid-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7); /* Dark semi-transparent background */
    border-radius: 50%;
    padding: 25px; /* Larger button */
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
    z-index: 10; /* Ensure it's above video */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.overlaid-play-button:hover {
    transform: translate(-50%, -50%) scale(1.05);
    background: rgba(0, 0, 0, 0.8);
}

.overlaid-play-button svg {
    width: 60px; /* Larger icon */
    height: 60px;
    color: #ffffff; /* White icon */
}

/* Hide controls when video is paused and not hovered */
.player-container.paused:not(:hover) .custom-controls {
    opacity: 0;
    pointer-events: none;
}

/* Hide overlaid play button when video is playing */
.player-container.playing .overlaid-play-button {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .player-container {
        border-radius: 0; /* No rounded corners on small screens */
        width: 100%;
    }
    .custom-controls {
        padding: 8px 10px;
    }
    .control-button {
        font-size: 20px;
        padding: 3px 8px;
    }
    .volume-slider {
        width: 60px;
    }
    .time-display {
        font-size: 12px;
    }
    .overlaid-play-button {
        padding: 15px;
    }
    .overlaid-play-button svg {
        width: 40px;
        height: 40px;
    }
}

