/* ==========================================================================
   NEURAL CHAT PRO - SPYRTNY SPAWACZ EDITION v14.0 (COMPLETE)
   INDUSTRIAL ENTERPRISE UI | ZERO RADIUS | FIXED ALIGNMENT
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Główny kolor pobierany dynamicznie z ustawień PHP */
    --nc-primary: var(--nc-accent, #222222);
    
    /* Paleta systemowa */
    --nc-bg-dark: #111111;
    --nc-bg-light: #ffffff;
    --nc-bg-body: #f8fafc; /* Subtelny szary dla kontrastu dymków */
    --nc-border-color: #e5e7eb;
    
    /* Typografia */
    --nc-text-primary: #111827;
    --nc-text-secondary: #6b7280;
    
    /* Akcenty funkcyjne */
    --nc-success: #10b981;
    --nc-error: #ef4444;
    
    --nc-font: 'Inter', system-ui, -apple-system, sans-serif;
    --nc-z: 99999999;
}

/* ==========================================================================
   STRUKTURA GŁÓWNA
   ========================================================================== */
#nc-root {
    position: fixed;
    z-index: var(--nc-z);
    font-family: var(--nc-font);
    line-height: 1.5;
    pointer-events: none;
}

#nc-root * {
    box-sizing: border-box;
    pointer-events: auto;
}

/* ==========================================================================
   LAUNCHER (PRZYCISK OTWARCIA)
   ========================================================================== */
#nc-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    background: var(--nc-primary);
    color: #fff;
    border: none;
    border-radius: 0; /* Modern Square */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, background 0.2s ease;
}

#nc-launcher:hover { transform: scale(1.05); }

.nc-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--nc-error);
    color: #fff;
    width: 24px;
    height: 24px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: 2px solid #fff;
}

/* ==========================================================================
   OKNO CZATU (FULL HEIGHT / 50% WIDTH)
   ========================================================================== */
#nc-window {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 500px; /* Szerokość standardowa PRO */
    max-width: 50vw; /* Maksymalnie połowa ekranu */
    height: 100vh;
    background: #ffffff;
    box-shadow: -10px 0 50px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-left: 1px solid var(--nc-border-color);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    visibility: hidden;
}

#nc-root.open #nc-window {
    transform: translateX(0);
    visibility: visible;
}

/* ASPEKT SPAWALNICZY - Animowany żar łuku na górze */
#nc-window::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--nc-primary) 0%, #3b82f6 50%, var(--nc-primary) 100%);
    background-size: 200% auto;
    animation: nc-welding-glow 3s linear infinite;
    z-index: 10;
}

@keyframes nc-welding-glow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.nc-header {
    background: #fff;
    padding: 20px 30px;
    border-bottom: 1px solid var(--nc-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 90px;
    flex-shrink: 0;
}

.nc-header-content { display: flex; align-items: center; gap: 15px; }

.nc-avatar-img {
    width: 55px;
    height: 55px;
    background: var(--nc-primary);
    background-size: cover;
    background-position: center;
    object-fit: cover; /* FIX: Zdjęcie się nie rozjeżdża */
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid var(--nc-border-color);
}

.nc-meta { display: flex; flex-direction: column; }
.nc-name { font-weight: 700; font-size: 17px; color: var(--nc-text-primary); }
.nc-status-text { font-size: 11px; color: var(--nc-success); display: flex; align-items: center; gap: 6px; font-weight: 600; text-transform: uppercase; }
.nc-status-dot { width: 8px; height: 8px; background: var(--nc-success); border-radius: 0; }

.nc-icon-btn {
    background: transparent;
    border: none;
    color: var(--nc-text-secondary);
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}
.nc-icon-btn:hover { color: var(--nc-text-primary); }

/* ==========================================================================
   BODY (AREA WIADOMOŚCI)
   ========================================================================== */
.nc-body {
    flex: 1;
    background: var(--nc-bg-body);
    padding: 25px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nc-message { display: flex; max-width: 85%; }
.nc-message.nc-bot { align-self: flex-start; }
.nc-message.nc-user { align-self: flex-end; }

.nc-bubble {
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 0; /* Ostre krawędzie */
    word-wrap: break-word;
}

.nc-message.nc-bot .nc-bubble {
    background: #ffffff;
    color: var(--nc-text-primary);
    border: 1px solid var(--nc-border-color);
}

.nc-message.nc-user .nc-bubble {
    background: var(--nc-primary);
    color: #ffffff;
}

/* ==========================================================================
   CHIPS (PODPOWIEDZI / QUICK REPLIES)
   ========================================================================== */
.nc-chips-wrap {
    padding: 15px 30px;
    background: #fff;
    border-top: 1px solid var(--nc-border-color);
    flex-shrink: 0;
}

.nc-chips-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.nc-chips-scroll::-webkit-scrollbar { display: none; }

.nc-chips-scroll button {
    background: #fff;
    border: 1px solid var(--nc-border-color);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nc-text-primary);
    cursor: pointer;
    white-space: nowrap;
    border-radius: 0;
    transition: all 0.2s ease;
}

.nc-chips-scroll button:hover {
    border-color: var(--nc-primary);
    background: var(--nc-bg-body);
    color: var(--nc-primary);
}

/* ==========================================================================
   FOOTER (INPUT AREA - IDEALNA SYMETRIA)
   ========================================================================== */
.nc-footer {
    background: #fff;
    border-top: 1px solid var(--nc-border-color);
    padding: 0;
    flex-shrink: 0;
}

.nc-input-row {
    display: flex;
    width: 100%;
    height: 75px; /* STAŁA WYSOKOŚĆ DLA IDEALNEGO ZRÓWNANIA */
    align-items: stretch;
}

#nc-input {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    padding: 25px 30px;
    font-size: 15px;
    color: var(--nc-text-primary);
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

.nc-input-buttons {
    display: flex;
    height: 100%;
    flex-shrink: 0;
    border-left: 1px solid var(--nc-border-color);
}

.nc-mic-btn, .nc-send-btn {
    width: 75px; /* Kwadratowe przyciski pasujące do wysokości */
    height: 100%;
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--nc-text-secondary);
    transition: all 0.2s;
}

.nc-mic-btn { border-right: 1px solid var(--nc-border-color); }
.nc-mic-btn:hover { background: #f9fafb; color: var(--nc-primary); }

.nc-mic-btn.recording {
    background: #fee2e2;
    color: var(--nc-error);
    animation: nc-pulse 1.5s infinite;
}

.nc-send-btn {
    background: var(--nc-primary);
    color: #ffffff;
}

.nc-send-btn:hover { filter: brightness(1.1); }
.nc-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   REKOMENDACJE (AD LISTINGS)
   ========================================================================== */
.nc-recs-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 10px;
}

.nc-rec-card {
    display: flex;
    background: #ffffff;
    border: 1px solid var(--nc-border-color);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease;
    border-radius: 0;
    height: 110px;
    overflow: hidden;
}

.nc-rec-card:hover {
    border-color: var(--nc-primary);
    transform: translateX(5px);
}

.nc-rec-img {
    width: 110px;
    height: 110px;
    background-size: cover;
    background-position: center;
    object-fit: cover; /* FIX: Zdjęcie ogłoszenia się nie rozjeżdża */
    flex-shrink: 0;
    border-right: 1px solid var(--nc-border-color);
}

.nc-rec-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nc-rec-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--nc-text-primary);
    margin-bottom: 5px;
    line-height: 1.3;
}

.nc-rec-price { font-size: 15px; font-weight: 800; color: var(--nc-primary); }

/* ==========================================================================
   ELEMENTY POMOCNICZE
   ========================================================================== */
.nc-footer-meta {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    background: #fdfdfd;
    border-top: 1px solid #f9fafb;
    font-size: 10px;
}

.nc-char-counter { color: #aaa; font-weight: 600; }
.nc-powered-by { color: #ccc; text-transform: uppercase; letter-spacing: 1px; }

/* Animacja nagrywania */
@keyframes nc-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   RESPONSYWNOŚĆ (MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
    #nc-window {
        width: 100vw;
        max-width: 100vw;
        border-left: none;
    }
    
    .nc-header { padding: 15px 20px; height: 80px; }
    .nc-input-row { height: 65px; }
    .nc-mic-btn, .nc-send-btn { width: 65px; }
    #nc-input { padding: 18px 20px; }
    
    #nc-launcher {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
}