/* Grundlayout – Apple-ähnlicher Look */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body.app-body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #f6f7fb, #e5e7ec);
    color: #111827;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top-Bar */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    backdrop-filter: blur(18px);
    background: rgba(255,255,255,0.88);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: linear-gradient(135deg, #0a84ff, #5aa7ff);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(10,132,255,0.4);
}

.app-logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.app-logo-title {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.app-logo-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Header right */

.app-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.04);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0a84ff, #4d9dff);
    color: #fff;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-size: 0.85rem;
}

/* Footer */

.app-footer {
    padding: 10px 22px;
    font-size: 0.8rem;
    color: #6b7280;
    text-align: right;
}

/* Main */

.app-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
}

.app-main-chat {
    align-items: stretch;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Auth-Cards */

.card {
    background: rgba(255,255,255,0.96);
    border-radius: 22px;
    padding: 24px 24px 20px;
    box-shadow:
        0 18px 40px rgba(15,23,42,0.12),
        0 0 0 1px rgba(255,255,255,0.9);
    max-width: 420px;
    width: 100%;
}

.card-auth {
    max-width: 420px;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

/* Forms */

.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
}

.form-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #4b5563;
}

.input {
    border-radius: 12px;
    padding: 9px 11px;
    border: 1px solid #d1d5db;
    font-size: 0.9rem;
    outline: none;
    background: rgba(255,255,255,0.95);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input:focus {
    border-color: #0a84ff;
    box-shadow: 0 0 0 2px rgba(10,132,255,0.3);
    background: #ffffff;
}

.input-chat {
    resize: none;
    min-height: 52px;
    max-height: 112px;
}

/* Buttons */

.btn {
    border: none;
    border-radius: 14px;   
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #0a84ff, #1d9bf0);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(10,132,255,0.45);
}

.btn-primary:hover {
    box-shadow: 0 11px 26px rgba(10,132,255,0.55);
    transform: translateY(-1px);
}

.btn-primary:active {
    box-shadow: 0 3px 10px rgba(10,132,255,0.5);
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #374151;
    border: 1px solid rgba(17,24,39,0.07);
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.9);
}

/* Links */

a {
    color: #0a84ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.form-links {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

/* Alerts */

.alert {
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.alert-success {
    background: rgba(16,185,129,0.08);
    color: #047857;
    border: 1px solid rgba(16,185,129,0.4);
}

.alert-error {
    background: rgba(248,113,113,0.08);
    color: #b91c1c;
    border: 1px solid rgba(248,113,113,0.4);
}

/* Chat-Fenster (Apple-Style) */

.chat-window {
    max-width: 960px;
    width: 100%;
    margin: 8px auto 16px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 24px;
    box-shadow:
        0 22px 50px rgba(15,23,42,0.18),
        0 0 0 1px rgba(15,23,42,0.03);
    overflow: hidden;                 /* Rundungen sauber, nichts ragt raus */
}

.chat-window-header {
    padding: 10px 18px 8px;
    background: #f9fafb;
    border-bottom: 1px solid rgba(15,23,42,0.06);
}

.chat-window-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.chat-window-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.chat-window-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 18px 0;
}

/* Messages */

.messages {
    flex: 1;
    padding: 4px 0 8px;
    background: transparent;
    border: none;
    overflow: visible;          /* Seite scrollt – nicht der Messages-Container */
}


/* Scrollbar */

.messages::-webkit-scrollbar {
    width: 8px;
}
.messages::-webkit-scrollbar-track {
    background: transparent;
}
.messages::-webkit-scrollbar-thumb {
    background: rgba(156,163,175,0.7);
    border-radius: 999px;
}

/* Message Bubbles */

.message-row {
    display: flex;
    margin-bottom: 8px;         /* vorher 10px */
}

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

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

.message-bubble {
    max-width: min(80%, 680px);
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-row.assistant .message-bubble {
    background: #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message-row.user .message-bubble {
    background: #007aff;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Chat Footer & Input */

.chat-window-footer {
    padding: 6px 18px 12px;
    border-top: 1px solid rgba(15,23,42,0.06);
    background: #ffffff;
}

.status {
    font-size: 0.75rem;
    color: #6b7280;
    min-height: 16px;
    margin-bottom: 4px;
}

.input-area {
    width: 100%;
}

.input-shell {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 18px;                       /* etwas runder, aber nicht „Pille“ */
    background: #f5f5f7;
    border: 1px solid rgba(148,163,184,0.5);
}


.input-shell .input-chat {
    flex: 1;
    border: none;
    background: transparent;
    box-shadow: none;
    padding-left: 10px;
    padding-right: 0;
}

.input-shell .input-chat:focus {
    border: none;
    box-shadow: none;
    background: transparent;
}

/* Responsive */

@media (max-width: 900px) {
    .chat-window {
        height: calc(100vh - 130px);
        border-radius: 20px;
        padding: 14px 10px 10px;
    }
    .app-header,
    .app-footer {
        padding: 10px 14px;
    }
    .app-main {
        padding: 16px 10px;
    }
}
