/* ============================================
   Dezzi Designs Stream Player - Modern Dark Theme
   ============================================ */

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

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: #0a0a0f;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Player Wrapper */
.player-wrapper {
    position: relative;
    width: 100%; height: 100%;
    background: #0a0a0f;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Video Element */
.player-wrapper video {
    width: 100%; height: 100%;
    object-fit: contain;
    background: #0a0a0f;
    display: block;
}

/* Poster Overlay */
.poster-overlay {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #0a0a0f;
    z-index: 2;
    transition: opacity 0.6s ease;
}
.poster-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Gradient Overlays */
.gradient-top {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 90px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    z-index: 3;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.gradient-bottom {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 110px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    z-index: 3;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

/* Auto-hide when idle (only during playback) */
.player-wrapper.idle .gradient-top,
.player-wrapper.idle .gradient-bottom,
.player-wrapper.idle .controls-bar,
.player-wrapper.idle .stream-info {
    opacity: 0;
    pointer-events: none;
}
.player-wrapper.idle { cursor: none; }

/* Status Badge - always visible */
.status-badge {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #fff;
    transition: all 0.4s ease;
    border: 1px solid rgba(255,255,255,0.08);
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Status states */
.status-badge.live .status-dot {
    background: #ff3b3b;
    box-shadow: 0 0 8px rgba(255,59,59,0.6);
    animation: pulse 1.5s ease-in-out infinite;
}
.status-badge.live { color: #ff3b3b; border-color: rgba(255,59,59,0.15); }

.status-badge.offline .status-dot { background: #555; }
.status-badge.offline { color: #888; }

.status-badge.connecting .status-dot {
    background: #ffa500;
    animation: pulse 0.8s ease-in-out infinite;
}
.status-badge.connecting { color: #ffa500; border-color: rgba(255,165,0,0.15); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Stream Info - top left */
.stream-info {
    position: absolute;
    top: 12px; left: 14px;
    z-index: 5;
    transition: opacity 0.4s ease;
}
.stream-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    line-height: 1.3;
}
.stream-subtitle {
    font-size: 11px;
    color: #9090a8;
    margin-top: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    font-weight: 400;
}

/* Controls Bar */
.controls-bar {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 8px;
    background: rgba(8, 8, 16, 0.65);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-top: 1px solid rgba(255,255,255,0.06);
    transition: opacity 0.4s ease;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 1px;
}

/* Control Buttons */
.ctrl-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 7px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    transition: all 0.15s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.ctrl-btn:active {
    transform: scale(0.88);
    background: rgba(255,255,255,0.15);
}
.ctrl-btn svg {
    width: 20px; height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}
.ctrl-btn.accent { color: #00d4ff; }
.ctrl-btn.accent:hover { color: #44eaff; }

/* Skip buttons - number overlay */
.ctrl-btn .skip-number {
    position: absolute;
    font-size: 7.5px;
    font-weight: 800;
    color: currentColor;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-42%, -36%);
    line-height: 1;
}

/* LIVE button */
.live-btn {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255,59,59,0.15);
    color: #ff5555;
    border: 1px solid rgba(255,59,59,0.25);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
}
.live-btn:hover {
    background: rgba(255,59,59,0.25);
    color: #ff7777;
}
.live-btn.at-edge {
    background: #ff3b3b;
    color: #fff;
    border-color: #ff3b3b;
    box-shadow: 0 0 10px rgba(255,59,59,0.3);
}
.live-btn .latency-text {
    font-size: 9px;
    font-weight: 400;
    opacity: 0.8;
    margin-left: 4px;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 0;
}
.volume-slider-wrap {
    width: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding-right: 0;
}
.volume-control:hover .volume-slider-wrap,
.volume-control.expanded .volume-slider-wrap {
    width: 70px;
    padding-right: 4px;
}
.volume-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
}
.volume-slider:hover {
    background: rgba(255,255,255,0.3);
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
    transition: transform 0.15s ease;
}
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.volume-slider::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
}
.volume-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
}
.volume-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
}

/* Control Divider */
.ctrl-divider {
    width: 1px; height: 20px;
    background: rgba(255,255,255,0.1);
    margin: 0 3px;
    flex-shrink: 0;
}

/* Big Play Button */
.big-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    width: 68px; height: 68px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}
.big-play.visible {
    opacity: 1;
    pointer-events: auto;
}
.big-play:hover {
    background: rgba(0,212,255,0.25);
    border-color: rgba(0,212,255,0.6);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 30px rgba(0,212,255,0.2);
}
.big-play:active {
    transform: translate(-50%, -50%) scale(0.95);
}
.big-play svg {
    width: 30px; height: 30px;
    fill: #fff;
    margin-left: 3px;
}

/* Reconnect Overlay */
.reconnect-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(10,10,15,0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}
.reconnect-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.reconnect-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.reconnect-text {
    font-size: 13px;
    color: #8888aa;
    text-align: center;
    line-height: 1.5;
}
.reconnect-text span {
    color: #00d4ff;
    font-weight: 600;
}

/* Tooltip system */
.ctrl-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(15,15,25,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ddd;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    animation: tooltipIn 0.15s ease;
}
@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Keyboard shortcut hint (small text in tooltip) */
.ctrl-btn[data-tooltip][data-key]:hover::after {
    content: attr(data-tooltip) "  [" attr(data-key) "]";
}

/* Responsive - small players */
@media (max-width: 420px) {
    .ctrl-btn svg { width: 18px; height: 18px; }
    .ctrl-btn { padding: 5px; }
    .controls-left, .controls-right { gap: 0; }
    .stream-title { font-size: 12px; }
    .stream-subtitle { font-size: 10px; }
    .status-badge { font-size: 10px; padding: 3px 8px; top: 6px; right: 6px; }
    .big-play { width: 52px; height: 52px; }
    .big-play svg { width: 24px; height: 24px; }
    .controls-bar { padding: 4px 5px 6px; }
    .live-btn { font-size: 9px; padding: 4px 7px; }
    .ctrl-btn .skip-number { font-size: 6.5px; }
}

@media (max-width: 320px) {
    .ctrl-divider { display: none; }
    .stream-subtitle { display: none; }
    .ctrl-btn[data-tooltip]:hover::after { display: none; }
    .volume-control:hover .volume-slider-wrap { width: 50px; }
}

@media (max-height: 280px) {
    .stream-info { top: 6px; left: 8px; }
    .status-badge { top: 6px; right: 6px; padding: 3px 7px; }
    .gradient-top { height: 60px; }
    .gradient-bottom { height: 70px; }
    .big-play { width: 44px; height: 44px; }
    .big-play svg { width: 20px; height: 20px; }
}

/* High contrast for accessibility */
@media (prefers-contrast: high) {
    .ctrl-btn { color: #fff; }
    .controls-bar { background: rgba(0,0,0,0.85); }
    .status-badge { background: rgba(0,0,0,0.85); border: 1px solid rgba(255,255,255,0.3); }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
