/* =========================================
   1. VARIABLEN & RESET
   ========================================= */
:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --accent-color: #00d2d3;
    --input-bg: #1e1e1e;
    --card-bg: #1e1e1e;
    --header-bg: #000000;
    --border-color: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================
   2. HEADER STYLING (Desktop First)
   ========================================= */
header {
    background-color: var(--header-bg);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo h1 {
    font-size: 1.8rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    margin: 0;
    line-height: 1;
}

header a { text-decoration: none; }

/* Container für User, Dropdown und Buttons */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
    justify-content: flex-end; /* Rechtsbündig auf Desktop */
}

.username-label {
    color: #888;
    font-size: 0.9rem;
    white-space: nowrap;
}

.list-selector-wrapper {
    min-width: 150px;
    max-width: 250px;
}

.list-dropdown {
    background: #222;
    color: white;
    padding: 0 10px;
    border-radius: 4px; /* Eckig wie gewünscht */
    border: 1px solid #444;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    height: 36px;
    width: 100%;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.btn-header, .btn-logout {
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid #444;
    padding: 0 12px;
    border-radius: 4px; /* Eckig */
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ddd;
    background: transparent;
    white-space: nowrap;
}

.btn-header:hover { border-color: var(--accent-color); color: var(--accent-color); }
.btn-logout:hover { background-color: #e74c3c; border-color: #e74c3c; color: white; }


/* =========================================
   3. CONTAINER & SUCHE
   ========================================= */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

.search-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
}

/* Input Felder (Text & Passwort & Suche) */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    border-radius: 30px; /* Runde Inputs für Suche/Login */
    border: 2px solid var(--border-color);
    background-color: var(--input-bg);
    color: white;
    outline: none;
    transition: border-color 0.3s ease;
    margin-bottom: 15px; /* Abstand nach unten bei Formularen */
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 210, 211, 0.2);
}

/* Suchvorschläge */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border-radius: 10px;
    margin-top: 8px;
    z-index: 200;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.suggestion-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    cursor: pointer;
}

.suggestion-action {
    padding-left: 10px;
    min-width: 40px;
    text-align: center;
}

.poster-thumb {
    width: 45px;
    height: 68px;
    object-fit: cover;
    margin-right: 15px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Icons in Suche */
.quick-add-btn {
    background: var(--accent-color);
    border: none;
    color: black;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.status-icon.check { color: #2ecc71; font-size: 1.5rem; }
.status-icon.eye { color: #e74c3c; font-size: 1.5rem; }


/* =========================================
   4. WATCHLIST GRID & HOME
   ========================================= */
.section-title {
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
    color: var(--text-color);
}

.watchlist-grid {
    display: grid;
    /* Automatisch so viele Spalten wie passen, mind. 140px breit */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.watchlist-card {
    position: relative;
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid #333;
    
    /* NEU: Erzwingt einheitliches Hochformat (2:3 Ratio) */
    aspect-ratio: 2 / 3; 
    display: flex;          /* Hilft, Lücken zu vermeiden */
    flex-direction: column;
}

.watchlist-card:hover {
    transform: scale(1.03);
    border-color: var(--accent-color);
    z-index: 10; /* Damit die vergrößerte Karte über den anderen liegt */
}

.watchlist-card a {
    display: block;
    width: 100%;
    height: 100%;
}

.watchlist-card img {
    width: 100%;
    height: 100%;
    display: block;
    
    /* NEU: Das Bild füllt den Bereich komplett aus */
    object-fit: cover; 
    /* object-fit: cover sorgt dafür, dass nichts verzerrt wird. 
       Es schneidet Ränder ab, falls das Bildformat nicht passt. */
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(231, 76, 60, 0.9); /* Rot */
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5; /* Damit der Button über dem Bild liegt */
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}


/* =========================================
   5. DETAILANSICHT (Fixed & Eckig)
   ========================================= */
.movie-detail {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid #333;
    display: flex; /* Nebeneinander auf Desktop */
    align-items: flex-start;
    gap: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 100%;
    margin-top: 20px;
}

.detail-poster {
    width: 300px;
    min-width: 250px;
    border-radius: 4px; /* Eckig */
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.detail-info {
    flex: 1;
    min-width: 0;
}

.detail-info h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
    line-height: 1.2;
}

.detail-meta {
    color: #aaa;
    margin-bottom: 25px;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.detail-overview {
    line-height: 1.7;
    margin-bottom: 30px;
    color: #ddd;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px; /* Eckig */
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    text-align: center;
    transition: transform 0.1s;
}
.btn:hover { transform: translateY(-2px); }

.btn-add { background-color: var(--accent-color); color: black; }
.btn-remove { background-color: #e74c3c; color: white; }
.btn-watched { background-color: #f1c40f; color: black; }
.btn-unwatch { background-color: #95a5a6; color: white; cursor: default; }

/* Besetzung */
.cast-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}
.cast-item { width: 90px; text-align: center; }
.cast-img {
    width: 90px; height: 90px; object-fit: cover;
    border-radius: 4px; border: 1px solid #444; margin-bottom: 5px;
}
.cast-name { font-size: 0.8rem; display: block; color: #ccc; }


/* =========================================
   6. LISTEN PAGE & LOGIN PAGE
   ========================================= */
/* Login */
.login-page {
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
.login-container {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid #333;
}
.toggle-link {
    color: #888; font-size: 0.9rem; margin-top: 15px;
    cursor: pointer; text-decoration: underline; display: inline-block;
}
.msg { padding: 10px; margin-bottom: 15px; border-radius: 5px; font-size: 0.9rem; }
.msg.error { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid #e74c3c; }
.msg.success { background: rgba(46, 204, 113, 0.2); color: #2ecc71; border: 1px solid #2ecc71; }

/* Listen Page */
.create-list-box, .list-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #333;
}
.create-list-box { margin-bottom: 30px; }
.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.list-form-row { display: flex; gap: 10px; margin-top: 10px; width: 100%; }

/* Spezielle Inputs für Listen */
.list-input {
    flex-grow: 1;
    padding: 0 15px;
    height: 38px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #222;
    color: white;
    font-size: 0.9rem;
    margin: 0; /* Margin Reset */
}

.list-btn-small {
    height: 38px;
    padding: 0 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
}
.btn-rename { background-color: #3498db; color: white; }

.member-tag {
    display: inline-flex; align-items: center; background: #333;
    padding: 4px 10px; border-radius: 15px; margin: 0 5px 5px 0; font-size: 0.85rem;
}
.btn-kick {
    background: transparent; color: #e74c3c; border: none;
    font-weight: bold; cursor: pointer; margin-left: 5px; font-size: 1.1rem;
}


/* =========================================
   7. MEDIA QUERIES (SMARTPHONE)
   ========================================= */
@media (max-width: 768px) {
    
    /* --- HEADER MOBILE --- */
    .header-inner {
        flex-direction: column; /* Logo oben, Controls unten */
        gap: 10px;
        align-items: stretch;
    }

    .logo h1 {
        font-size: 1.5rem;
        text-align: center; /* Logo zentrieren */
        margin-bottom: 5px;
    }

    /* Die Zeile darunter: User | Liste | Buttons */
    .header-controls {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    /* Dropdown nimmt den Platz in der Mitte */
    .list-selector-wrapper {
        flex-grow: 1;
        max-width: none; 
        min-width: 0; 
    }
    
    /* Text ("Hallo", "Listen", "Logout") ausblenden -> Nur Icons/Namen */
    .desktop-text {
        display: none;
    }

    /* Namen kürzen */
    .username-label {
        font-size: 0.85rem;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Buttons kompakter */
    .btn-header, .btn-logout {
        padding: 0 8px;
        font-size: 1.1rem; /* Icons etwas größer */
    }
    
    .header-buttons { gap: 5px; }


    /* --- MAIN CONTENT MOBILE --- */
    .container { padding: 20px 15px; }

    .movie-detail {
        flex-direction: column; /* Bild oben, Text unten */
        align-items: center;
        padding: 20px;
    }

    .detail-poster {
        width: 100%;
        max-width: 300px;
        margin-bottom: 20px;
    }

    .detail-info h2 {
        font-size: 1.8rem;
        text-align: center;
    }
    
    .detail-meta, .cast-list {
        justify-content: center;
    }
}