/* GLOBAL STYLES */
:root {
    --primary-color: #00a8ff;
    --secondary-color: #9c88ff;
    --background-color: #1a1a1d;
    --surface-color: #2c2c34;
    --text-color: #f5f5f7;
    --border-color: #44444c;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
}

html[data-theme="dark"] {
    --primary: var(--primary-color);
    --secondary: var(--secondary-color);
    --background-color: var(--background-color);
    --card-background-color: var(--surface-color);
}

/* --- HEADER --- */
header nav ul { 
    display: flex;
    align-items: center;
}

header nav li { 
    margin-left: 1rem;
}

/* --- HOME VIEW GRID --- */
#worldcup-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.worldcup-card-container {
    position: relative;
}

.worldcup-card {
    display: block;
    position: relative;
    width: 100%;
    padding-top: 100%; /* Creates a square aspect ratio */
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-color);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.worldcup-card-container:hover .worldcup-card {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
}

.thumb-half {
    width: 50%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: filter 0.3s;
}

.worldcup-card:hover .thumb-half {
    filter: brightness(0.6);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 60%);
    color: white;
    opacity: 1;
    transition: opacity 0.3s;
}

.worldcup-card h3 {
    margin: 0;
    font-size: 1.25rem;
}

.worldcup-card span {
    font-size: 0.875rem;
    opacity: 0.8;
}

.delete-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}

.worldcup-card-container:hover .delete-button {
    opacity: 1;
    visibility: visible;
}

.delete-button:hover {
    background-color: #b71c1c;
}


/* --- PLAY VIEW --- */
#play-container.container {
    padding: 0;
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #000;
}

.play-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; flex-shrink: 0; width: 100%; }
.play-header #play-title { flex-grow: 1; text-align: center; margin: 0; }
.play-header #exit-play-btn { order: -1; }
#match-container { display: flex; flex-grow: 1; overflow: hidden; }
.match-candidate { width: 50%; height: 100%; position: relative; overflow: hidden; }
.media-container { width: 100%; height: 100%; }
.media-container img, .media-container iframe { width: 100%; height: 100%; object-fit: cover; border: none; }
#button-container { display: flex; justify-content: space-around; padding: 1.5rem; flex-shrink: 0; background: #111; }
.select-btn { width: 45%; font-size: 1.5rem; padding: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- WINNER DISPLAY --- */
#winner-container:not(.hidden) { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.85); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 100; }
#winner-card { max-width: 500px; width: 90%; text-align: center; }
#winner-card .media-container { width: 100%; height: auto; aspect-ratio: 16 / 9; margin-bottom: 1rem; }
#winner-container .grid { width: 90%; max-width: 500px; margin-top: 1rem; }

/* --- CREATE VIEW --- */
.table-container { overflow-x: auto; }
table { width: 100%; }
.preview-image { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.drop-cell { border: 2px dashed var(--border-color); text-align: center; cursor: pointer; }
.drop-cell.dragover { background-color: rgba(0, 168, 255, 0.1); border-color: var(--primary-color); }
.hidden { display: none !important; }
