/* AI-Chatbot/styles.css — Styl zgodny z ciemnym motywem ROZZYHUB */

:root {
    --primary-color:   #5d5dff;
    --primary-light:   #7a7aff;
    --primary-dark:    #4a4ac7;
    --gradient-start:  #4a4ac7;
    --gradient-end:    #7979ff;
    --secondary-color: #1e1e2f;
    --bg-color:        #0a0a0b;
    --text-color:      #ffffff;
    --text-secondary:  #a0a0a0;
    --border-color:    #2a2a3a;
    --card-bg:         #12121a;
    --box-shadow:      0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Open Sans', sans-serif;
}

body {
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 10%, rgba(93, 93, 255, 0.08), transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Tło canvas cząsteczek */
#particles-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Material Icons */
.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 22px;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
}

/* Główny kontener strony z czatem */
.chat-page-main {
    padding-top: 80px;
    padding-bottom: 24px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 16px;
    padding-right: 16px;
}

/* =========================================================
   CHAT CONTAINER / POPUP
========================================================= */
.chatbot-popup {
    width: 760px;
    max-width: 100%;
    height: min(720px, calc(100vh - 110px));
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(93, 93, 255, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 10;
    animation: fadeInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* =========================================================
   HEADER
========================================================= */
.chat-header {
    flex-shrink: 0;
    background: rgba(22, 22, 34, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chatbot-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(93, 93, 255, 0.15);
    border: 1px solid rgba(93, 93, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-light);
    box-shadow: 0 0 15px rgba(93, 93, 255, 0.2);
}

.logo-text {
    font-family: 'Ubuntu', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.3px;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px; height: 7px;
    background: #5cff9d;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(92, 255, 157, 0.8);
    animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.2); opacity: 0.7; }
}

.header-close {
    border: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    cursor: pointer;
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ─── Przycisk Wyloguj ─────────────────────────────────── */
.chat-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-logout-btn:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
    color: #fca5a5;
}

/* =========================================================
   BLUR WRAPPER
========================================================= */
.chat-blur-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: filter 0.35s ease;
}

.chat-blur-wrapper.blurred {
    filter: blur(7px);
    pointer-events: none;
    user-select: none;
}

/* =========================================================
   CHAT BODY
========================================================= */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    background: #0b0b12;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* =========================================================
   MESSAGES
========================================================= */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 86%;
}

.bot-message  { align-self: flex-start; }
.user-message { align-self: flex-end; flex-direction: row-reverse; }

.bot-avatar {
    width: 34px; height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(93, 93, 255, 0.3);
}

.message-text {
    padding: 12px 16px;
    border-radius: 14px 14px 14px 3px;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #f1f1f5;
    background: #161624;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow-wrap: anywhere;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.user-message .message-text {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: 14px 14px 3px 14px;
    box-shadow: 0 4px 16px rgba(93, 93, 255, 0.35);
}

.user-message .message-text:empty { display: none; }

/* =========================================================
   THINKING ANIMATION
========================================================= */
.thinking-indicator { display: flex; gap: 5px; padding: 6px 4px; }

.thinking-indicator .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--primary-light);
    box-shadow: 0 0 6px var(--primary-color);
    animation: thinking 1.1s infinite ease-in-out;
}
.thinking-indicator .dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-indicator .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinking {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* =========================================================
   CODE RENDERING
========================================================= */
.code-block-wrapper {
    margin: 12px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #08080f;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-block-lang {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-light);
    text-transform: uppercase;
}

.code-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    background: rgba(93, 93, 255, 0.2);
    border-color: var(--primary-color);
    color: #fff;
}

.code-copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    color: #4ade80;
}

.message-text pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
    background: transparent;
    color: #e2e8f0;
    font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
    font-size: 0.84rem;
    line-height: 1.5;
}

.message-text code {
    font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
}

.inline-code {
    background: rgba(93, 93, 255, 0.15);
    border: 1px solid rgba(93, 93, 255, 0.25);
    color: #a5b4fc;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: 'Consolas', 'Fira Code', monospace;
    font-size: 0.88em;
}

.attachment {
    width: 160px;
    max-width: 100%;
    margin-top: 8px;
    border-radius: 10px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* =========================================================
   FOOTER / INPUT
========================================================= */
.chat-footer {
    flex-shrink: 0;
    padding: 12px 16px 14px;
    background: rgba(18, 18, 26, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 6px 10px 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    background: #12121e;
    transition: all 0.2s ease;
    position: relative;
}

.chat-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(93, 93, 255, 0.18);
}

.message-input {
    flex: 1;
    min-height: 36px;
    max-height: 130px;
    resize: none;
    border: none;
    outline: none;
    font-size: 0.92rem;
    line-height: 1.45;
    padding: 8px 0;
    color: #ffffff;
    background: transparent;
}

.message-input::placeholder { color: #6e6e82; }

.chat-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-controls button {
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-controls button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.chat-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

#send-message {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    box-shadow: 0 2px 10px rgba(93, 93, 255, 0.35);
    margin-left: 4px;
}

#send-message:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(93, 93, 255, 0.5);
}

#send-message:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.file-upload-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.file-upload-wrapper img {
    display: none;
    width: 30px; height: 30px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--primary-color);
}

.file-upload-wrapper.file-uploaded img      { display: block; }
.file-upload-wrapper.file-uploaded #file-upload { display: none; }
#file-cancel                                { display: none; }
.file-upload-wrapper.file-uploaded #file-cancel { display: flex; }

/* Emoji Picker */
em-emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 10px;
    z-index: 1000;
    display: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    max-height: 420px;
}

body.show-emoji-picker em-emoji-picker { display: block !important; }

.footer-info {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px 0;
    color: #636376;
    font-size: 0.72rem;
}

/* =========================================================
   AUTH OVERLAY — nakładka autoryzacji
========================================================= */
.chat-auth-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 11, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chat-auth-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.auth-modal {
    background: rgba(18, 18, 26, 0.97);
    border: 1px solid rgba(93, 93, 255, 0.25);
    border-radius: 18px;
    padding: 36px 32px 30px;
    width: 340px;
    max-width: calc(100% - 32px);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(93, 93, 255, 0.15);
    animation: authModalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authModalIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
    line-height: 1;
}

.auth-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.auth-subtitle {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 22px;
}

.auth-note {
    font-size: 0.78rem;
    color: #6e6e82;
}

.auth-expired-msg {
    color: #f87171;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-input {
    width: 100%;
    padding: 11px 16px;
    background: #0e0e1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.5px;
}

.auth-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(93, 93, 255, 0.2);
}

.auth-input::placeholder { color: #5a5a6e; }

.auth-submit-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(93, 93, 255, 0.4);
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.auth-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(93, 93, 255, 0.55);
}

.auth-submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.auth-error {
    margin-top: 10px;
    padding: 9px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 0.82rem;
    text-align: center;
}

/* =========================================================
   SCROLLBAR
========================================================= */
.chat-body::-webkit-scrollbar { width: 5px; }
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}
.chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(93, 93, 255, 0.4);
}

/* =========================================================
   TOGGLER (nieużywany na dedykowanej stronie, zachowany)
========================================================= */
.chatbot-toggler {
    position: fixed;
    right: 30px; bottom: 30px;
    width: 54px; height: 54px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 8px 25px rgba(93, 93, 255, 0.4);
    transition: all 0.2s ease;
}
.chatbot-toggler:hover { transform: scale(1.08); }

/* =========================================================
   RWD
========================================================= */
@media (max-width: 768px) {
    .chat-page-main {
        padding-top: 75px;
        padding-left: 10px;
        padding-right: 10px;
    }
    .chatbot-popup {
        height: calc(100vh - 90px);
        border-radius: 16px;
    }
    .message { max-width: 92%; }
    .auth-modal { padding: 28px 20px 24px; }
}

@media (max-width: 480px) {
    .footer-info { display: none; }
    .chat-body { padding: 14px 12px; }
    .chat-header { padding: 10px 14px; }
    .chat-logout-btn span { display: none; }
}
