/* =====================================================
   Nautilus Custom Player — movie-web inspired
   Our own HTML5 video player with full controls
   ===================================================== */

/* ─── Player Container ─── */
.naut-player {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.naut-player video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Click target overlay (for play/pause on click) */
.naut-player .click-target {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: pointer;
}

/* ─── Controls Wrapper ─── */
.naut-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 0 12px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7) 40%, rgba(0,0,0,0.9));
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.naut-player.controls-hidden .naut-controls {
    opacity: 0;
    pointer-events: none;
}

/* ─── Progress Bar ─── */
.naut-progress-wrap {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 0;
}

.naut-progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: visible;
    transition: height 0.15s;
}

.naut-progress-wrap:hover .naut-progress-bar {
    height: 6px;
}

.naut-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    pointer-events: none;
}

.naut-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #e44;
    border-radius: 2px;
    pointer-events: none;
}

.naut-progress-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #e44;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.15s;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.naut-progress-wrap:hover .naut-progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

.naut-progress-tooltip {
    position: absolute;
    bottom: 24px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-pixel), monospace;
    pointer-events: none;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.naut-progress-wrap:hover .naut-progress-tooltip {
    opacity: 1;
}

/* ─── Button Row ─── */
.naut-btn-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 2px;
}

.naut-btn-left,
.naut-btn-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.naut-ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    position: relative;
}

.naut-ctrl-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: scale(1.1);
}

.naut-ctrl-btn.active {
    color: #e44;
}

/* Time display */
.naut-time {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-family: var(--font-pixel), monospace;
    white-space: nowrap;
    padding: 0 4px;
}

/* ─── Volume Slider ─── */
.naut-vol-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.naut-vol-slider {
    width: 0;
    overflow: hidden;
    transition: width 0.2s ease;
    display: flex;
    align-items: center;
}

.naut-vol-wrap:hover .naut-vol-slider {
    width: 80px;
}

.naut-vol-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.naut-vol-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.naut-vol-slider input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ─── Subtitle Overlay ─── */
.naut-subtitle-layer {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: bottom 0.3s ease;
    padding: 0 10%;
}

.naut-player.controls-hidden .naut-subtitle-layer {
    bottom: 20px;
}

.naut-sub-line {
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 1.2em;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 2px;
    max-width: 80%;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ─── Settings Overlay ─── */
.naut-settings-panel {
    position: absolute;
    bottom: 60px;
    right: 12px;
    z-index: 30;
    background: rgba(16,16,20,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    min-width: 240px;
    max-height: 350px;
    overflow-y: auto;
    padding: 8px 0;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    display: none;
}

.naut-settings-panel.open {
    display: block;
    animation: settingsSlideUp 0.2s ease;
}

@keyframes settingsSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.naut-settings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    font-family: var(--font-pixel), monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}

.naut-settings-header:hover {
    color: rgba(255,255,255,0.8);
}

.naut-settings-header i {
    font-size: 14px;
}

.naut-settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    color: #fff;
    font-family: var(--font-pixel), monospace;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.naut-settings-item:hover {
    background: rgba(255,255,255,0.08);
}

.naut-settings-item .value {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}

.naut-settings-item.selected {
    color: #e44;
}

.naut-settings-item.selected::before {
    content: "●";
    margin-right: 8px;
    color: #e44;
}

.naut-settings-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 4px 0;
}

/* ─── Source Selection Panel ─── */
.naut-source-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    background: rgba(10,10,15,0.97);
    display: none;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.naut-source-panel.open {
    display: flex;
    animation: settingsSlideUp 0.2s ease;
}

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

.naut-source-panel-header h3 {
    font-family: var(--font-header), cursive;
    font-size: 1.6rem;
    color: var(--gold, #d4af37);
    margin: 0;
}

.naut-source-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.naut-source-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    color: #fff;
    font-family: var(--font-pixel), monospace;
    font-size: 14px;
}

.naut-source-item:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
}

.naut-source-item.active {
    border-color: #e44;
    background: rgba(228,68,68,0.1);
}

.naut-source-item .src-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    font-size: 14px;
}

.naut-source-item .src-name {
    flex: 1;
}

.naut-source-item .src-type {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
}

/* ─── Center Play Button (big circle when paused) ─── */
.naut-center-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 10;
    width: 64px;
    height: 64px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    backdrop-filter: blur(4px);
}

.naut-center-play.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* ─── Loading Spinner ─── */
.naut-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

.naut-loading.visible {
    display: block;
}

.naut-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #e44;
    border-radius: 50%;
    animation: nautSpin 0.8s linear infinite;
}

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

/* ─── Title Overlay (top) ─── */
.naut-title-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 12px 16px;
    background: linear-gradient(rgba(0,0,0,0.7), transparent);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.naut-player.controls-hidden .naut-title-bar {
    opacity: 0;
    pointer-events: none;
}

.naut-back-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.naut-back-btn:hover {
    background: rgba(255,255,255,0.1);
}

.naut-title-text {
    color: #fff;
    font-family: var(--font-pixel), monospace;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Source Badge  ─── */
.naut-source-badge {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 20;
    background: rgba(0,0,0,0.6);
    color: rgba(255,255,255,0.6);
    padding: 4px 10px;
    border-radius: 4px;
    font-family: var(--font-pixel), monospace;
    font-size: 11px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.naut-player.controls-hidden .naut-source-badge {
    opacity: 0;
}

/* ─── Subtitle Styling Classes ─── */
.naut-sub-line.sub-bg-0 { background: transparent; }
.naut-sub-line.sub-bg-25 { background: rgba(0,0,0,0.25); }
.naut-sub-line.sub-bg-50 { background: rgba(0,0,0,0.50); }
.naut-sub-line.sub-bg-75 { background: rgba(0,0,0,0.75); }
.naut-sub-line.sub-bg-100 { background: rgba(0,0,0,1.0); }

.naut-sub-line.sub-bold { font-weight: bold; }

/* ─── Mobile adjustments ─── */
@media (max-width: 600px) {
    .naut-ctrl-btn { font-size: 16px; padding: 4px 6px; }
    .naut-time { font-size: 11px; }
    .naut-sub-line { font-size: 0.9em; padding: 3px 10px; }
    .naut-settings-panel { min-width: 200px; }
    .naut-title-text { font-size: 13px; }
    .naut-vol-wrap:hover .naut-vol-slider { width: 60px; }
}
