/* ===== CSS-Variablen für Light-Theme (Standard) ===== */
:root {
    color-scheme: light;
    --bg: #f3f4f6;
    --text: #111827;

    --link: #0369a1;
    --link-hover: #0ea5e9;

    --header-bg: #111827;
    --header-text: #e5e7eb;

    --card-bg: #ffffff;
    --card-shadow: rgba(15, 23, 42, 0.15);

    --footer-bg: #020617;
    --footer-text: #6b7280;

    --input-bg: #ffffff;
    --input-border: #d1d5db;

    --button-bg: #0ea5e9;
    --button-text: #0f172a;

    --badge-bg: #e5e7eb;
    --badge-text: #111827;
}

/* ===== Dunkles Theme erzwingen ===== */
body.theme-dark {
    color-scheme: dark;
    --bg: #0f172a;
    --text: #e5e7eb;

    --link: #38bdf8;
    --link-hover: #0ea5e9;

    --header-bg: #111827;
    --header-text: #e5e7eb;

    --card-bg: #020617;
    --card-shadow: rgba(0, 0, 0, 0.5);

    --footer-bg: #020617;
    --footer-text: #9ca3af;

    --input-bg: #020617;
    --input-border: #1f2937;

    --button-bg: #38bdf8;
    --button-text: #0f172a;

    --badge-bg: #1f2937;
    --badge-text: #e5e7eb;
}

/* ===== Hell-Theme erzwingen ===== */
body.theme-light {
    color-scheme: light;
    /* nutzt die Standard-Variablen oben */
}

/* ===== Automatischer Modus ===== */
body.theme-auto {
    /* Start: wie Light-Theme (nutzt :root Werte) */
}

@media (prefers-color-scheme: dark) {
    body.theme-auto {
        color-scheme: dark;
        --bg: #0f172a;
        --text: #e5e7eb;

        --link: #38bdf8;
        --link-hover: #0ea5e9;

        --header-bg: #111827;
        --header-text: #e5e7eb;

        --card-bg: #020617;
        --card-shadow: rgba(0, 0, 0, 0.5);

        --footer-bg: #020617;
        --footer-text: #9ca3af;

        --input-bg: #020617;
        --input-border: #1f2937;

        --button-bg: #38bdf8;
        --button-text: #0f172a;

        --badge-bg: #1f2937;
        --badge-text: #e5e7eb;
    }
}

/* ===== Allgemeines Layout ===== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: var(--link-hover);
}

/* Header & Navigation */
.app-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.top-nav a {
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.7);
    color: var(--header-text);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
}

.top-nav a:hover {
    background: rgba(31, 41, 55, 0.9);
}

.app-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.app-footer {
    background: var(--footer-bg);
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--footer-text);
}

/* Karten */
.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px var(--card-shadow);
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
}

/* Formulare */
form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
}

textarea {
    min-height: 100px;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--link-hover);
    outline-offset: 1px;
}

button,
input[type="submit"] {
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
}

button:hover,
input[type="submit"]:hover {
    background: var(--link-hover);
}

/* Kleinzeugs */
.text-muted {
    color: var(--footer-text);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--badge-bg);
    color: var(--badge-text);
}

.verse {
    margin-bottom: 0.4rem;
}

.verse-num {
    font-weight: 600;
    margin-right: 0.25rem;
    color: var(--link-hover);
}

.small {
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

@media (min-width: 640px) {
    .app-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* ===== Button für „Chat öffnen“ (Legacy) ===== */

.btn-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 999px;
    border: none;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
}

.btn-chat:hover {
    background: var(--link-hover);
}

/* ===== Altes Chat-Panel unten rechts (Floating-Panel) ===== */

.chat-panel {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 320px;
    max-width: 90vw;
    background: var(--card-bg);
    color: var(--text);
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
}

.chat-panel .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--header-bg);
    color: var(--header-text);
    font-size: 0.9rem;
}

.chat-panel .chat-close-btn {
    border: none;
    background: transparent;
    color: var(--header-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.chat-panel .chat-messages {
    padding: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.85rem;
}

.chat-panel .chat-form {
    border-top: 1px solid var(--input-border);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chat-panel .chat-form textarea {
    resize: none;
}

.chat-panel .chat-message {
    margin: 0.25rem 0;
}

.chat-panel .chat-message.me {
    text-align: right;
}

.chat-panel .chat-bubble {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    border-radius: 1rem;
    background: var(--badge-bg);
    color: var(--badge-text);
    max-width: 90%;
    text-align: left;
}

.chat-panel .chat-message.me .chat-bubble {
    background: var(--button-bg);
    color: var(--button-text);
}

.chat-panel .chat-meta {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-bottom: 0.2rem;
}

.chat-panel .chat-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

@media (max-width: 480px) {
    .chat-panel {
        right: 0.5rem;
        bottom: 0.5rem;
        width: calc(100vw - 1rem);
    }
}

/* ===== Verse-Highlights & Fokus ===== */

.verse {
    margin-bottom: 0.4rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.5rem;
}

.verse-highlight {
    background: rgba(250, 204, 21, 0.18);
}

.verse-focus {
    outline: 2px solid var(--link-hover);
    outline-offset: 2px;
}

/* ===== Älteres Dashboard-Layout (falls noch im Einsatz) ===== */

.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-main {
    width: 100%;
}

.dashboard-sidebar {
    width: 100%;
    margin-top: 1rem;
}

@media (min-width: 900px) {
    .dashboard-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    .dashboard-main {
        flex: 1 1 auto;
        max-width: 760px;
    }
    .dashboard-sidebar {
        flex: 0 0 280px;
        margin-top: 0;
    }
}

/* ===== Hero Card (Dashboard) ===== */

.card.dashboard-hero {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: radial-gradient(circle at top left,
        rgba(148, 163, 184, 0.45),
        rgba(15, 23, 42, 0.95)
    );
    border: 1px solid rgba(148,163,184,0.6);
    color: #ffffff;
}

.dashboard-hero-left {
    flex: 1 1 auto;
}

.dashboard-title {
    margin: 0 0 0.4rem 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
}

.dashboard-subtitle {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: #ffffff;
    max-width: 34rem;
}

.dashboard-hero-stats {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-stat {
    padding: 0.4rem 0.7rem;
    border-radius: 0.75rem;
    background: rgba(15,23,42,0.5);
    min-width: 110px;
}

.hero-stat-label {
    display: block;
    font-size: 0.8rem;
    color: #ffffff;
}

.hero-stat-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
}

.dashboard-hero-right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-primary,
.btn-ghost {
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--button-bg);
    color: var(--button-text);
    border-color: transparent;
}

.btn-primary:hover {
    background: var(--link-hover);
}

.btn-ghost {
    background: transparent;
    color: #e5e7eb;
    border-color: rgba(148,163,184,0.6);
}

.btn-ghost:hover {
    background: rgba(15,23,42,0.6);
}

@media (min-width: 640px) {
    .dashboard-hero {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Karten-Typen */
.dashboard-card-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.highlight-card {
    border: 1px solid rgba(56,189,248,0.4);
}

.stat-card {
    border: 1px solid rgba(148,163,184,0.35);
}

/* Generische Fortschrittsbalken */
.progress-bar-outer {
    width: 100%;
    background: rgba(148,163,184,0.3);
    border-radius: 999px;
    height: 0.75rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-inner {
    height: 100%;
    border-radius: 999px;
    background: var(--link-hover);
}

/* Achievement-Badges */
.achievement-badges {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.badge-ok {
    opacity: 1;
    font-weight: 600;
}

.badge-dim {
    opacity: 0.5;
}

/* ===== Messenger Sidebar im Dashboard ===== */

.messenger-card {
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    position: sticky;
    top: 0.75rem;
}

.messenger-section {
    margin-top: 0.75rem;
    border-top: 1px solid rgba(148,163,184,0.4);
    padding-top: 0.5rem;
}

.messenger-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--footer-text);
}

.messenger-user-list {
    list-style: none;
    padding: 0;
    margin: 0.3rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.messenger-user-row {
    padding: 0.35rem 0.4rem;
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: background 0.15s ease;
}

body.theme-dark .messenger-user-row {
    background: rgba(15, 23, 42, 0.75);
}

.messenger-user-row:hover {
    background: rgba(148, 163, 184, 0.2);
    cursor: pointer;
}

body.theme-dark .messenger-user-row:hover {
    background: rgba(15, 23, 42, 0.9);
}

.messenger-user-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.messenger-user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.messenger-user-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.messenger-user-actions {
    flex-shrink: 0;
}

/* Globale Statuspunkte */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

.status-online {
    background: #22c55e;
}

.status-away {
    background: #facc15;
}

.status-offline {
    background: #6b7280;
}

/* ===== Bibel-Seite – moderner Look ===== */

.bible-page {
    padding: 1.25rem 1.25rem 1.5rem;
}

.bible-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.bible-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Layout-Spalten */
.bible-col-full {
    width: 100%;
}

.bible-col-nav {
    border-radius: 0.75rem;
    background: linear-gradient(
        135deg,
        rgba(15, 23, 42, 0.9),
        rgba(37, 99, 235, 0.5)
    );
    color: #e5e7eb;
    padding: 0.9rem;
}

.bible-col-content {
    border-radius: 0.75rem;
    background: var(--card-bg);
    padding: 0.9rem;
}

@media (min-width: 960px) {
    .bible-shell {
        flex-direction: row;
        align-items: flex-start;
    }
    .bible-col-nav {
        flex: 0 0 260px;
    }
    .bible-col-content {
        flex: 1 1 auto;
    }
}

/* Testamente-Grid auf Startseite */
.bible-testaments {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0.75rem;
}

@media (min-width: 720px) {
    .bible-testaments {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Pills für Bücher */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.06);
}

.badge-pill:hover {
    background: rgba(15, 23, 42, 0.12);
}

.badge-abbr {
    font-weight: 600;
}

.badge-label {
    opacity: 0.9;
}

/* Link-Button (zur Übersicht) */
.link-button {
    background: transparent;
    color: inherit;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.link-button:hover {
    background: rgba(15, 23, 42, 0.15);
}

/* Buchkopf links */
.bible-book-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}

.book-abbr-circle {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 0 2px rgba(248, 250, 252, 0.15);
}

.book-meta .book-name {
    font-weight: 600;
}

.book-meta .book-sub {
    font-size: 0.75rem;
}

/* Fortschrittsbox für Kapitel */
.book-progress-box {
    margin-top: 0.4rem;
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
}

.progress-label {
    margin-bottom: 0.15rem;
}

/* Spezielle Progressbars in der Bibel-Navigation */
.bible-col-nav .progress-bar-outer {
    background: rgba(15, 23, 42, 0.4);
    height: 0.5rem;
}

.bible-col-nav .progress-bar-inner {
    background: #38bdf8;
}

.progress-percent {
    margin-top: 0.2rem;
}

/* Kapitel-Pills */
.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
}

.chapter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
}

.chapter-pill {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: transparent;
    color: inherit;
    text-decoration: none;
}

.chapter-pill:hover {
    background: rgba(15, 23, 42, 0.15);
}

.chapter-pill-active {
    background: #38bdf8;
    color: #0f172a;
    border-color: transparent;
    font-weight: 600;
}

/* Buttons unter der Kapitelüberschrift */
.bible-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Kopf des Kapitels rechts */
.chapter-header {
    margin-bottom: 0.6rem;
}

.chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.chapter-nav a {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
}

.chapter-nav a:hover {
    text-decoration: underline;
    color: var(--link-hover);
}

.chapter-nav-current {
    font-weight: 600;
}

.chapter-nav-disabled {
    color: var(--footer-text);
}

/* Vers-Sprung-Leiste */
.verse-jump {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.8rem;
}

/* Verse als „Chat-Bubbles“ */
.verses-container {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.verse-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.03);
}

body.theme-dark .verse-row {
    background: rgba(15, 23, 42, 0.7);
}

.verse-row-active {
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.7);
    background: rgba(56, 189, 248, 0.12);
}

.verse-badge {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--link-hover);
    color: var(--button-text);
    margin-top: 0.1rem;
}

.verse-text {
    flex: 1 1 auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.verse-meta {
    margin-top: 0.2rem;
    font-size: 0.75rem;
}

/* ===== Dashboard Layout (aktueller Block) ===== */

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.dashboard-main,
.dashboard-side {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.dashboard-card {
    margin-bottom: 0;
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.dashboard-card-header h1,
.dashboard-card-header h2 {
    margin: 0;
}

.progress-block {
    margin-bottom: 0.6rem;
}

.progress-title {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Zwei Spalten ab Desktop */
@media (min-width: 960px) {
    .dashboard-grid {
        flex-direction: row;
        align-items: flex-start;
    }
    .dashboard-main {
        flex: 1 1 auto;
    }
    .dashboard-side {
        flex: 0 0 280px;
    }
}

/* ===== Messages / Messenger Layout (volle Seite) ===== */

.messages-card {
    padding: 0;
}

.messages-layout {
    display: flex;
    flex-direction: column;
    min-height: 420px;
}

/* Sidebar */

.messages-sidebar {
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    padding: 0.8rem 0.9rem;
}

.messages-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.messages-current-user {
    font-weight: 600;
    font-size: 0.95rem;
}

.messages-sidebar-section {
    margin-top: 0.4rem;
}

.messages-contact-list {
    list-style: none;
    padding: 0;
    margin: 0.3rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.messages-contact-row {
    border-radius: 0.7rem;
    overflow: hidden;
    transition: background 0.15s ease;
}

.messages-contact-row.active {
    background: rgba(148, 163, 184, 0.2);
}

body.theme-dark .messages-contact-row.active {
    background: rgba(15, 23, 42, 0.8);
}

.messages-contact-row:hover {
    background: rgba(148, 163, 184, 0.15);
}

body.theme-dark .messages-contact-row:hover {
    background: rgba(15, 23, 42, 0.75);
}

.messages-contact-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    text-decoration: none;
    color: inherit;
}

.messages-contact-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.messages-contact-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.messages-contact-sub {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.messages-unread-badge {
    min-width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #f9fafb;
}

/* Chat-Bereich */

.messages-chat {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(148, 163, 184, 0.4);
    padding: 0.8rem 0.9rem;
}

.messages-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    padding-bottom: 0.4rem;
}

.messages-chat-user {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.messages-chat-name {
    font-weight: 600;
}

.messages-chat-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.messages-chat-header-actions {
    /* reserviert für spätere Icons / Buttons */
}

.messages-chat-empty {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat-Verlauf */

.chat-messages {
    flex: 1 1 auto;
    margin: 0.4rem 0;
    padding: 0.3rem 0.1rem;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chat-message-row {
    display: flex;
    margin-bottom: 0.2rem;
}

.chat-message-row.me {
    justify-content: flex-end;
}

.chat-message-row.them {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.4rem 0.6rem;
    border-radius: 0.8rem;
    font-size: 0.9rem;
    display: inline-block;
    background: rgba(148, 163, 184, 0.2);
}

.chat-message-row.me .chat-bubble {
    background: var(--link-hover);
    color: var(--button-text);
    border-bottom-right-radius: 0.2rem;
}

.chat-message-row.them .chat-bubble {
    background: var(--card-bg);
    border-bottom-left-radius: 0.2rem;
}

body.theme-dark .chat-message-row.them .chat-bubble {
    background: rgba(15, 23, 42, 0.9);
}

.chat-bubble-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-bubble-meta {
    margin-top: 0.2rem;
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Eingabezeile */

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.chat-input {
    flex: 1 1 auto;
    min-height: 2.3rem;
    max-height: 6rem;
    resize: vertical;
    border-radius: 0.75rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.9rem;
}

.chat-send-button {
    border-radius: 999px;
    white-space: nowrap;
}

/* Zwei Spalten ab Tablet/Desktop */

@media (min-width: 768px) {
    .messages-layout {
        flex-direction: row;
    }
    .messages-sidebar {
        flex: 0 0 260px;
        border-bottom: none;
        border-right: 1px solid rgba(148, 163, 184, 0.4);
    }
    .messages-chat {
        border-top: none;
    }
}

/* ===== Heute-dran-Leiste direkt unter dem Header ===== */

.today-strip {
    margin: 0.4rem 0 0.7rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(56,189,248,0.20),
        rgba(59,130,246,0.12)
    );
    border: 1px solid rgba(148,163,184,0.45);
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    justify-content: space-between;
}

body.theme-dark .today-strip {
    background: linear-gradient(
        90deg,
        rgba(56,189,248,0.28),
        rgba(15,23,42,0.9)
    );
}

.today-strip-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.today-strip-main {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

@media (min-width: 960px) {
    .today-strip-main {
        max-width: 360px;
    }
}

/* ===== Cookie-Banner ===== */

.cookie-banner {
    position: fixed;
    bottom: 0.75rem;
    left: 0.5rem;
    right: 0.5rem;
    z-index: 2000;
}

.cookie-banner-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.85rem;
}

.cookie-banner-inner a {
    color: #38bdf8;
    text-decoration: underline;
}

.cookie-banner-inner button {
    border-radius: 999px;
    border: none;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    background: #38bdf8;
    color: #0f172a;
    white-space: nowrap;
}

/* ===== Gespeicherte Suchen – Slider ===== */

.saved-search-panel {
    margin-top: 0.4rem;
}

.saved-searches-slider {
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.03);
    padding: 0.6rem 0.7rem 0.8rem;
}

body.theme-dark .saved-searches-slider {
    background: rgba(15, 23, 42, 0.75);
}

.saved-search-track {
    position: relative;
    min-height: 150px;
}

/* einzelne Karte */
.saved-search-card {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.saved-search-card.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.saved-search-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    height: 100%;
}

/* Kopfzeile mit Titel + Icons */
.saved-search-header-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.saved-search-title-input {
    flex: 1 1 auto;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.85rem;
}

.saved-search-icon-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 999px;
}

.saved-search-icon-btn:hover {
    background: rgba(148, 163, 184, 0.3);
}

/* Meta-Infos */
.saved-search-meta {
    font-size: 0.8rem;
    line-height: 1.4;
}

.saved-search-meta-label {
    font-weight: 600;
    margin-right: 0.15rem;
}

/* Aktion unten */
.saved-search-actions-row {
    margin-top: 0.2rem;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Slider-Steuerung */
.saved-search-controls {
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.saved-search-nav {
    border: none;
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    background: var(--badge-bg);
    color: var(--badge-text);
}

.saved-search-nav:hover {
    background: var(--link-hover);
    color: var(--button-text);
}

/* Punkte */
.saved-search-dots {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.saved-search-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    border: none;
    padding: 0;
    background: rgba(148, 163, 184, 0.6);
    cursor: pointer;
}

.saved-search-dot.active {
    width: 10px;
    height: 10px;
    background: var(--link-hover);
}