/* ===== PreuzmiLeasing Sustav Poruka ===== */

#pl-poruke-app {
    display: flex;
    height: min(72vh, 760px);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #222;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 980px;
    margin: 0 auto;
    background: #0f0f0f;
}

.pl-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    background: #111;
    flex-shrink: 0;
    border-right: 1px solid #222;
}

.pl-sidebar-header {
    padding: 16px 18px;
    background: #E85D04;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pl-sidebar-header span {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.pl-badge {
    margin-left: auto;
    background: #fff;
    color: #E85D04;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.pl-conv-list {
    flex: 1;
    overflow-y: auto;
}

.pl-conv-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #1a1a1a;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.pl-conv-item:hover { background: #1a1a1a; }
.pl-conv-item.active { background: #1e1e1e; border-left-color: #E85D04; }

.pl-conv-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pl-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E85D04;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.pl-conv-info { flex: 1; min-width: 0; }

.pl-conv-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-conv-name.unread { font-weight: 700; }

.pl-conv-preview,
.pl-conv-meta {
    color: #777;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

.pl-conv-ad {
    color: #E85D04;
    font-size: 11px;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E85D04;
    margin-left: 6px;
    vertical-align: middle;
}

.pl-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d0d0d;
    min-width: 0;
}

.pl-chat-header {
    padding: 14px 18px;
    border-bottom: 1px solid #1e1e1e;
    background: #111;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.pl-header-name {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.pl-header-ad {
    color: #E85D04;
    font-size: 12px;
    margin-top: 2px;
}

.pl-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pl-empty {
    margin: auto;
    color: #444;
    font-size: 14px;
    text-align: center;
}

.pl-msg { display: flex; }
.pl-msg.moja { justify-content: flex-end; }
.pl-msg.tudja { justify-content: flex-start; }

.pl-bubble {
    max-width: min(70%, 520px);
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.55;
    color: #fff;
    word-break: break-word;
}

.pl-bubble.moja {
    background: #E85D04;
    border-radius: 16px 16px 4px 16px;
}

.pl-bubble.tudja {
    background: #1e1e1e;
    border-radius: 16px 16px 16px 4px;
}

.pl-bubble-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 5px;
    text-align: right;
}

.pl-input-area {
    padding: 14px 18px;
    border-top: 1px solid #1e1e1e;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #111;
}

.pl-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
}

.pl-input::placeholder { color: #555; }
.pl-input:focus { border-color: #E85D04; }

.pl-send {
    background: #E85D04;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}

.pl-send:hover { background: #c94e03; }
.pl-send:disabled { opacity: .7; cursor: wait; }

.pl-btn-kontakt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #E85D04;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}

.pl-btn-kontakt:hover { background: #c94e03; color: #fff; }

#pl-floating-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: #E85D04;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(232,93,4,0.35);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    font-family: inherit;
    transition: background 0.15s;
}

#pl-floating-btn:hover { background: #c94e03; }

#pl-floating-badge {
    background: #fff;
    color: #E85D04;
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 700;
}

.pl-loading {
    padding: 20px;
    text-align: center;
    color: #555;
    font-size: 13px;
}

.pl-conv-list::-webkit-scrollbar,
.pl-messages::-webkit-scrollbar { width: 4px; }
.pl-conv-list::-webkit-scrollbar-track,
.pl-messages::-webkit-scrollbar-track { background: transparent; }
.pl-conv-list::-webkit-scrollbar-thumb,
.pl-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* MODAL CHAT */
body.pl-chat-modal-open { overflow: hidden; }

.pl-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
}

.pl-chat-modal.is-open { display: block; }

.pl-chat-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.66);
    backdrop-filter: blur(2px);
}

.pl-chat-modal__dialog {
    position: absolute;
    right: 24px;
    bottom: 24px;
    width: min(420px, calc(100vw - 24px));
    height: min(680px, calc(100vh - 40px));
    border-radius: 18px;
    overflow: hidden;
    background: #0f0f0f;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.pl-chat-modal__shell {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pl-chat-modal__header { padding-right: 54px; }

.pl-chat-modal__messages {
    min-height: 320px;
    background: #0d0d0d;
}

.pl-chat-modal__input {
    display: flex;
}

.pl-chat-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.pl-chat-modal__close:hover { background: rgba(255,255,255,.08); }

.pl-chat-modal__login {
    padding: 18px;
    border-top: 1px solid #1e1e1e;
    background: #111;
}

@media (max-width: 768px) {
    #pl-poruke-app {
        height: 100vh;
        border-radius: 0;
        flex-direction: column;
    }

    .pl-sidebar {
        width: 100%;
        height: 220px;
    }

    .pl-chat-modal__dialog {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        max-width: none;
    }
}

@media (max-width: 600px) {
    #pl-floating-btn span { display: none; }
}

.pl-input-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pl-attach-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
    border-radius: 10px;
    background: #1a1a1a;
    color: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.pl-attach-btn:hover {
    border-color: #E85D04;
    background: #202020;
}

.pl-upload-preview {
    display: none;
}

.pl-upload-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
}

.pl-upload-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.pl-upload-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pl-upload-meta strong,
.pl-upload-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-upload-meta strong {
    color: #fff;
    font-size: 12px;
}

.pl-upload-meta span {
    color: #999;
    font-size: 11px;
}

.pl-upload-remove {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid #333;
    background: #101010;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.pl-chat-image-link {
    display: block;
    margin-bottom: 8px;
}

.pl-chat-image {
    display: block;
    max-width: min(260px, 100%);
    max-height: 280px;
    border-radius: 14px;
    object-fit: cover;
}

.pl-bubble-text {
    white-space: normal;
}

@media (max-width: 600px) {
    .pl-chat-image {
        max-width: min(220px, 100%);
        max-height: 220px;
    }
}


.pl-upload-list {
    display: grid;
    gap: 8px;
}

.pl-chat-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.pl-chat-image-link {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,.04);
}

.pl-chat-image {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.pl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pl-lightbox__img {
    max-width: min(1100px, 96vw);
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 20px 80px rgba(0,0,0,.45);
}

.pl-lightbox__close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.pl-no-scroll {
    overflow: hidden;
}
