/**
 * MobiPlayer Optimized Styles
 * Enhanced UI/UX with performance optimizations
 */

/* Loading animations */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 2rem;
    background: #1a1a1a;
    border-radius: 8px;
    color: #fff;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error handling */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 2rem;
    background: #2c1810;
    border: 2px solid #d63638;
    border-radius: 8px;
    color: #fff;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-container h3 {
    margin: 0 0 1rem 0;
    color: #ff6b6b;
}

.error-container p {
    margin: 0 0 1rem 0;
    opacity: 0.8;
}

.error-container small {
    opacity: 0.6;
    display: block;
    margin-bottom: 1rem;
}

.retry-button {
    background: #007cba;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.retry-button:hover {
    background: #005a87;
}

/* Enhanced server buttons */
.server-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.server-item {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    min-width: 60px;
    text-align: center;
}

.server-item:hover {
    background: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.server-item.active {
    background: #007cba;
    box-shadow: 0 0 10px rgba(0, 124, 186, 0.5);
}

.server-item.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #007cba;
}

/* Enhanced notifications */
.mobi-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
}

.mobi-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.mobi-notification-success {
    background: #27ae60;
}

.mobi-notification-error {
    background: #e74c3c;
}

.mobi-notification-warning {
    background: #f39c12;
}

.mobi-notification-info {
    background: #3498db;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.notification-close:hover {
    opacity: 1;
}

/* Enhanced player container */
.mobi-player {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    margin: 1rem 0;
}

.mobi-player-screen {
    position: relative;
    background: #000;
    min-height: 300px;
}

/* Performance optimizations */
.mobi-player-screen video,
.mobi-player-screen iframe {
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
    will-change: transform;
}

/* Responsive enhancements */
@media (max-width: 768px) {
    .loading-container,
    .error-container {
        min-height: 150px;
        padding: 1rem;
    }
    
    .server-list {
        justify-content: center;
    }
    
    .server-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        min-width: 50px;
    }
    
    .mobi-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .mobi-player-screen {
        min-height: 200px;
    }
}

@media (max-width: 480px) {
    .loading-container,
    .error-container {
        min-height: 120px;
        padding: 0.75rem;
    }
    
    .server-item {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        min-width: 45px;
    }
    
    .mobi-player-screen {
        min-height: 180px;
    }
}

/* Accessibility improvements */
.server-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.retry-button:focus,
.notification-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .loading-container {
        background: #0a0a0a;
    }
    
    .error-container {
        background: #1a0e0a;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }
    
    .server-item,
    .mobi-notification,
    .retry-button {
        transition: none;
    }
    
    .server-item:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .mobi-player,
    .server-list,
    .mobi-notification {
        display: none !important;
    }
}