/* ==========================================================================
   1. Variablen & Basis-Styles
   ========================================================================== */
:root {
    --color-bg-gradient: linear-gradient(135deg, #111214 0%, #1f1f23 100%);
    --color-surface: #18181c;
    --color-surface-hover: #26262b;
    --color-primary: #9146ff; /* Twitch Violett */
    --color-primary-hover: #a266ff;
    --color-spotify: #1db954; /* Spotify Grün */
    --color-text-main: #f5f5f7;
    --color-text-muted: #adadb8;
    --color-border: #2f2f35;
    --color-error: #eb0400;
    --color-success: #00fa9a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--color-bg-gradient);
    color: var(--color-text-main);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* ==========================================================================
   2. Container & Card Layout
   ========================================================================== */
.container {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    position: relative;
}

h1 {
    font-size: 1.8rem;
    margin-top: 10px;
    margin-bottom: 5px;
    text-align: center;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 25px;
}

/* ODER-Trenner */
.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.divider::before,
.divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: var(--color-border);
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* ==========================================================================
   3. Formularelemente (Inputs & Labels)
   ========================================================================== */
.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    background-color: #0e0e10;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-main);
    padding: 12px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(145, 70, 255, 0.2);
}

.input-group input::placeholder {
    color: #53535f;
}

/* ==========================================================================
   4. Buttons
   ========================================================================== */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    flex: 2;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
}

.btn-secondary {
    background-color: var(--color-surface-hover);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    flex: 1;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-border);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   5. Sprachwechsler (Language Switcher)
   ========================================================================== */
.lang-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

.lang-switcher span {
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.lang-switcher span:hover {
    color: var(--color-text-main);
    background-color: var(--color-surface-hover);
}

.lang-switcher span.active {
    color: white;
    background-color: var(--color-primary);
}

/* ==========================================================================
   6. Feedback-Nachrichten & Loader
   ========================================================================== */
.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
    font-weight: 500;
}

.message.success {
    background-color: rgba(0, 250, 154, 0.1);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.message.error {
    background-color: rgba(235, 4, 0, 0.1);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

/* Lade-Anzeige im Button */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   7. History Overlay (Modal)
   ========================================================================== */
.history-overlay {
    display: none; /* Per JS auf flex geschaltet */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.history-content {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.history-content h2 {
    margin-top: 0;
    font-size: 1.4rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--color-text-main);
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 5px;
}

/* Scrollbar-Styling für die History-Liste */
.history-list::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-track {
    background: #0e0e10;
}
.history-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}
.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.history-list li {
    padding: 10px 12px;
    border-bottom: 1px solid #202024;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-list li:last-child {
    border-bottom: none;
}

.history-list li strong {
    color: var(--color-spotify);
    font-size: 0.75rem;
    font-family: monospace;
}