/* Modern UNO Game Design - Responsive & Professional */

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */ /* Removido para permitir fundo dinâmico */
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Container Styles */
.container-fluid {
    padding: 0;
}

/* Header */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
    margin: 2rem 0;
    text-align: center;
}

/* Start Screen */
#start-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */ /* Removido para permitir fundo dinâmico */
    position: relative;
}

#start-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.08)"/><circle cx="10" cy="60" r="0.8" fill="rgba(255,255,255,0.06)"/><circle cx="90" cy="30" r="0.6" fill="rgba(255,255,255,0.07)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

#start-screen .card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow: 
        0 32px 64px rgba(0,0,0,0.12),
        0 16px 32px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.5);
    padding: 3rem 2.5rem;
    max-width: 480px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

#start-screen .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
}

#start-screen .card-body {
    padding: 0;
    position: relative;
    z-index: 1;
}

#start-screen h3 {
    color: #2d3748;
    margin-bottom: 2rem;
    font-weight: 700;
    font-size: 1.75rem;
    text-align: center;
    position: relative;
}

#start-screen h3::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

#start-screen .player-id {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

#start-screen .player-id p {
    margin: 0;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
}

#start-screen .player-id code {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: 2rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

.divider span {
    background: rgba(255, 255, 255, 0.98);
    color: #718096;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Form Elements */
.form-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.form-control {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Buttons */
.btn {
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(237, 137, 54, 0.4);
}

/* Game Screen */
#game-screen {
    padding: 1rem;
    min-height: 100vh;
}

/* Game Board */
.game-board {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

/* Game Info */
.game-info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    color: white;
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
}

.game-info strong {
    font-weight: 600;
}

/* Central Game Area */
.central-game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    min-height: 300px;
    margin: 2rem 0;
}

/* Cards */
.card-uno {
    width: 90px;
    height: 135px;
    border-radius: 12px;
    border: 3px solid #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 3px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card-uno:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}

.card-uno.playable {
    box-shadow: 0 0 20px #ffd700, 0 4px 15px rgba(0,0,0,0.2);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px #ffd700, 0 4px 15px rgba(0,0,0,0.2); }
    to { box-shadow: 0 0 30px #ffd700, 0 8px 25px rgba(0,0,0,0.3); }
}

/* Card Colors */
.card-red { 
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.card-blue { 
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
}

.card-green { 
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.card-yellow { 
    background: linear-gradient(135deg, #ecc94b 0%, #d69e2e 100%);
    color: #2d3748;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

.card-wild { 
    background: linear-gradient(45deg, #e53e3e, #3182ce, #38a169, #ecc94b);
    background-size: 400% 400%;
    animation: rainbow 3s ease infinite;
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Player Hand */
.player-hand {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.player-hand h5 {
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Sidebar */
.sidebar-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.sidebar-section h5, .sidebar-section h6 {
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Player List */
.player-list {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.current-player {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    border-left: 4px solid #ffd700;
}

/* Chat */
.chat-container {
    background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
    color: white;
    position: relative;
}

.chat-messages {
    height: 300px; /* Aumentado para o modal */
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-message {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.chat-message .chat-profile-photo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.chat-message .message-body {
    flex: 1;
    min-width: 0;
}

.chat-message .content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 5px;
    display: block;
    cursor: pointer;
}

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

.chat-message.own {
    background: rgba(66, 153, 225, 0.4);
    margin-left: 2rem;
    border-bottom-right-radius: 4px;
}

.chat-message.other {
    background: rgba(255, 255, 255, 0.2);
    margin-right: 2rem;
    border-bottom-left-radius: 4px;
}

.chat-message .sender {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.chat-message .timestamp {
    font-size: 0.7rem;
    opacity: 0.7;
    float: right;
}

/* Chat Input */
.chat-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chat-input-group .form-control {
    flex: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 25px;
}

.chat-input-group .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.chat-input-group .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.chat-input-group .btn {
    padding: 0.5rem 1rem;
}

/* Chat Buttons */
.chat-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.chat-buttons .btn {
    flex: 1 1 auto;
    min-width: 80px;
    font-size: 0.8rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
}

.chat-buttons .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.chat-buttons .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Recording Controls */
#recording-controls, #recording-preview {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 10px;
}

#recording-timer {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}

/* Emoji Picker */
#emoji-picker {
    position: absolute;
    bottom: 100%; /* Posiciona acima do input de chat */
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.95); /* Fundo semi-transparente */
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    transform: translateY(-10px); /* Pequeno deslocamento para cima */
}

#emoji-picker h6 {
    color: #2d3748;
}

.emoji-option {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.emoji-option:hover {
    background: #edf2f7;
    transform: translateY(-2px);
}

/* Loading Screen */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    z-index: 9999;
}

.loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

/* Color Selector */
.color-selector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1050;
    text-align: center;
    max-width: 300px;
    width: 90%;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
    margin: 0.5rem;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
    border-color: rgba(0,0,0,0.2);
}

.color-option.selected {
    border-color: #4a5568;
    box-shadow: 0 0 0 4px rgba(74, 85, 104, 0.3);
}

.card-red {
    background-color: #e53e3e;
}
.card-blue {
    background-color: #3182ce;
}
.card-green {
    background-color: #38a169;
}
.card-yellow {
    background-color: #ecc94b;
}

/* Modal de Jogo Finalizado */
.modal-content {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: none;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 700;
    font-size: 1.8rem;
}

.btn-close-white {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 2rem;
    background: #f7fafc;
}

#winnersRanking {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

#winnersRanking h5 {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

#winnersRanking ul {
    list-style: none;
    padding: 0;
}

#winnersRanking li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #edf2f7;
}

#winnersRanking li:last-child {
    border-bottom: none;
}

#winnersRanking li .player-rank {
    font-weight: 700;
    color: #4a5568;
}

#winnersRanking li .player-score {
    font-weight: 600;
    color: #38a169;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    #start-screen .card {
        padding: 2rem 1.5rem;
    }

    .central-game-area {
        /* flex-direction: column removido para manter lado a lado em telas pequenas */
        gap: 1.5rem;
        min-height: auto;
    }

    .deck-pile, .discard-pile {
    display: flex;
    align-items: center;
    justify-content: center;
        width: 100px;
        height: 150px;
    }

    .card-uno {
        width: 70px;
        height: 105px;
        font-size: 0.9rem;
    }

    .player-hand {
        padding: 1rem;
    }

    .sidebar-section {
        padding: 1rem;
    }

    .chat-messages {
        height: 150px;
    }

    .chat-buttons .btn {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    .central-game-area {
        gap: 1rem;
    }

    .deck-pile, .discard-pile {
    display: flex;
    align-items: center;
    justify-content: center;
        width: 80px;
        height: 120px;
    }

    .card-uno {
        width: 60px;
        height: 90px;
        font-size: 0.8rem;
    }

    .chat-input-group {
        flex-direction: column;
    }

    .chat-input-group .btn {
        width: 100%;
    }
}









/* Deck and Discard Pile */
.deck-pile, .discard-pile {
    width: 120px;
    height: 180px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deck-pile {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: white;
    border: 3px solid #4a5568;
}

.deck-pile.custom-image {
    background-image: var(--deck-image-url);
}

.deck-pile:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}

.deck-pile .deck-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    display: block;
}

.deck-pile > div {
    text-align: center;
    font-weight: 600;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.discard-pile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    display: block;
}









.discard-pile {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%); /* Fundo similar ao DECK 0 */
    border: 3px solid #4a5568; /* CORREÇÃO: Usar a mesma borda do deck-pile */
}

.discard-pile img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Garante que a imagem preencha o contêiner mantendo as proporções */
    border-radius: 15px; /* Arredonda as bordas da imagem */
    display: block;
}

/* Correção para garantir que a carta na pilha de descarte preencha o contêiner */
.discard-pile .card-uno {
    width: 100%;
    height: 100%;
    border: none; /* CORREÇÃO: Remover borda interna para usar a borda do contêiner */
    /* Garante que o conteúdo (imagem de fundo) preencha a div */
    background-size: cover !important; 
    background-position: center !important;
}

