/* ============================================================
   Viber Inbox — UI mockup (design only, mock data)
   Boje: Comtrade crvena #e51937, Viber ljubičasta #7360f2
   ============================================================ */

/* ---- Ikonica u zaglavlju (pored Log out) ---- */
.viber-inbox-trigger {
    position: relative;
    display: inline-block;
    vertical-align: top;
    margin-right: 18px;
    cursor: pointer;
    color: #e51937;
    line-height: 1;
}

.viber-inbox-trigger svg {
    width: 20px;
    height: 20px;
    vertical-align: top;
    fill: currentColor;
}

.viber-inbox-trigger:hover {
    color: #7360f2;
}

.viber-inbox-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e51937;
    color: #fff;
    font-family: 'PT Sans Narrow', Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
}

/* ---- Overlay + modal ---- */
.viber-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
}

.viber-overlay.is-open {
    display: block;
}

.viber-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 900px;
    max-width: 95%;
    height: 600px;
    max-height: 90%;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'PT Sans Narrow', Arial, sans-serif;
}

/* ---- Zajednički header modala ---- */
.viber-modal-header {
    flex: 0 0 auto;
    height: 52px;
    background: #7360f2;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 14px;
}

.viber-modal-header .vh-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
    flex: 1 1 auto;
}

.viber-modal-header .vh-icon {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    fill: #fff;
}

.viber-modal-header .vh-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    margin-right: 10px;
    padding: 0 6px;
    line-height: 1;
    display: none;
}

.viber-modal-header .vh-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.viber-modal-header .vh-close:hover,
.viber-modal-header .vh-back:hover {
    color: #ffd6de;
}

/* ---- Telo modala: prebacivanje list <-> chat ---- */
.viber-modal-body {
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
}

/* =========================================================
   VIEW 1 — Lista konverzacija
   ========================================================= */
.viber-conv-list {
    height: 100%;
    overflow-y: auto;
}

.viber-conv-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.viber-conv-item:hover {
    background: #f6f5ff;
}

.viber-avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #7360f2;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    text-transform: uppercase;
}

.viber-conv-main {
    flex: 1 1 auto;
    min-width: 0;
}

.viber-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.viber-conv-name {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viber-conv-time {
    flex: 0 0 auto;
    font-size: 12px;
    color: #999;
    margin-left: 10px;
}

.viber-conv-preview {
    font-size: 14px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.viber-conv-unread {
    flex: 0 0 auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 10px;
    border-radius: 10px;
    background: #e51937;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-sizing: border-box;
}

/* =========================================================
   VIEW 2 — Chat prozor
   ========================================================= */
.viber-chat {
    display: none;
    flex-direction: column;
    height: 100%;
}

.viber-modal.is-chat .viber-conv-list {
    display: none;
}

.viber-modal.is-chat .viber-chat {
    display: flex;
}

.viber-modal.is-chat .vh-back {
    display: inline-block;
}

.viber-chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: #efeff5;
}

.viber-day-sep {
    text-align: center;
    margin: 10px 0;
}

.viber-day-sep span {
    display: inline-block;
    background: #d7d7e3;
    color: #555;
    font-size: 12px;
    padding: 2px 12px;
    border-radius: 10px;
}

.viber-msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.viber-msg-bubble {
    max-width: 68%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.35;
    color: #222;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.viber-msg-time {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

/* Dolazna poruka (levo) */
.viber-msg.in {
    align-items: flex-start;
}

.viber-msg.in .viber-msg-bubble {
    background: #fff;
    border-top-left-radius: 2px;
}

/* Odlazna poruka (desno) */
.viber-msg.out {
    align-items: flex-end;
}

.viber-msg.out .viber-msg-bubble {
    background: #e7defb;
    border-top-right-radius: 2px;
}

/* ---- Kvacice (status isporuke) ---- */
.viber-ticks {
    margin-left: 5px;
    font-size: 12px;
    font-weight: 700;
}

.viber-ticks.sent,
.viber-ticks.delivered {
    color: #9aa0a6;              /* siva */
}

.viber-ticks.delivered,
.viber-ticks.seen {
    letter-spacing: -3px;        /* dve kvacice blize */
}

.viber-ticks.seen {
    color: #7360f2;              /* obojena (viber) */
}

/* ---- Greska (status 12 = undelivered) ---- */
.viber-msg-error {
    font-size: 11px;
    color: #e51937;
    margin-top: 2px;
    padding: 0 4px;
}

/* ---- Composer ---- */
.viber-composer {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    padding: 10px 12px;
    border-top: 1px solid #ddd;
    background: #fff;
}

.viber-composer textarea {
    flex: 1 1 auto;
    resize: none;
    height: 40px;
    max-height: 120px;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.3;
    outline: none;
    box-sizing: border-box;
}

.viber-composer textarea:focus {
    border-color: #7360f2;
}

.viber-send-btn {
    flex: 0 0 auto;
    margin-left: 10px;
    height: 40px;
    padding: 0 20px;
    border: none;
    border-radius: 20px;
    background: #7360f2;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.viber-send-btn:hover {
    background: #5f4de0;
}

.viber-send-btn:disabled {
    background: #b7aef2;
    cursor: default;
}

/* ---- Toolbar: izbor sender-a (potpisa) ---- */
.viber-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid #eee;
    background: #faf9ff;
}

.viber-toolbar label {
    font-size: 14px;
    color: #555;
    font-weight: 700;
}

.viber-toolbar select {
    flex: 1 1 auto;
    max-width: 320px;
    font-family: inherit;
    font-size: 14px;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

.viber-toolbar select:focus {
    border-color: #7360f2;
}

.viber-modal.is-chat .viber-toolbar {
    display: none;
}

/* ---- Pod-red u listi: sender + preview ---- */
.viber-conv-sub {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 2px;
    min-width: 0;
}

.viber-conv-sender {
    flex: 0 0 auto;
    max-width: 40%;
    font-size: 12px;
    font-weight: 700;
    color: #7360f2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Tačka: neodgovoreno ---- */
.viber-conv-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-left: 10px;
    border-radius: 50%;
    background: #e51937;
}

/* ---- Prazno stanje ---- */
.viber-empty {
    padding: 30px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* ---- Busy indikator (prvi load) ---- */
.viber-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 16px;
    color: #777;
    font-size: 14px;
}

.viber-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #e0dcf7;
    border-top-color: #7360f2;
    border-radius: 50%;
    animation: viber-spin 0.8s linear infinite;
}

@keyframes viber-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .viber-spinner { animation-duration: 2s; }
}

/* ---- Dugme za sliku u composer-u ---- */
.viber-attach-btn {
    flex: 0 0 auto;
    margin-right: 8px;
    height: 40px;
    width: 40px;
    border: 1px solid #ccc;
    border-radius: 20px;
    background: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.viber-attach-btn:hover {
    border-color: #7360f2;
    background: #f6f5ff;
}

/* ---- Slika u mehuriću ---- */
.viber-msg-img {
    display: block;
    max-width: 220px;
    max-height: 220px;
    border-radius: 8px;
    cursor: pointer;
}

.viber-msg-text {
    margin-top: 4px;
}

.viber-msg-file {
    display: inline-block;
    color: #7360f2;
    text-decoration: none;
    font-weight: 700;
}

.viber-msg-file:hover {
    text-decoration: underline;
}

.viber-msg-img + .viber-msg-text {
    margin-top: 6px;
}

/* ---- Lightbox: uvećan prikaz slike (klik na sliku u chatu) ---- */
.viber-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;             /* iznad modala (10000) */
    cursor: zoom-out;
}

.viber-lightbox.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.viber-lightbox-img {
    max-width: 92%;
    max-height: 92%;
    border-radius: 4px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.viber-lightbox-close {
    position: absolute;
    top: 14px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

.viber-lightbox-close:hover {
    color: #ffd6de;
}
