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

html, body {
    height: 100%;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #0a1628;
    color: #212121;
}

/* ── Logo w rogu ── */

.page-logo {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 2;
}

/* ── Tło wideo pełnoekranowe ── */

.page-bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ── Layout czatu ── */

.chat-layout {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 0 60px rgba(0,0,0,0.4);
}

/* ── Nagłówek ── */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #D0D5D2;
    background: #ffffff;
    flex-shrink: 0;
}

.chat-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    color: #212121;
}

.btn-new-chat {
    padding: 8px 20px;
    border-radius: 9999px;
    border: 1.5px solid #1863DC;
    background: transparent;
    color: #1863DC;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-new-chat:hover {
    background: #1863DC;
    color: #ffffff;
}

/* ── Obszar wiadomości ── */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* ── Ekran startowy ── */

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    color: #666;
    text-align: center;
    padding: 60px 0;
}

.chat-empty h2 {
    font-size: 22px;
    font-weight: 600;
    color: #212121;
}

.chat-empty p {
    font-size: 15px;
}

/* ── Wiersze wiadomości ── */

.message-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-row--user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar--bot {
    background: #1863DC;
    color: #ffffff;
}

.message-avatar--user {
    background: #212121;
    color: #ffffff;
}

.message-bubble {
    max-width: 72%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.message-bubble--bot {
    background: #F4F4F4;
    color: #212121;
    border-bottom-left-radius: 4px;
}

.message-bubble--user {
    background: #1863DC;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* ── Kursor pisania ── */

.typing-cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
    color: #1863DC;
    font-weight: 700;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── Pole input ── */

.chat-input-area {
    padding: 16px 24px 20px;
    border-top: 1px solid #D0D5D2;
    background: #ffffff;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #F4F4F4;
    border: 1.5px solid #D0D5D2;
    border-radius: 16px;
    padding: 10px 10px 10px 16px;
    transition: border-color 0.15s;
}

.chat-input-wrapper:focus-within {
    border-color: #1863DC;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    color: #212121;
    font-family: inherit;
    max-height: 160px;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: #999;
}

.chat-input:disabled {
    opacity: 0.6;
}

.btn-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #1863DC;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    opacity: 0.85;
}

.btn-send:disabled {
    background: #D0D5D2;
    cursor: not-allowed;
}

.chat-disclaimer {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 8px;
}

/* ── Blazor error UI ── */

/* ── Header actions ────────────────────────────────────────── */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-user-badge {
    font-size: 13px;
    color: #555;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 20px;
}

.btn-login-link, .btn-manager-link {
    font-size: 13px;
    color: #1863DC;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #1863DC;
    transition: background 0.15s;
}
.btn-login-link:hover, .btn-manager-link:hover {
    background: #eef3fd;
}

.btn-logout {
    font-size: 13px;
    color: #666;
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-logout:hover { background: #f5f5f5; }

.btn-report {
    font-size: 13px;
    color: #e07000;
    background: none;
    border: 1px solid #e07000;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-report:hover { background: #fff5e8; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #212121;
    margin: 0 0 8px;
}

.modal-textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.btn-modal-cancel {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
    color: #555;
}

.btn-modal-submit {
    background: #1863DC;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-modal-submit:disabled { background: #aaa; cursor: default; }

/* ── Manager / Admin pages ─────────────────────────────────── */
.mgr-layout {
    min-height: 100vh;
    background: #f3f6fb;
    padding: 0;
}

.mgr-topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mgr-topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #212121;
    margin: 0;
}

.mgr-topbar-links {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.mgr-topbar-links a, .mgr-topbar-links button {
    font-size: 13px;
    color: #1863DC;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #c5d6f7;
    background: none;
    cursor: pointer;
    transition: background 0.15s;
}
.mgr-topbar-links a:hover, .mgr-topbar-links button:hover { background: #eef3fd; }

.mgr-content {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.mgr-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.mgr-table th {
    background: #f7f9fc;
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #e5e7eb;
}

.mgr-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.mgr-table tr:last-child td { border-bottom: none; }
.mgr-table tr:hover td { background: #f9fbff; cursor: pointer; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-gray  { background: #f3f4f6; color: #6b7280; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-orange{ background: #ffedd5; color: #9a3412; }

.mgr-detail {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    margin-top: 24px;
}

.mgr-detail-msg {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.mgr-detail-msg--user { background: #1863DC; color: #fff; margin-left: 20%; }
.mgr-detail-msg--bot  { background: #f4f4f4; color: #212121; margin-right: 20%; }

.mgr-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mgr-filter-bar select, .mgr-filter-bar input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.btn-primary {
    background: #1863DC;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover { background: #1453b8; }

.btn-danger {
    background: none;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}
.btn-danger:hover { background: #fee2e2; }

/* ── Blazor error UI ─────────────────────────────────────────── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── Intent badges ───────────────────────────────────────────── */

.message-col {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-col--user {
    align-items: flex-end;
}

.intent-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    display: inline-block;
    opacity: 0.85;
}

.intent-badge--produkt  { background: #dbeafe; color: #1d4ed8; }
.intent-badge--domenowe { background: #dcfce7; color: #15803d; }
.intent-badge--meta     { background: #f3f4f6; color: #4b5563; }
.intent-badge--off_topic { background: #fee2e2; color: #b91c1c; }
