/*!
 * ==========================================
 * UZDUB Player
 * Style v3.0
 * https://uzdub.net
 * ==========================================
 */

:root {
    --uz-bg: #000;
    --uz-white: #fff;
    --uz-primary: #7367f0;
    --uz-primary-soft: rgba(115, 103, 240, .20);
    --uz-panel: rgba(18, 18, 28, .97);
    --uz-radius: 14px;
    --uz-tr: .22s ease;
    --uz-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================
   Base
========================================== */

.uzdub-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: var(--uz-radius);
    font-family: var(--uz-font);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    outline: none;
}

.uzdub-player *,
.uzdub-player *::before,
.uzdub-player *::after { box-sizing: border-box; }

.uzdub-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    z-index: 1;
    transform-origin: center center;
    transition: filter .2s ease;
}

/* ==========================================
   Embed (iframe)
========================================== */

.uzdub-embed {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
}

.uzdub-embed.show { display: block; }

.uzdub-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.uzdub-embed-mode .uzdub-controls,
.uzdub-embed-mode .uzdub-center-play,
.uzdub-embed-mode .uzdub-settings,
.uzdub-embed-mode .uzdub-watermark {
    display: none !important;
}

/* ==========================================
   Poster
========================================== */

.uzdub-poster {
    position: absolute;
    inset: 0;
    z-index: 8;
    background-size: cover;
    background-position: center;
    background-color: #000;
    display: none;
}

.uzdub-poster.show { display: block; }

.uzdub-poster::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.25);
}

/* ==========================================
   Watermark
========================================== */

.uzdub-watermark {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    z-index: 12;
    opacity: .18;
    transition: var(--uz-tr);
}

.uzdub-watermark span {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    line-height: 1;
}

.uzdub-watermark small {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--uz-primary);
}

.uzdub-player:hover .uzdub-watermark { opacity: .3; }

/* ==========================================
   Loading Spinner
========================================== */

.uzdub-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.22);
    opacity: 0;
    visibility: hidden;
    transition: var(--uz-tr);
    z-index: 20;
}

.uzdub-loading.active {
    opacity: 1;
    visibility: visible;
}

.uzdub-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255,255,255,.15);
    border-top-color: var(--uz-primary);
    border-radius: 50%;
    animation: uzdub-spin .8s linear infinite;
}

@keyframes uzdub-spin { to { transform: rotate(360deg); } }

/* ==========================================
   Center Play Button
========================================== */

.uzdub-center-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 76px;
    height: 76px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(0,0,0,.45), inset 0 0 0 2px var(--uz-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    opacity: 1;
    transition: transform .2s ease, opacity .25s ease, background .2s;
}

.uzdub-center-play:hover {
    transform: translate(-50%, -50%) scale(1.09);
    background: rgba(115, 103, 240, .38);
}

.uzdub-center-play:active {
    transform: translate(-50%, -50%) scale(.94);
}

.uzdub-center-play .material-symbols-rounded { font-size: 44px; }

.uzdub-center-play.hide {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.85);
}

/* ==========================================
   Center Flash (play/pause animation)
========================================== */

.uzdub-center-flash {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 35;
    opacity: 0;
}

.uzdub-center-flash .material-symbols-rounded {
    font-size: 52px;
    color: #fff;
}

.uzdub-center-flash.animate {
    animation: uzdub-flash .65s ease forwards;
}

@keyframes uzdub-flash {
    0%   { opacity: .9; transform: translate(-50%, -50%) scale(.9); }
    40%  { opacity: .9; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0;  transform: translate(-50%, -50%) scale(1.35); }
}

/* ==========================================
   OSD (Volume / Brightness)
========================================== */

.uzdub-osd {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.9);
    min-width: 120px;
    padding: 14px 18px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
}

.uzdub-osd.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.uzdub-osd-icon {
    font-size: 32px;
    color: #fff;
}

.uzdub-osd-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,.25);
    border-radius: 999px;
    overflow: hidden;
}

.uzdub-osd-fill {
    height: 100%;
    background: var(--uz-primary);
    border-radius: 999px;
    transition: width .1s ease;
}

.uzdub-osd-label {
    font-size: 13px;
    color: rgba(255,255,255,.85);
    font-weight: 500;
}

/* ==========================================
   Toast Notification
========================================== */

.uzdub-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(0,0,0,.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 100px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
}

.uzdub-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   Error Screen
========================================== */

.uzdub-error {
    position: absolute;
    inset: 0;
    z-index: 90;
    background: rgba(0,0,0,.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity .3s ease;
}

.uzdub-error.show { opacity: 1; }

.uzdub-error-icon {
    font-size: 56px;
    color: #e74c3c;
    opacity: .85;
}

.uzdub-error-msg {
    color: rgba(255,255,255,.85);
    font-size: 15px;
    text-align: center;
    margin: 0;
    max-width: 260px;
    line-height: 1.5;
}

.uzdub-error-retry {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: var(--uz-primary);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .15s;
}

.uzdub-error-retry:hover { background: #5a52cc; }
.uzdub-error-retry:active { transform: scale(.96); }

.uzdub-error-retry .material-symbols-rounded { font-size: 20px; }

/* ==========================================
   Gesture Hints (double-tap feedback)
========================================== */

.uzdub-gesture-hint {
    position: absolute;
    top: 0;
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    pointer-events: none;
    z-index: 40;
    opacity: 0;
}

.uzdub-gesture-left  { left: 0; }
.uzdub-gesture-right { right: 0; }

.uzdub-gesture-hint .material-symbols-rounded {
    font-size: 40px;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
}

.uzdub-gesture-hint small {
    font-size: 13px;
    color: rgba(255,255,255,.9);
    font-weight: 600;
}

.uzdub-gesture-ripple {
    position: absolute;
    inset: 0;
    border-radius: 0;
    background: rgba(255,255,255,.08);
    opacity: 0;
}

.uzdub-gesture-hint.animate {
    animation: uzdub-gesture-fade .65s ease forwards;
}

.uzdub-gesture-hint.animate .uzdub-gesture-ripple {
    animation: uzdub-gesture-ripple .65s ease forwards;
}

.uzdub-gesture-left  .uzdub-gesture-ripple { border-radius: 0 50% 50% 0; }
.uzdub-gesture-right .uzdub-gesture-ripple { border-radius: 50% 0 0 50%; }

@keyframes uzdub-gesture-fade {
    0%   { opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes uzdub-gesture-ripple {
    0%   { opacity: 0; transform: scale(.8); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: scale(1.1); }
}

/* ==========================================
   Thumbnail Preview
========================================== */

.uzdub-thumbnail {
    position: absolute;
    bottom: 68px;
    pointer-events: none;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transform: translateY(4px);
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
}

/* Show when explicitly set (not via class — JS toggles display) */
.uzdub-thumbnail[style*="display: block"],
.uzdub-thumbnail:not([style*="display: none"]) {
    opacity: 1;
    transform: translateY(0);
}

.uzdub-thumbnail-canvas {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,.25);
    background: #111;
    box-shadow: 0 4px 20px rgba(0,0,0,.6);
    display: block;
}

.uzdub-thumbnail-time {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,.8);
    background: rgba(0,0,0,.65);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Hidden elements for thumbnail generation */
.uzdub-thumb-video,
.uzdub-thumb-canvas {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    top: -9999px;
    left: -9999px;
}

/* ==========================================
   Controls
========================================== */

.uzdub-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 14px 10px;
    background: linear-gradient(
        to top,
        rgba(0,0,0,.92),
        rgba(0,0,0,.38) 60%,
        transparent
    );
    z-index: 50;
    opacity: 1;
    transform: translateY(0);
    transition: opacity .25s ease, transform .25s ease;
}

.uzdub-controls.hide {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

/* Progress Bar */

.uzdub-progress-wrapper {
    width: 100%;
    padding: 8px 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.uzdub-progress {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    transition: height .15s ease;
}

.uzdub-progress-wrapper:hover .uzdub-progress { height: 6px; }

.uzdub-progress-track,
.uzdub-progress-buffer,
.uzdub-progress-played {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 999px;
}

.uzdub-progress-track  { width: 100%; background: rgba(255,255,255,.22); }
.uzdub-progress-buffer { width: 0; background: rgba(255,255,255,.42); }
.uzdub-progress-played { width: 0; background: var(--uz-primary); }

.uzdub-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 14px;
    height: 14px;
    background: var(--uz-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(115,103,240,.8);
    transform: translate(-50%, -50%) scale(0);
    transition: transform .15s ease;
}

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

@media (hover: none) {
    .uzdub-progress { height: 5px; }
    .uzdub-progress-thumb { transform: translate(-50%, -50%) scale(1); }
}

/* Bottom Row */

.uzdub-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.uzdub-left  { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.uzdub-right { display: flex; align-items: center; gap: 2px; }

/* Control Buttons */

.uzdub-play,
.uzdub-volume-button,
.uzdub-pip,
.uzdub-settings-button,
.uzdub-fullscreen {
    position: relative;
    overflow: hidden;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .18s, transform .15s;
    flex-shrink: 0;
}

.uzdub-play:hover,
.uzdub-volume-button:hover,
.uzdub-pip:hover,
.uzdub-settings-button:hover,
.uzdub-fullscreen:hover {
    background: var(--uz-primary-soft);
}

.uzdub-play:active,
.uzdub-fullscreen:active,
.uzdub-pip:active {
    transform: scale(.88);
}

.uzdub-settings-button:hover .material-symbols-rounded {
    transform: rotate(45deg);
}

.uzdub-settings-button .material-symbols-rounded {
    transition: transform .35s ease;
}

.material-symbols-rounded {
    font-size: 26px;
    line-height: 1;
    display: inline-block;
}

.uzdub-time {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
}

.uzdub-time-sep { opacity: .55; margin: 0 3px; }

/* ==========================================
   Ripple Effect
========================================== */

.uzdub-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.28);
    transform: scale(0);
    pointer-events: none;
    animation: uzdub-ripple .6s ease-out forwards;
}

@keyframes uzdub-ripple {
    to { transform: scale(1); opacity: 0; }
}

/* ==========================================
   Volume (inline slider)
========================================== */

.uzdub-volume-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.uzdub-volume-popup {
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width .22s ease, opacity .18s ease;
    display: flex;
    align-items: center;
}

.uzdub-volume-wrapper:hover .uzdub-volume-popup {
    width: 78px;
    opacity: 1;
}

.uzdub-volume {
    width: 70px;
    height: 4px;
    margin: 0 4px;
    accent-color: var(--uz-primary);
    cursor: pointer;
}

/* ==========================================
   Settings Panel
========================================== */

.uzdub-settings {
    position: absolute;
    right: 12px;
    bottom: 62px;
    width: 260px;
    background: var(--uz-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 120;
    box-shadow: 0 16px 48px rgba(0,0,0,.55);
}

.uzdub-settings.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.uzdub-settings-page {
    display: none;
    padding: 6px;
}

.uzdub-settings-page.active {
    display: block;
    animation: uzdub-slide-in .2s ease;
}

@keyframes uzdub-slide-in {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.uzdub-settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .16s;
}

.uzdub-settings-item:hover { background: rgba(255,255,255,.08); }

.uzdub-settings-ico { font-size: 22px; color: var(--uz-primary); }

.uzdub-settings-label { flex: 1; }

.uzdub-settings-value {
    display: flex;
    align-items: center;
    gap: 2px;
    color: rgba(255,255,255,.55);
    font-size: 13px;
}

.uzdub-settings-value .material-symbols-rounded { font-size: 20px; }

.uzdub-settings-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.07);
    margin-bottom: 4px;
    transition: color .15s;
}

.uzdub-settings-head:hover { color: var(--uz-primary); }

.uzdub-settings-note {
    padding: 14px 14px 16px;
    color: rgba(255,255,255,.72);
    font-size: 13px;
    line-height: 1.55;
}

.uzdub-speed-list { max-height: 200px; overflow-y: auto; }

.uzdub-speed-option {
    padding: 11px 14px;
    color: #fff;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background .16s;
}

.uzdub-speed-option:hover { background: rgba(255,255,255,.08); }

.uzdub-speed-option.active { color: var(--uz-primary); font-weight: 600; }

.uzdub-speed-option.active::after {
    content: "check";
    font-family: "Material Symbols Rounded";
    font-size: 20px;
}

/* ==========================================
   Rotate Lock Button
========================================== */

.uzdub-rotate-lock {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 55;
    transition: background .2s;
    overflow: hidden;
}

.uzdub-rotate-lock.show { display: flex; }

.uzdub-rotate-lock:hover { background: var(--uz-primary-soft); }

.uzdub-rotate-lock.locked {
    background: var(--uz-primary);
    color: #fff;
}

/* ==========================================
   Ad Overlay
========================================== */

.uzdub-ad-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: none;
    pointer-events: none;
}

.uzdub-ad-overlay.show { display: block; }

.uzdub-ad-top {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.uzdub-ad-badge {
    background: var(--uz-primary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .4px;
}

.uzdub-ad-countdown {
    background: rgba(0,0,0,.72);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: rgba(255,255,255,.9);
    font-weight: 500;
}

.uzdub-ad-skip {
    position: absolute;
    right: 0;
    bottom: 70px;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,.82);
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
    border-right: none;
    padding: 10px 16px;
    border-radius: 8px 0 0 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
    overflow: hidden;
    position: relative;
}

.uzdub-ad-skip { position: absolute; }

.uzdub-ad-skip:disabled {
    opacity: .7;
    cursor: default;
}

.uzdub-ad-skip:not(:disabled):hover { background: var(--uz-primary); }

.uzdub-ad-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(255,255,255,.18);
}

.uzdub-ad-progress-played {
    height: 100%;
    width: 0;
    background: #f5c518;
    transition: width .2s linear;
}

.uzdub-ad-active .uzdub-center-play,
.uzdub-ad-active .uzdub-progress-wrapper,
.uzdub-ad-active .uzdub-settings-button { display: none; }

/* ==========================================
   Fullscreen State
========================================== */

.uzdub-fullscreen-active {
    border-radius: 0 !important;
}

/* ==========================================
   Responsive — Tablet (768px)
========================================== */

@media (max-width: 768px) {

    .uzdub-controls { padding: 4px 8px 8px; }

    .uzdub-play,
    .uzdub-volume-button,
    .uzdub-pip,
    .uzdub-settings-button,
    .uzdub-fullscreen {
        width: 38px;
        height: 38px;
    }

    .material-symbols-rounded { font-size: 24px; }

    .uzdub-time { font-size: 12px; margin-left: 4px; }

    .uzdub-volume-wrapper { display: none; }

    .uzdub-center-play { width: 68px; height: 68px; }

    .uzdub-center-play .material-symbols-rounded { font-size: 40px; }

    .uzdub-settings { right: 8px; bottom: 56px; width: 232px; }

    .uzdub-watermark span { font-size: 14px; }
    .uzdub-watermark small { font-size: 8px; }

    .uzdub-toast { bottom: 70px; font-size: 12px; }

    .uzdub-thumbnail-canvas { width: 120px; height: 68px; }

    .uzdub-thumbnail { bottom: 58px; }
}

/* ==========================================
   Responsive — Mobile (480px)
========================================== */

@media (max-width: 480px) {

    .uzdub-bottom { gap: 2px; }

    .uzdub-time { font-size: 11px; }

    .uzdub-center-play { width: 60px; height: 60px; }

    .uzdub-ad-skip { bottom: 62px; padding: 8px 12px; font-size: 12px; }

    .uzdub-osd { min-width: 100px; padding: 12px 14px; }

    .uzdub-osd-icon { font-size: 28px; }
}

/* ==========================================
   Landscape phones (fullscreen)
========================================== */

@media (max-height: 480px) and (orientation: landscape) {
    .uzdub-center-play { width: 58px; height: 58px; }
    .uzdub-center-play .material-symbols-rounded { font-size: 36px; }
    .uzdub-controls { padding: 2px 10px 6px; }
}
