@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --on-surface-color: #e0e0e0;
    --on-surface-color-muted: #a0a0a0;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --border-color: #333;
    --box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--on-surface-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    max-width: 600px;
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
}

.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    height: 35px;
}

.auth-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: background-color 0.2s, transform 0.1s;
}

.auth-btn:hover {
    transform: translateY(-2px);
}

#signin-link {
    background-color: var(--primary-color);
    color: white;
}
#signin-link:hover {
    background-color: var(--primary-hover);
}

#history-link {
    background-color: var(--secondary-color);
    color: white;
}
#history-link:hover {
    background-color: var(--secondary-hover);
}

#signout-btn {
    background-color: var(--danger-color);
    color: white;
}
#signout-btn:hover {
    background-color: #c82333;
}

#user-display {
    color: var(--on-surface-color-muted);
    font-size: 14px;
}

.search-container {
    position: relative;
    width: 100%;
}

#search-bar {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: #fff;
    font-size: 16px;
    box-sizing: border-box;
}

#search-results {
    position: absolute;
    width: 100%;
    background-color: #2a2a2a;
    border-radius: 10px;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:hover {
    background-color: #383838;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item img {
    width: 45px;
    height: 65px;
    margin-right: 15px;
    border-radius: 5px;
    object-fit: cover;
}

/* Main content layout */
#main-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px; /* Wider max-width for desktop */
    align-items: center;
}

@media (min-width: 768px) {
    #main-content-wrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: 40px;
    }
}

#film-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    #film-container {
        /* The film container will take up a portion of the screen */
        max-width: 450px;
    }
}

#interaction-wrapper {
    margin-top: 30px;
    width: 100%;
    max-width: 420px; /* Match film container width on mobile */
}

@media (min-width: 768px) {
    #interaction-wrapper {
        margin-top: 0;
        /* The interaction wrapper will take the remaining space */
        flex-grow: 1;
    }
}

#film-card {
    background-color: var(--surface-color);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ensure the card itself doesn't shrink or grow unexpectedly */
    flex-shrink: 0;
}

#film-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-align: center;
    /* Set a specific height and line-clamp to handle multiple lines */
    height: 60px; /* Adjust based on expected title lengths */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#film-poster {
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 10px;
    margin: 15px 0;
    border: 1px solid var(--border-color);
}

/* New container for the overview */
#film-overview-container {
    height: 125px; /* Fixed height for the container */
    width: 100%;
    overflow-y: auto; /* Show scrollbar only when needed */
    margin-bottom: 15px; /* Space before the buttons */
}

#film-overview {
    font-size: 15px;
    color: var(--on-surface-color-muted);
    line-height: 1.7;
    text-align: center;
    /* No max-height needed here anymore */
}

#voting-buttons, #stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.vote-btn, #next-film-btn {
    padding: 18px 30px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s;
}

.vote-btn:active, #next-film-btn:active {
    transform: scale(0.97);
}

.good { background-color: var(--success-color); color: white; }
.good:hover { background-color: #218838; }
.bad { background-color: var(--danger-color); color: white; }
.bad:hover { background-color: #c82333; }
.not-seen { background-color: var(--secondary-color); color: white; }
.not-seen:hover { background-color: var(--secondary-hover); }

#next-film-btn {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}
#next-film-btn:hover {
    background-color: var(--primary-hover);
}

#stats-container {
    background-color: #2a2a2a;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

#our-rating-container h3, #external-rating-container h3 {
    font-size: 1.1rem;
    color: var(--on-surface-color-muted);
    margin-bottom: 8px;
}

#our-rating {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
}

#imdb-rating {
    font-size: 1rem;
    color: var(--on-surface-color-muted);
}
#imdb-rating a {
    color: var(--primary-color);
    text-decoration: none;
}
#imdb-rating a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}