/* ═══════════════════════════════════════════════════════════════
   GhenhuaPlayer - Netflix-style M3U8 Player
   Premium Dark Theme with Glassmorphism
   ═══════════════════════════════════════════════════════════════ */

:root {
    --gp-primary: #e50914;
    --gp-primary-hover: #f40612;
    --gp-primary-glow: rgba(229, 9, 20, 0.4);
    --gp-bg: #000000;
    --gp-surface: rgba(20, 20, 20, 0.95);
    --gp-surface-hover: rgba(40, 40, 40, 0.95);
    --gp-text: #ffffff;
    --gp-text-secondary: rgba(255, 255, 255, 0.7);
    --gp-text-muted: rgba(255, 255, 255, 0.4);
    --gp-border: rgba(255, 255, 255, 0.08);
    --gp-glass: rgba(0, 0, 0, 0.6);
    --gp-glass-strong: rgba(0, 0, 0, 0.85);
    --gp-gradient-controls: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 40%, transparent 100%);
    --gp-gradient-top: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    --gp-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --gp-radius: 6px;
    --gp-radius-lg: 10px;
    --gp-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --gp-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--gp-bg);
    font-family: var(--gp-font);
    color: var(--gp-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Player Container - Full Screen */
#player-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* ─── ArtPlayer Theme Overrides ─── */

.art-video-player {
    --art-theme: #f00;
    --art-font-color: #fff;
    --art-background-color: #000;
    --art-text-shadow-color: rgba(0, 0, 0, .5);
    --art-transition-duration: .2s;
    --art-padding: 10px;
    --art-border-radius: 3px;
    --art-progress-height: 6px;
    --art-progress-color: rgba(255, 255, 255, .25);
    --art-progress-top-gap: 10px;
    --art-hover-color: rgba(255, 255, 255, .25);
    --art-loaded-color: rgba(255, 255, 255, .25);
    --art-state-size: 80px;
    --art-state-opacity: .8;
    --art-bottom-height: 100px;
    --art-bottom-offset: 20px;
    --art-bottom-gap: 5px;
    --art-highlight-width: 8px;
    --art-highlight-color: rgba(255, 255, 255, .5);
    --art-control-height: 46px;
    --art-control-opacity: .75;
    --art-control-icon-size: 36px;
    --art-control-icon-scale: 1.1;
    --art-volume-height: 120px;
    --art-volume-handle-size: 14px;
    --art-lock-size: 36px;
    --art-indicator-scale: 0;
    --art-indicator-size: 16px;
    --art-fullscreen-web-index: 9999;
    --art-settings-icon-size: 24px;
    --art-settings-max-height: 300px;
    --art-selector-max-height: 300px;
    --art-contextmenus-min-width: 250px;
    --art-subtitle-font-size: 20px;
    --art-subtitle-gap: 5px;
    --art-subtitle-bottom: 15px;
    --art-subtitle-border: #000;
    --art-widget-background: rgba(0, 0, 0, .85);
    --art-tip-background: rgba(0, 0, 0, .7);
    --art-scrollbar-size: 4px;
    --art-scrollbar-background: rgba(255, 255, 255, .25);
    --art-scrollbar-background-hover: rgba(255, 255, 255, .5);
    --art-mini-progress-height: 2px;
}

/* Bottom controls gradient */
.art-video-player .art-bottom {
    background: var(--gp-gradient-controls) !important;
    padding: 0 16px 12px !important;
}

/* Progress bar */
.art-video-player .art-progress {
    height: 4px !important;
    transition: height var(--gp-transition) !important;
}

.art-video-player .art-progress:hover {
    height: 7px !important;
}

.art-video-player .art-progress .art-progress-loaded {
    background: rgba(255, 255, 255, 0.25) !important;
}

.art-video-player .art-progress .art-progress-played {
    background: var(--gp-primary) !important;
}

.art-video-player .art-progress .art-progress-highlight {
    background: rgba(255, 255, 255, 0.15) !important;
}

.art-video-player .art-progress .art-progress-indicator {
    background: var(--gp-primary) !important;
    border: 2px solid #fff !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    box-shadow: 0 0 10px var(--gp-primary-glow) !important;
    transform: scale(0) !important;
    transition: transform var(--gp-transition) !important;
}

.art-video-player .art-progress:hover .art-progress-indicator {
    transform: scale(1) !important;
}

/* Control buttons */
.art-video-player .art-controls .art-control {
    color: var(--gp-text) !important;
    opacity: 0.9 !important;
    transition: all var(--gp-transition) !important;
}

.art-video-player .art-controls .art-control:hover {
    opacity: 1 !important;
    transform: scale(1.1) !important;
}

.art-video-player.art-mask-show .art-state {
    pointer-events: auto;
    opacity: var(--art-state-opacity);
    transform: scale(1);
}

.art-controls-left{
    gap: 5px;
}

/* Volume slider */
.art-video-player .art-volume-panel .art-volume-slider-handle {
    background: var(--gp-primary) !important;
}

/* Time display */
.art-video-player .art-control-time {
    font-family: var(--gp-font) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px !important;
    color: var(--gp-text-secondary) !important;
}

/* Settings panel */
.art-video-player .art-settings {
    background: var(--gp-glass-strong) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: var(--gp-radius-lg) !important;
    box-shadow: var(--gp-shadow) !important;
    overflow: hidden !important;
}

.art-video-player .art-setting-item {
    transition: background var(--gp-transition) !important;
}

.art-video-player .art-setting-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.art-video-player .art-setting-item-left-icon svg {
    fill: var(--gp-text-secondary) !important;
}

/* Info panel / layer */
.art-video-player .art-info {
    background: var(--gp-glass-strong) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: var(--gp-radius-lg) !important;
    font-family: var(--gp-font) !important;
}

/* Subtitle styling */
.art-video-player .art-subtitle {
    font-family: var(--gp-font) !important;
    font-weight: 500 !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.9) !important;
}

/* Contextmenu */
.art-video-player .art-contextmenus {
    background: var(--gp-glass-strong) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: var(--gp-radius-lg) !important;
    box-shadow: var(--gp-shadow) !important;
    overflow: hidden !important;
}

.art-video-player .art-contextmenu {
    transition: background var(--gp-transition) !important;
    font-family: var(--gp-font) !important;
}

.art-video-player .art-contextmenu:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--gp-primary) !important;
}

/* Notice / Toast */
.art-video-player .art-notice {
    font-family: var(--gp-font) !important;
}

.art-video-player .art-notice .art-notice-inner {
    background: var(--gp-glass-strong) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: var(--gp-radius) !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: var(--gp-shadow) !important;
}

/* Mask / Play button overlay */
.art-video-player .art-mask .art-state {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: scale(2);
    width: var(--art-state-size);
    height: var(--art-state-size);
    transition: all var(--art-transition-duration) ease;
}

.art-video-player .art-mask .art-state:hover {
    transform: scale(1.1) !important;
    opacity: 1 !important;
}

/* Hover layer - top gradient */
.art-video-player .art-hover-layer {
    background: var(--gp-gradient-top) !important;
    height: 120px !important;
}

/* Tooltip */
.art-video-player .art-tip {
    background: var(--gp-glass-strong) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: var(--gp-radius) !important;
    font-family: var(--gp-font) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    box-shadow: var(--gp-shadow) !important;
}

/* Thumbnail preview on progress hover */
.art-video-player .art-progress .art-progress-tip {
    background: var(--gp-glass-strong) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid var(--gp-border) !important;
    border-radius: var(--gp-radius) !important;
    box-shadow: var(--gp-shadow) !important;
}

/* Scrollbar inside settings */
.art-video-player .art-settings::-webkit-scrollbar {
    width: 4px;
}

.art-video-player .art-settings::-webkit-scrollbar-track {
    background: transparent;
}

.art-video-player .art-settings::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* ─── Custom Controls ─── */

/* Skip buttons */
.gp-skip-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--gp-radius);
    color: var(--gp-text);
    font-family: var(--gp-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--gp-transition);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

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

.gp-skip-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Quality badge */
.gp-quality-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--gp-primary);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    text-transform: uppercase;
}

/* ─── Loading Overlay ─── */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Netflix-style loading bars */
.netflix-loader {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 40px;
}

.loader-bar {
    width: 5px;
    height: 10px;
    background: var(--gp-primary);
    border-radius: 2px;
    animation: netflix-bars 1.2s ease-in-out infinite;
}

.loader-bar:nth-child(1) { animation-delay: 0s; }
.loader-bar:nth-child(2) { animation-delay: 0.1s; }
.loader-bar:nth-child(3) { animation-delay: 0.2s; }
.loader-bar:nth-child(4) { animation-delay: 0.3s; }
.loader-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes netflix-bars {
    0%, 100% {
        height: 10px;
        opacity: 0.4;
    }
    50% {
        height: 40px;
        opacity: 1;
    }
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--gp-text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: pulse-text 2s ease-in-out infinite;
}

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

/* ─── Error Overlay ─── */
.error-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.error-icon {
    width: 56px;
    height: 56px;
    color: var(--gp-primary);
    animation: error-pulse 2s ease-in-out infinite;
}

@keyframes error-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

.error-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gp-text);
}

.error-content p {
    font-size: 14px;
    color: var(--gp-text-secondary);
    line-height: 1.6;
}

.retry-btn {
    margin-top: 8px;
    padding: 12px 32px;
    background: var(--gp-primary);
    color: #fff;
    border: none;
    border-radius: var(--gp-radius);
    font-family: var(--gp-font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--gp-transition);
    letter-spacing: 0.3px;
}

.retry-btn:hover {
    background: var(--gp-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--gp-primary-glow);
}

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

/* ─── Custom Keyboard Shortcut Overlay ─── */
.gp-shortcut-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.gp-shortcut-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.gp-shortcut-toast svg {
    width: 36px;
    height: 36px;
    fill: white;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .art-video-player .art-bottom {
        padding: 0 8px 8px !important;
    }

    .art-video-player .art-control-time {
        font-size: 11px !important;
    }

    .gp-skip-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .art-video-player .art-mask .art-state {
        width: 56px !important;
        height: 56px !important;
    }
}

@media (max-width: 480px) {
    .gp-skip-btn span {
        display: none;
    }

    .gp-skip-btn {
        padding: 8px;
    }
}
