/**
 * Ultimate Stream Player - Modern UI Styles
 * Version 2.0.0
 */

/* === CSS Variables === */
:root {
    --usp-primary: #10b981;
    --usp-primary-dark: #059669;
    --usp-danger: #ef4444;
    --usp-warning: #f59e0b;
    --usp-bg-dark: #0d1117;
    --usp-bg-card: #161b22;
    --usp-bg-lighter: #21262d;
    --usp-border: #30363d;
    --usp-text: #e6edf3;
    --usp-text-muted: #8b949e;
    --usp-radius: 12px;
    --usp-radius-sm: 8px;
    --usp-shadow: 0 8px 32px rgba(0,0,0,0.4);
    --usp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Container === */
.usp-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--usp-bg-dark);
    color: var(--usp-text);
    border-radius: var(--usp-radius);
    overflow: hidden;
    box-shadow: var(--usp-shadow);
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.usp-container * {
    box-sizing: border-box;
}

/* === Top Bar === */
.usp-top-bar {
    background: linear-gradient(180deg, var(--usp-bg-card) 0%, rgba(22,27,34,0.95) 100%);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--usp-border);
    flex-wrap: wrap;
}

/* === Server Tabs === */
.usp-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.usp-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--usp-bg-lighter);
    border: 1px solid var(--usp-border);
    border-radius: var(--usp-radius-sm);
    color: var(--usp-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--usp-transition);
    white-space: nowrap;
}

.usp-tab:hover {
    background: var(--usp-bg-card);
    color: var(--usp-text);
    border-color: var(--usp-primary);
    transform: translateY(-1px);
}

.usp-tab-active {
    background: linear-gradient(135deg, var(--usp-primary) 0%, var(--usp-primary-dark) 100%);
    color: white;
    border-color: var(--usp-primary);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.usp-tab-active:hover {
    background: linear-gradient(135deg, var(--usp-primary-dark) 0%, var(--usp-primary) 100%);
    color: white;
}

.usp-tab-telegram {
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
    color: white;
    border-color: #0088cc;
}

.usp-tab-telegram:hover {
    background: linear-gradient(135deg, #0077b5 0%, #006699 100%);
    color: white;
}

/* === Status Dots === */
.usp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.usp-status-online {
    background: var(--usp-primary);
    box-shadow: 0 0 8px var(--usp-primary);
    animation: pulse-green 2s infinite;
}

.usp-status-slow {
    background: var(--usp-warning);
    box-shadow: 0 0 8px var(--usp-warning);
}

.usp-status-offline {
    background: var(--usp-danger);
    box-shadow: 0 0 8px var(--usp-danger);
}

.usp-status-unknown {
    background: var(--usp-text-muted);
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* === Quality Badge === */
.usp-quality-badge {
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usp-tab-active .usp-quality-badge {
    background: rgba(255,255,255,0.25);
}

/* === Quick Actions === */
.usp-quick-actions {
    display: flex;
    gap: 8px;
}

.usp-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--usp-bg-lighter);
    border: 1px solid var(--usp-border);
    border-radius: var(--usp-radius-sm);
    color: var(--usp-text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--usp-transition);
}

.usp-quick-btn:hover {
    background: var(--usp-bg-card);
    color: var(--usp-text);
    border-color: var(--usp-primary);
}

.usp-quick-btn svg {
    width: 16px;
    height: 16px;
}

/* === Match Bar === */
.usp-match-bar {
    background: var(--usp-bg-card);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--usp-border);
    flex-wrap: wrap;
    gap: 10px;
}

.usp-match-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.usp-live-badge {
    background: linear-gradient(135deg, var(--usp-danger) 0%, #dc2626 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.usp-match-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--usp-text);
}

.usp-vs {
    color: var(--usp-text-muted);
    padding: 0 8px;
    font-weight: 400;
}

.usp-match-stats {
    display: flex;
    gap: 20px;
}

.usp-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--usp-text-muted);
    font-size: 13px;
}

.usp-stat svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.usp-stat-value {
    font-weight: 600;
    color: var(--usp-text);
}

/* === Player Wrapper === */
.usp-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
    overflow: hidden;
}

.usp-video-container,
.usp-iframe-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.usp-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.usp-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* === Loading === */
.usp-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.9);
    z-index: 10;
}

.usp-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--usp-border);
    border-top-color: var(--usp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.usp-loading-text {
    color: var(--usp-text-muted);
    font-size: 14px;
}

/* === Error Overlay === */
.usp-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.95);
    z-index: 15;
}

.usp-error-icon {
    margin-bottom: 15px;
}

.usp-error-icon svg {
    width: 60px;
    height: 60px;
    fill: var(--usp-danger);
}

.usp-error-message {
    color: var(--usp-text);
    font-size: 18px;
    margin-bottom: 20px;
}

.usp-retry-btn {
    background: linear-gradient(135deg, var(--usp-primary) 0%, var(--usp-primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: var(--usp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--usp-transition);
}

.usp-retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

/* === Poster/Thumbnail === */
.usp-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.usp-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.usp-play-button {
    position: absolute;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--usp-transition);
}

.usp-play-button svg {
    width: 40px;
    height: 40px;
    fill: white;
    margin-left: 5px;
}

.usp-play-button:hover {
    background: var(--usp-primary);
    border-color: var(--usp-primary);
    transform: scale(1.1);
}

/* === Notification === */
.usp-notification {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: var(--usp-radius-sm);
    z-index: 20;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.usp-notification-text {
    color: var(--usp-text);
    font-size: 14px;
}

/* === Overlay Ad === */
.usp-overlay-ad {
    position: absolute;
    padding: 10px;
    z-index: 25;
    background: rgba(0,0,0,0.7);
    border-radius: var(--usp-radius-sm);
}

.usp-overlay-top-left { top: 10px; left: 10px; }
.usp-overlay-top-right { top: 10px; right: 10px; }
.usp-overlay-bottom-left { bottom: 10px; left: 10px; }
.usp-overlay-bottom-right { bottom: 10px; right: 10px; }

.usp-overlay-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--usp-danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === Custom Controls === */
.usp-custom-controls {
    position: absolute;
    bottom: 60px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 15;
}

.usp-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--usp-transition);
}

.usp-control-btn:hover {
    background: var(--usp-primary);
    transform: scale(1.1);
}

.usp-control-btn svg {
    width: 20px;
    height: 20px;
}

/* === Bottom Bar === */
.usp-bottom-bar {
    background: linear-gradient(0deg, var(--usp-bg-card) 0%, rgba(22,27,34,0.95) 100%);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--usp-border);
    flex-wrap: wrap;
    gap: 10px;
}

.usp-bottom-left,
.usp-bottom-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.usp-live-indicator {
    background: var(--usp-danger);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    animation: live-pulse 2s infinite;
}

.usp-time-display {
    color: var(--usp-text);
    font-size: 14px;
    font-weight: 600;
}

.usp-viewers {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--usp-text-muted);
    font-size: 13px;
}

.usp-viewers svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.usp-viewers-count {
    font-weight: 600;
    color: var(--usp-text);
}

/* === Feature Buttons === */
.usp-feature-btn {
    width: 36px;
    height: 36px;
    background: var(--usp-bg-lighter);
    border: 1px solid var(--usp-border);
    border-radius: var(--usp-radius-sm);
    color: var(--usp-text-muted);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--usp-transition);
}

.usp-feature-btn:hover {
    background: var(--usp-bg-card);
    color: var(--usp-text);
    border-color: var(--usp-primary);
}

.usp-feature-btn svg {
    width: 18px;
    height: 18px;
}

.usp-share-twitter:hover {
    color: #1da1f2;
    border-color: #1da1f2;
}

.usp-share-facebook:hover {
    color: #1877f2;
    border-color: #1877f2;
}

/* === Telegram Button === */
.usp-telegram-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
    color: white;
    border-radius: var(--usp-radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--usp-transition);
}

.usp-telegram-btn:hover {
    background: linear-gradient(135deg, #0077b5 0%, #006699 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
}

.usp-telegram-btn svg {
    width: 18px;
    height: 18px;
}

.usp-telegram-icon {
    width: 16px;
    height: 16px;
}

/* === Error Message === */
.usp-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--usp-danger);
    color: var(--usp-danger);
    padding: 15px 20px;
    border-radius: var(--usp-radius-sm);
    text-align: center;
}

/* === Responsive === */
@media (max-width: 768px) {
    .usp-top-bar {
        padding: 8px 10px;
    }
    
    .usp-tabs {
        gap: 5px;
    }
    
    .usp-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .usp-tab-name {
        display: none;
    }
    
    .usp-quality-badge {
        font-size: 9px;
    }
    
    .usp-match-bar {
        padding: 10px;
    }
    
    .usp-match-title {
        font-size: 13px;
    }
    
    .usp-bottom-bar {
        padding: 10px;
    }
    
    .usp-telegram-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .usp-quick-actions {
        display: none;
    }
    
    .usp-match-stats {
        display: none;
    }
    
    .usp-tab {
        padding: 6px 10px;
    }
}

/* === Plyr Customization === */
.plyr {
    --plyr-color-main: var(--usp-primary);
}

.plyr--video {
    background: #000;
}

/* === RTL Support === */
[dir="rtl"] .usp-container {
    direction: rtl;
}

[dir="rtl"] .usp-play-button svg {
    margin-left: 0;
    margin-right: 5px;
}

[dir="rtl"] .usp-match-bar,
[dir="rtl"] .usp-bottom-bar {
    flex-direction: row-reverse;
}

[dir="rtl"] .usp-match-info,
[dir="rtl"] .usp-match-stats,
[dir="rtl"] .usp-bottom-left,
[dir="rtl"] .usp-bottom-right {
    flex-direction: row-reverse;
}
