/* Base e Layout */
body {
    margin: 0;
    background-color: #1b1b1b;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#library-ui {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
#sidebar {
    width: 200px;
    background-color: #000;
    padding: 20px;
    border-right: 1px solid #333;
    overflow-y: auto;
}

#sidebar h2 {
    color: #e50914;
    font-size: 22px;
    margin-bottom: 20px;
}

.console-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #b3b3b3;
    text-align: left;
    padding: 12px 10px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}

.console-btn:hover,
.console-btn.active {
    color: #fff;
    background: #333;
}

.netplay-badge {
    color: #00ff00;
    font-size: 11px;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

/* Main Content */
#main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    align-items: center;
}

/* Grid de Jogos (Restaurado) */
#games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

.game-card {
    background: #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    border: 1px solid #333;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    border-color: #e50914;
}

.game-cover {
    width: 100%;
    height: 220px;
    background: #111;
    object-fit: cover;
    display: flex;
   /* align-items: center;*/
    justify-content: center;
    color: #555;
    font-size: 12px;
}
img{
    width: 100%;
    height: 100%;
    object-fit: fill;
}
.game-title {
    padding: 12px;
    font-size: 14px;
    font-weight: bold;
    margin: 0;
    color: #efefef;
}

/* Netplay View */
#netplay-view {
    display: none;
    flex: 1;
    gap: 15px;
    height: 100%;
}

.net-col {
    background: #121212;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 15px;
    border: 1px solid #333;
}

#col-rooms {
    flex: 1.2;
}

#col-chat {
    flex: 2.5;
    background: #0b141a;
}

/* Fundo estilo WhatsApp */
#col-players {
    flex: 1;
}

/* Chat WhatsApp Style */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bubble {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    position: relative;
    line-height: 1.4;
}

.msg-me {
    align-self: flex-end;
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 0;
}

.msg-them {
    align-self: flex-start;
    background: #202c33;
    color: #e9edef;
    border-top-left-radius: 0;
}

.msg-user {
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 3px;
    color: #ffd700;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #202c33;
    border-radius: 0 0 12px 12px;
}

.chat-input {
    flex: 1;
    background: #2a3942;
    border: none;
    padding: 12px;
    color: #fff;
    border-radius: 8px;
    outline: none;
}

/* Salas e Jogadores */
.room-item {
    padding: 12px;
    background: #1f1f1f;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    border-left: 4px solid #e50914;
}

.room-item:hover {
    background: #2a2a2a;
}

.player-item {
    padding: 10px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-item:hover {
    background: #202c33;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
}

/* Drag Overlay & Modais mantidos conforme original */

/* Botão customizado para input file */
.file-upload-btn {
    background-color: #e50914;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: 0.2s;
    text-align: center;
}

.file-upload-btn:hover {
    background-color: #f6121d;
}

.file-upload-btn input[type="file"] {
    display: none;
}

/* Esconde o input feio original */

#search-input {
    flex: 1;
    padding: 10px;
    border-radius: 4px;
    border: none;
    background: #333;
    color: #fff;
    font-size: 16px;
}

#core-select {
    padding: 10px;
    border-radius: 4px;
    border: none;
    background: #333;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

/* Estilo do Overlay de Drag & Drop */
#drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(22, 22, 22, 0.9);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    pointer-events: none;
    /* Impede que o overlay bloqueie eventos de soltar */
}

#drag-overlay.active {
    display: flex;
}

.drag-box {
    border: 4px dashed #e50914;
    border-radius: 20px;
    padding: 50px 100px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    animation: pulse 1.5s infinite;
}

.drag-box h2 {
    color: #fff;
    font-size: 32px;
    margin: 0;
}

.drag-box p {
    color: #b3b3b3;
    font-size: 18px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        border-color: #e50914;
    }

    50% {
        transform: scale(1.05);
        border-color: #ff3b30;
    }

    100% {
        transform: scale(1);
        border-color: #e50914;
    }
}

#emulator-container {
    display: none;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background: #000;
    flex-direction: column;
}

/*#game {
    width: 800px;
    height: 600px;
    max-width: 100%;
}*/
canvas {
    width: 100vw !important;
    height: 100vh !important;
    image-rendering: pixelated; /* Chrome, Edge, Safari */
  image-rendering: crisp-edges; /* Firefox */
}


.modal-overlay { 
    display: none; position: fixed; top:0; left:0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center; 
}
.modal-content { 
    background: #1f1f1f; padding: 30px; border-radius: 15px; border: 2px solid #e50914; 
    text-align: center; min-width: 300px; 
}
.ctx-menu { 
    display: none; position: absolute; background: #2a2a2a; border: 1px solid #444; 
    z-index: 2000; box-shadow: 0 5px 15px rgba(0,0,0,0.5); 
}
.ctx-menu div { padding: 10px 20px; cursor: pointer; transition: 0.2s; }
.ctx-menu div:hover { background: #e50914; color: white; }
.btn-close-modal { background: #333; color: #fff; border: none; padding: 8px 15px; cursor: pointer; margin-top: 10px; }