/* Basisvariablen Light-Theme */
:root {
    --primary-color: #6200ee;
    --background-color: #ffffff;
    --text-color: #222222;
    --list-bg-color: #f9f9f9;
    --list-border-color: #dddddd;
    --input-bg-color: #ffffff;
    --delete-color: #222222;
    --container-max-width: 600px;
}

html {
    height: 100%;
}

/* Dark-Theme */
html.dark-theme {
    --background-color: #121212;
    --text-color: #e0e0e0;
    --list-bg-color: #1e1e1e;
    --list-border-color: #333333;
    --input-bg-color: #1e1e1e;
    --delete-color: #e0e0e0;
}

body {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 10px;
    background: var(--background-color);
    color: var(--text-color);
    font-family: sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

/* Zentraler Container, zentriert, mit fester max. Breite und Platz am unteren Rand */
#content {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding-bottom: 80px;
    position: relative;
}

/* Topbar – Header */
.header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.back-btn {
    flex-shrink: 0;
    text-decoration: none;
    color: var(--text-color);
}

.back-btn svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
}

/* Gemeinsame Klasse für Lösch-Buttons */
.delete-btn {
    background: none;
    border: none;
    color: var(--delete-color);
    cursor: pointer;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.list-title {
    flex: 1;
    min-width: 0;
    margin: 0 10px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.header-right {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
}

.header-right button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
}

.header-right svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.purchased {
    text-decoration: line-through;

    .fade-in {
        animation: fadeInMove 0.4s ease;
    }

    @keyframes fadeInMove {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .item span {
        cursor: pointer;
    }

    color: gray;
}

/* Listen- und Item-Stile */
.list,
.item {
    border: 1px solid var(--list-border-color);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    background: var(--list-bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    flex-grow: 1;
}

.delete-list {
    background: none;
    border: none;
    color: #d32f2f;
    font-size: 16px;
    cursor: pointer;
    margin-left: 10px;
}

/* Modal für Teilen */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: var(--list-bg-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    max-width: 300px;
    width: 100%;
    position: relative;
    border: 1px solid var(--list-border-color);
}

.close-modal {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* Fixierte Formulare – immer in einer Zeile am unteren Rand */
.fixed-form {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--container-max-width);
    background: var(--background-color);
    padding: 10px;
    border-top: 1px solid var(--list-border-color);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    gap: 5px;
}

.fixed-form input[type="text"] {
    flex-grow: 1;
    background: var(--input-bg-color);
    border: 1px solid var(--list-border-color);
    border-radius: 4px;
    padding: 10px;
    font-size: 16px;
    color: var(--text-color);
}

.fixed-form button {
    width: 40px;
    background-color: var(--input-bg-color);
    color: var(--text-color);
    border: 1px solid var(--list-border-color);
    border-radius: 4px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fixed-form button:hover,
.fixed-form button:focus {
    background-color: var(--list-bg-color);
}

/* Browser-Autofill in Dark-Theme überschreiben */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;
    box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
}

@media (max-width: 480px) {
    .header {
        flex-direction: row;
    }

    .list-title {
        margin: 0 5px;
    }

    .header-right {
        gap: 5px;
    }
}