:root {
    --sidebar-width: 336px;
    --sidebar-min-width: 336px;
    --sidebar-max-width: 500px;
    --primary-color: #6441a5;
    --secondary-color: #392e5c;
    --bg-color: #18181b;
    --text-color: #efeff1;
    --border-color: #3a3a3d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Ajoutez ces lignes pour assurer le scroll approprié */
.container #streams-container {
    grid-auto-flow: row;
    grid-auto-rows: auto;
    align-content: start;
}

/* Assurez un aspect ratio constant pour les players */
.player-container {
    aspect-ratio: 16/9;
}

/* Styles de scrollbar globaux pour tous les éléments */
/* Support pour Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

/* Support pour WebKit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: #5a5a5d;
}

*::-webkit-scrollbar-corner {
    background: var(--bg-color);
}

/* Améliorer le style du scrollbar pour le contenu principal */
.content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Import component stylesheets */
@import url('sidebar.css');
@import url('streamers.css');
@import url('chat.css');
@import url('players.css');
@import url('options.css');

/* Add this to your styles.css file */
.custom-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(20, 20, 20, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    max-width: 350px;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: slide-in 0.5s ease-out;
    transition: all 0.3s ease;
    font-size: 14px;
    line-height: 1.5;
}

/* Different notification types */
.custom-notification.info {
    border-left: 4px solid #3498db;
}

.custom-notification.success {
    border-left: 4px solid #2ecc71;
}

.custom-notification.warning {
    border-left: 4px solid #f39c12;
}

.custom-notification.error {
    border-left: 4px solid #e74c3c;
}

@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.custom-notification.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.5s, transform 0.5s;
}

/* Stack multiple notifications */
.custom-notification:nth-child(n+2) {
    margin-bottom: calc(var(--notification-height, 70px) + 10px);
}

/* Player loading and animations */
.player-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 5;
    font-size: 14px;
}

.player-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(100, 65, 165, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

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

.player-removing {
    animation: fade-out 0.3s ease forwards;
}

@keyframes fade-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

/* Ajouter avec les autres animations dans le fichier styles.css */

/* Animation pour la réorganisation des players */
@keyframes reorder-pulse {
    0% { box-shadow: 0 0 0 0 rgba(100, 65, 165, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(100, 65, 165, 0); }
    100% { box-shadow: 0 0 0 0 rgba(100, 65, 165, 0); }
}

.player-reordered {
    animation: reorder-pulse 0.5s ease-out;
}

/* CSS pour les boutons de chat génériques */
.chat-btn {
    background-color: transparent;
    border: none;
    color: #6441a5;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 16px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn:hover {
    color: #8b5fbf;
    background-color: rgba(100, 65, 165, 0.1);
    transform: scale(1.05);
}

.chat-btn:active {
    transform: scale(0.95);
}

/* Styles pour les boutons de latence */
.latency-btn {
    background-color: transparent;
    border: none;
    color: #f39c12;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 16px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.latency-btn:hover {
    color: #e67e22;
    background-color: rgba(243, 156, 18, 0.1);
    transform: scale(1.05);
}

.latency-btn:active {
    transform: scale(0.95);
}

.latency-btn.has-delay {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.latency-btn.has-delay::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background-color: #e74c3c;
    border-radius: 50%;
    animation: pulse-delay 2s infinite;
}

@keyframes pulse-delay {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Styles pour le modal de latence */
.latency-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.latency-modal .modal-content {
    background-color: var(--bg-color);
    margin: 10% auto;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: modal-slide-in 0.3s ease-out;
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.latency-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px 8px 0 0;
}

.latency-modal .modal-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.latency-modal .modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.latency-modal .modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.latency-modal .modal-body {
    padding: 20px;
}

.latency-info {
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(100, 65, 165, 0.1);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.latency-info p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.latency-info p:last-child {
    margin-bottom: 0;
}

.latency-controls {
    margin-bottom: 20px;
}

.latency-controls label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-color);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

#latency-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

#latency-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#latency-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

#latency-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#latency-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
}

.latency-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    background-color: var(--border-color);
    border: none;
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 80px;
}

.preset-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.latency-preview {
    padding: 15px;
    background-color: rgba(243, 156, 18, 0.1);
    border-radius: 6px;
    border-left: 4px solid #f39c12;
}

.latency-preview .preview-text {
    margin: 0;
    font-size: 14px;
    color: var(--text-color);
}

.latency-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 8px 8px;
}

.latency-modal .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 100px;
}

.latency-modal .btn-secondary {
    background-color: var(--border-color);
    color: var(--text-color);
}

.latency-modal .btn-secondary:hover {
    background-color: #555;
    transform: translateY(-1px);
}

.latency-modal .btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.latency-modal .btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

/* Styles pour le buffer de latence */
.latency-buffer {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7));
    backdrop-filter: blur(10px);
}

.latency-buffer .buffer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.latency-buffer .buffer-info i {
    font-size: 24px;
    color: #f39c12;
    animation: tick 1s infinite;
}

@keyframes tick {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

.latency-buffer .buffer-info span {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* Responsive design pour le modal */
@media (max-width: 600px) {
    .latency-modal .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .latency-presets {
        flex-direction: column;
    }
    
    .preset-btn {
        min-width: auto;
    }
    
    .latency-modal .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .latency-modal .btn {
        width: 100%;
    }
}

/* Classe pour empêcher le scroll quand le modal est ouvert */
body.modal-open {
    overflow: hidden;
}

/* CSS pour les boutons de suppression génériques */
.remove-btn {
    background-color: transparent;
    border: none;
    color: #f44336;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 16px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    color: #ff6b6b;
    background-color: rgba(244, 67, 54, 0.1);
    transform: scale(1.05);
}

.remove-btn:active {
    transform: scale(0.95);
}
