/* =============================================================================
   SEVEN2 POKER - STYLES CENTRALISÉS
   ============================================================================= */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700;900&display=swap');

/* Variables CSS */
:root {
    --copper-light: #e8c199;
    --copper-main: #b8845f;
    --copper-dark: #8b6644;
    --bronze-accent: #cd7f32;
    --dark-bg: #1a1a1a;
    --darker-bg: #0f0f0f;
    --royal-red: #b91d2d;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--darker-bg);
    color: #f3f4f6;
    overflow-x: hidden;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to main content */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--copper-main);
    color: #000;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Typography */
.poker-title {
    font-family: 'Bebas Neue', cursive;
    letter-spacing: 3px;
    font-weight: 700;
}

.royal-font {
    font-family: 'Cinzel', serif;
}

.academic-font {
    font-family: 'Roboto Slab', serif;
}

/* Copper Gradient Text */
.copper-text {
    background: linear-gradient(135deg, var(--copper-light) 0%, var(--copper-main) 50%, var(--copper-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.gold-text {
    background: linear-gradient(to bottom, #cfc09f 22%, #634f2c 24%, #cfc09f 26%, #cfc09f 27%, #ffecb3 40%, #3a2c0f 78%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #fff;
}

/* Cards */
.card-shine {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.08) 0%, rgba(139, 102, 68, 0.12) 100%);
    border: 1px solid rgba(212, 165, 116, 0.25);
    box-shadow: 0 8px 32px rgba(212, 165, 116, 0.1);
}

.bg-dark-card {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
}

/* Chip Icon */
.chip-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--copper-main), var(--copper-dark));
    border: 2px solid var(--copper-light);
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.4);
}

/* Buttons */
.btn-copper {
    background: linear-gradient(135deg, var(--copper-light) 0%, var(--copper-main) 100%);
    color: var(--dark-bg);
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.3);
}

.btn-copper:hover {
    background: linear-gradient(135deg, #f0d4b0 0%, #c99170 100%);
    box-shadow: 0 6px 24px rgba(212, 165, 116, 0.5);
    transform: translateY(-2px);
}

.btn-copper:focus {
    outline: 2px solid var(--copper-light);
    outline-offset: 2px;
}

/* Borders */
.border-copper {
    border-color: rgba(232, 193, 153, 0.4);
}

.gold-border {
    border-color: #cfc09f;
}

/* Backgrounds */
.bg-royal {
    background-color: #0f0b1a;
}

.royal-red {
    background-color: var(--royal-red);
}

.chalkboard {
    background-color: #2b3a42;
}

/* Text Colors */
.text-copper {
    color: var(--copper-light);
}

.text-copper-light {
    color: #f0d4b0;
}

/* Image Background */
#image-background {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    background-image: url('../images/poker-bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#image-background.active {
    opacity: 0.4; /* Réduit l'opacité de l'image de fond */
}

#image-background::after {
    content: '';
    position: absolute;
    inset: 0;
    /* Overlay beaucoup plus sombre pour meilleure lisibilité */
    background: linear-gradient(to bottom right, rgba(0,0,0,0.92), rgba(0,0,0,0.88), rgba(0,0,0,0.95));
    mix-blend-mode: overlay;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--copper-dark);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--copper-main);
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--copper-light);
    outline-offset: 2px;
}

/* Animations */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slide-in 0.3s ease-out;
    min-width: 300px;
}

.toast.success {
    background: #10b981;
    color: white;
}

.toast.error {
    background: #ef4444;
    color: white;
}

.toast.info {
    background: var(--copper-main);
    color: white;
}

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

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* =============================================================================
   CHAT MEDIA STYLES
   ============================================================================= */

/* GIF Picker Modal */
.gif-item {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
}

.gif-item img {
    transition: transform 0.2s;
}

.gif-item:hover img {
    transform: scale(1.05);
}

/* Image Preview */
#imagePreviewContainer {
    animation: fade-in 0.2s ease-out;
}

/* Lightbox */
.z-\\[100\\] {
    z-index: 100;
}

/* Chat Images */
.chat-media-image {
    max-height: 300px;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .chat-media-image {
        max-height: 200px;
    }
    
    #gifPickerGrid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .poker-title {
        font-size: 2rem;
    }
    
    .toast {
        min-width: 250px;
        font-size: 14px;
    }
    
    .toast-container {
        right: 10px;
        left: 10px;
    }
}

/* Print Styles */
@media print {
    #video-background,
    .skip-link,
    button,
    .modal-overlay {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Emoji Picker Styles */
.emoji-picker-custom {
    --border-radius: 12px;
    --background: rgba(26, 26, 26, 0.95);
    --border-color: rgba(232, 193, 153, 0.3);
    --indicator-color: var(--copper-main);
    --input-border-color: rgba(232, 193, 153, 0.2);
    --input-background: rgba(0, 0, 0, 0.5);
    --outline-color: var(--copper-light);
    --category-emoji-size: 1.375rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(232, 193, 153, 0.3);
}

#emojiPickerContainer {
    animation: slide-up 0.2s ease-out;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   FOOTER FIX - Assurer que le footer reste en bas sans bloquer les modals
   ============================================================================= */

footer {
    position: relative;
    z-index: 0 !important; /* Toujours en arrière-plan */
}

/* Cacher le footer sur la page de connexion */
body.not-logged-in footer,
body:not(.logged-in) footer {
    display: none !important;
}

/* Afficher le footer seulement quand connecté */
body.logged-in footer {
    display: block;
}

/* S'assurer que tous les modals sont au-dessus du footer */
[role="dialog"],
.modal-overlay,
#chatModal,
#gifPickerModal,
#profileModal,
#statsModal,
#hallOfFameModal,
#newSeasonModal,
#editTournamentModal,
#resultModal,
#resetPasswordModal {
    z-index: 50 !important;
}

/* Lightbox au-dessus de tout */
.fixed.inset-0.bg-black\\/95 {
    z-index: 100 !important;
}

/* =============================================================================
   EMOJI STYLES - Agrandir les émojis intelligemment
   ============================================================================= */

/* Agrandir légèrement tous les émojis dans le chat */
#chatMessagesContainer .bg-copper-dark,
#chatMessagesContainer .bg-gray-800 {
    font-size: 1rem;
    line-height: 1.5;
}

/* Messages contenant SEULEMENT des émojis (1-5 émojis max) */
.emoji-only {
    font-size: 3rem !important;
    line-height: 1.2 !important;
    padding: 0.5rem 1rem !important;
}

/* Messages avec quelques émojis (ex: 😂😂😂) */
.emoji-medium {
    font-size: 2rem !important;
    line-height: 1.3 !important;
}

/* Messages avec texte + émojis (comportement normal mais un peu plus gros) */
.has-emoji {
    font-size: 1.1rem;
}

/* Assurer que les émojis ne débordent pas */
.emoji-only,
.emoji-medium {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* =============================================================================
   DELETE MESSAGE BUTTON - Bouton de suppression des messages
   ============================================================================= */

/* Conteneur de message avec position relative pour le bouton */
.chat-message-wrapper {
    position: relative;
}

/* Bouton de suppression (caché par défaut) - AMÉLIORÉ */
.delete-message-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.6);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Position pour les messages à droite (mes messages) */
.chat-message-wrapper.is-me .delete-message-btn {
    /* Déjà positionné par top/right ci-dessus */
}

/* Position pour les messages à gauche (autres) - ne devrait jamais apparaître */
.chat-message-wrapper.is-other .delete-message-btn {
    display: none;
}

/* Afficher au hover du message */
.chat-message-wrapper:hover .delete-message-btn {
    opacity: 1;
}

/* Hover du bouton lui-même */
.delete-message-btn:hover {
    background: rgba(239, 68, 68, 0.95);
    border-color: rgba(239, 68, 68, 1);
    transform: scale(1.15);
}

/* Active state */
.delete-message-btn:active {
    transform: scale(0.9);
}

/* Focus pour accessibilité */
.delete-message-btn:focus {
    outline: 2px solid rgba(232, 193, 153, 0.5);
    outline-offset: 2px;
}

/* Mobile : Visible par défaut mais semi-transparent */
@media (max-width: 768px) {
    .delete-message-btn {
        opacity: 0.6;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .chat-message-wrapper:hover .delete-message-btn,
    .chat-message-wrapper.is-me .delete-message-btn:focus {
        opacity: 1;
    }
}

/* =============================================================================
   MESSAGE REACTIONS - Réactions sur les messages
   ============================================================================= */

/* Conteneur des réactions sous le message */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    margin-left: 4px;
}

/* Une réaction individuelle */
.reaction-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(139, 102, 68, 0.15);
    border: 1px solid rgba(232, 193, 153, 0.3);
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

/* Réaction active (tu as réagi) */
.reaction-item.active {
    background: rgba(184, 132, 95, 0.3);
    border-color: var(--copper-main);
    box-shadow: 0 0 0 1px var(--copper-main);
}

/* Hover sur réaction */
.reaction-item:hover {
    background: rgba(184, 132, 95, 0.25);
    border-color: var(--copper-light);
    transform: scale(1.05);
}

/* Compteur de réactions */
.reaction-count {
    color: var(--copper-light);
    font-weight: 600;
    font-size: 12px;
}

/* Bouton ajouter une réaction - AMÉLIORÉ */
.add-reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(232, 193, 153, 0.6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    font-size: 16px;
    margin-left: 4px;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Afficher le bouton au hover du message */
.chat-message-wrapper:hover .add-reaction-btn {
    opacity: 1;
}

.add-reaction-btn:hover {
    background: rgba(184, 132, 95, 0.95);
    border-color: var(--copper-main);
    transform: scale(1.15);
}

/* Picker de réactions - Position FIXED pour toujours être visible */
.reaction-picker {
    /* Position gérée par JavaScript */
    position: fixed;
    background: rgba(26, 26, 26, 0.98);
    border: 1px solid rgba(232, 193, 153, 0.3);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    animation: reaction-picker-appear 0.2s ease-out;
}

@keyframes reaction-picker-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Conteneur du picker d'émojis (emoji-picker-element) */
.reaction-picker emoji-picker {
    --background: rgba(26, 26, 26, 0.95);
    --border-color: rgba(232, 193, 153, 0.3);
    --indicator-color: var(--copper-main);
    --input-border-color: rgba(232, 193, 153, 0.2);
    --input-background: rgba(0, 0, 0, 0.5);
    --outline-color: var(--copper-light);
    width: 320px;
    height: 350px;
}

/* Tooltip pour afficher les noms */
.reaction-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.reaction-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
}

.reaction-item:hover .reaction-tooltip {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .add-reaction-btn {
        opacity: 0.7;
        width: 32px;
        height: 32px;
    }
    
    .reaction-picker emoji-picker {
        width: 280px;
        height: 320px;
    }
    
    .message-reactions {
        gap: 4px;
    }
    
    .reaction-item {
        padding: 3px 6px;
        font-size: 13px;
    }
}

/* FIX: Rectangle participants */
.flex.items-center.justify-between.gap-3[class*="bg-black"] {
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(232, 193, 153, 0.35) !important;
}

.flex.items-center.justify-between.gap-3[class*="bg-black"]:hover {
    background: rgba(0, 0, 0, 0.7) !important;
    border-color: rgba(232, 193, 153, 0.45) !important;
}

/* Style du bouton "Voir la liste" - OR ROYAL 👑 */
.flex.items-center.justify-between.gap-3 button {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(245, 158, 11, 0.4)) !important;
    color: #fde68a !important;
    border: 1px solid rgba(251, 191, 36, 0.6) !important;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.25);
}

.flex.items-center.justify-between.gap-3 button:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.5), rgba(245, 158, 11, 0.6)) !important;
    color: #fff !important;
    border-color: rgb(251, 191, 36) !important;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.5);
    transform: translateY(-2px) scale(1.02);
}

.flex.items-center.justify-between.gap-3 button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}