/* --- MAIN LAYOUT & HEADER --- */
body {
    background-color: #121212;
    color: #ffffff;
    font-family: sans-serif;
    margin: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    flex-wrap: wrap; /* Allows items to wrap on very small screens */
}

.header-title h1 {
    margin: 0;
    font-size: 2em;
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 0 0 8px #FFD700;
}

.header-title h2 {
    margin: 0;
    font-size: 1.2em;
    font-weight: normal;
    color: #dddddd;
}

#poll-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

/* --- AUTH CONTROLS IN HEADER --- */
#auth-controls {
    text-align: right;
}

/* --- CONTESTANT GRID --- */
#contestant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    padding: 15px;
    width: 95%;
    max-width: 800px;
}
@media (min-width: 768px) {
    #contestant-grid {
        max-width: 1000px;
        gap: 30px;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

.contestant-item, #selected-contestant-card {
    text-align: center;
}
.contestant-item {
    cursor: pointer;
    transition: transform 0.3s ease;
}
.contestant-item:hover {
    transform: scale(1.05);
}

.contestant-img-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 4px solid #FFD700;
    overflow: hidden;
    margin: 0 auto;
    background-color: #333;
}
.contestant-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#selected-contestant-card .contestant-img-wrapper {
    width: 60vw;
    max-width: 250px;
}

/* --- CONTENT SECTION STYLES --- */
.content-section {
    max-width: 800px;
    margin: 40px auto; /* Center it on the page */
    padding: 0 20px; /* Add padding for mobile */
    color: #cccccc;
    line-height: 1.6;
}

.content-section h2, .content-section h3 {
    color: #ffffff;
}

/* --- SELECTED VIEW & FOOTER --- */
#selected-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(18, 18, 18, 0.95);
}
footer {
    width: 100%;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    box-sizing: border-box;
    color: #888888;
    font-size: 0.9em;
}
.footer-links a { color: #aaaaaa; text-decoration: none; margin: 0 10px; }
.footer-links a:hover { text-decoration: underline; }

/* --- BUTTONS --- */
#vote-button, #back-button {
    padding: 15px 30px; border: none; border-radius: 8px; font-size: 1.2rem;
    cursor: pointer; margin-top: 20px;
}
#vote-button { background-color: #FFD700; color: #121212; }
#back-button { background-color: #444; color: #fff; position: absolute; top: 20px; left: 20px; }

#sign-in-btn, #sign-out-btn {
    display: inline-flex; align-items: center; background-color: #4285F4;
    color: white; border: none; padding: 10px 20px; border-radius: 4px;
    font-size: 16px; font-weight: bold; cursor: pointer; transition: background-color 0.3s;
}
#sign-out-btn { background-color: #666; }
#sign-in-btn:hover, #sign-out-btn:hover { opacity: 0.9; }
#sign-in-btn svg {
    margin-right: 10px; width: 20px; height: 20px; background: white;
    border-radius: 50%; padding: 2px;
}
.live-button {
    display: inline-block; padding: 15px 30px; background-color: #c4302b;
    color: white; text-decoration: none; font-weight: bold; border-radius: 8px;
    margin-top: 20px; transition: background-color 0.3s;
}
.live-button:hover { background-color: #a31e19; }

/* --- LOADER, ANIMATIONS & VISIBILITY --- */
.loader {
    border: 5px solid #f3f3f3; border-top: 5px solid #FFD700;
    border-radius: 50%; width: 50px; height: 50px;
    animation: spin 1s linear infinite; position: absolute;
    top: 50%; left: 50%; z-index: 10;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#contestant-grid, #selected-view { transition: opacity 0.4s ease-in-out; }
.hidden { display: none !important; }
#contestant-grid, #selected-view { opacity: 0; pointer-events: none; }
#contestant-grid.visible, #selected-view.visible { opacity: 1; pointer-events: auto; }

/* --- MOBILE-SPECIFIC STYLES --- */
/* These rules only apply when the screen is 600px wide or smaller */

@media (max-width: 600px) {
    .header-title h1 {
        font-size: 1.5em; /* Smaller title on mobile */
    }
    .header-title h2 {
        font-size: 1em; /* Smaller subtitle on mobile */
    }
    
    #sign-in-btn, #sign-out-btn {
        padding: 8px 12px; /* Reduce button padding */
        font-size: 14px;   /* Reduce font size */
    }

    #sign-in-btn svg {
        margin-right: 8px; /* Reduce space next to icon */
    }
}
.contestant-item.non-clickable {
    cursor: default;
    transform: none !important; /* Disables the hover effect */
}