/* ==========================================
   CHAT SYSTEM v2 — Styles
   ========================================== */

/* --- USER WIDGET --- */
.cc-trigger {
    position: fixed; bottom: 0; right: 0; z-index: 10000;
    height: 48px; padding: 0 16px; border-radius: 12px 0 0 0;
    background: linear-gradient(135deg, #e855a8, #d63384);
    color: #fff; display: flex; align-items: center; gap: 8px;
    cursor: pointer; box-shadow: 0 -2px 16px rgba(232,85,168,0.3);
    transition: transform .2s, box-shadow .2s;
    font-size: 14px; font-weight: 600; white-space: nowrap;
}
.cc-trigger:hover { transform: scale(1.05); box-shadow: 0 6px 25px rgba(232,85,168,0.5); }

.cc-unread-badge {
    position: absolute; top: -4px; right: -4px;
    background: #00cc55; color: #fff;
    font-size: 11px; font-weight: 700; min-width: 18px; height: 18px;
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; border: 2px solid #fff; line-height: 1;
}

.cc-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10001; background: rgba(0,0,0,0.3);
    display: flex; align-items: flex-end; justify-content: flex-end;
    padding: 0; touch-action: none;
}
.cc-window {
    background: #fff; border-radius: 16px 16px 0 0;
    width: 100%; max-width: 400px; height: 80vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.cc-header {
    background: #fff; color: #333; padding: 14px 16px 8px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; flex-shrink: 0; border-bottom: 1px solid #f0f0f0;
}
.cc-header-left { display: flex; align-items: center; gap: 10px; }
.cc-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #e855a8, #d63384);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: #fff;
}
.cc-title { font-weight: 600; font-size: 15px; color: #222; }
.cc-subtitle { font-size: 11px; color: #00cc55; }
.cc-close-btn {
    background: none; border: none; color: #e855a8; font-size: 60px;
    cursor: pointer; padding: 0; line-height: 1;
    transition: transform .2s ease; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.cc-close-btn:hover { transform: scale(1.1); }
.cc-close-btn:active { transform: scale(0.9); }

.cc-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 6px; background: #fafafa;
}
.cc-msg { display: flex; flex-direction: column; max-width: 80%; }
.cc-msg-user { align-self: flex-end; align-items: flex-end; }
.cc-msg-admin { align-self: flex-start; align-items: flex-start; }

.cc-bubble {
    padding: 8px 12px; border-radius: 12px;
    font-size: 13px; line-height: 1.4; word-break: break-word;
}
.cc-msg-user .cc-bubble {
    background: linear-gradient(135deg, #e855a8, #d63384);
    color: #fff; border-bottom-right-radius: 4px;
}
.cc-msg-admin .cc-bubble {
    background: #fff; color: #333;
    border: 1.5px solid #e855a8; border-bottom-left-radius: 4px;
}

.cc-time {
    font-size: 10px; color: #bbb; margin-top: 2px; padding: 0 4px;
    display: flex; align-items: center; gap: 4px;
}
.cc-ticks { font-size: 11px; letter-spacing: -3px; font-weight: 700; line-height: 1; }
.cc-ticks.read { color: #00cc55; }
.cc-ticks:not(.read) { color: rgba(0,0,0,0.25); }

.cc-input-area {
    padding: 10px 12px; border-top: 1px solid #f0f0f0;
    background: #fff; flex-shrink: 0;
}
.cc-input-row { display: flex; gap: 8px; align-items: center; }
.cc-input {
    flex: 1; border: 1px solid #e855a8; border-radius: 20px;
    padding: 9px 14px; font-size: 13px; outline: none;
    transition: border-color .2s, box-shadow .2s; background: #fff;
    box-shadow: 0 0 0 1px rgba(232,85,168,0.15);
}
.cc-input:focus { border-color: #d63384; box-shadow: 0 0 0 2px rgba(232,85,168,0.3); }
.cc-send-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #e855a8, #d63384);
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: transform .15s;
}
.cc-send-btn:hover { transform: scale(1.08); }
.cc-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.cc-cooldown-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0 6px; flex-shrink: 0;
}
.cc-cooldown-track {
    flex: 1; height: 4px; background: #f0f0f0; border-radius: 2px; overflow: hidden;
}
.cc-cooldown-fill {
    height: 100%; background: linear-gradient(90deg, #e855a8, #d63384);
    border-radius: 2px; transition: width 0.1s linear;
}

.cc-cooldown-label {
    font-size: 11px; color: #999; white-space: nowrap; flex-shrink: 0; min-width: 90px;
    text-align: right;
}
.cc-login-form {
    padding: 16px; display: flex; flex-direction: column;
    gap: 10px; background: #fff; flex-shrink: 0;
}
.cc-start-btn {
    background: linear-gradient(135deg, #e855a8, #d63384);
    color: #fff; border: none; border-radius: 10px;
    padding: 11px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: opacity .2s;
}
.cc-start-btn:hover { opacity: 0.9; }

@media (max-width: 992px) {
    .cc-overlay { align-items: stretch; padding: 0; z-index: 999999; }
    .cc-window { max-width: 100%; height: 100%; border-radius: 0; position: fixed; top: 0; left: 0; right: 0; bottom: 0; }
    .cc-trigger { display: none !important; }
}

/* --- ADMIN PANEL --- */
.chat-session-btn.active { background-color: rgba(232,85,168,0.08); border-color: #e855a8; color: inherit !important; }
.chat-session-btn.active .fw-bold { color: #000 !important; }
.chat-session-btn.active .chat-delete-btn { color: #dc3545 !important; }
.chat-delete-btn {
    opacity: 0.5; transition: opacity 0.15s; color: #dc3545;
    font-size: 0.85rem; cursor: pointer; padding: 2px 4px;
    background: none; border: none;
}
.chat-delete-btn:hover { opacity: 1 !important; }
.min-width-0 { min-width: 0; }

/* New session appear animation */
@keyframes chatSessionAppear {
    0% { opacity: 0; transform: translateX(-12px); }
    100% { opacity: 1; transform: translateX(0); }
}
.chat-session-new {
    animation: chatSessionAppear 0.35s ease-out;
}

.chat-admin-msg { display: flex; flex-direction: column; max-width: 70%; }
.chat-admin-msg-admin { align-self: flex-end; align-items: flex-end; margin-left: auto; }
.chat-admin-msg-user { align-self: flex-start; align-items: flex-start; margin-right: auto; }
.chat-admin-bubble {
    padding: 10px 14px; border-radius: 14px;
    font-size: 14px; line-height: 1.4; word-break: break-word;
}
.chat-admin-msg-admin .chat-admin-bubble {
    background: linear-gradient(135deg, #e855a8, #d63384);
    color: #fff; border-bottom-right-radius: 4px;
}
.chat-admin-msg-user .chat-admin-bubble {
    background: #fff;
    border: 1.5px solid #e855a8;
    border-bottom-left-radius: 4px;
}
.chat-admin-ticks {
    font-size: 13px; margin-left: 6px; display: inline-flex;
    align-items: center; letter-spacing: -4px; font-weight: 700; line-height: 1;
}
.chat-admin-ticks.read { color: #00cc55 !important; }
.chat-admin-ticks:not(.read) { color: rgba(255,255,255,0.8) !important; }
.chat-admin-time { font-size: 10px; color: #999; margin-top: 2px; padding: 0 4px; }
#chat-admin-input {
    border: 1px solid #e855a8;
    box-shadow: 0 0 0 1px rgba(232,85,168,0.2);
}
#chat-admin-input:focus {
    border-color: #d63384;
    box-shadow: 0 0 0 2px rgba(232,85,168,0.35);
}

@media (max-width: 768px) {
    #chat-sessions-panel { height: auto !important; max-height: 40vh; overflow-y: auto; border-right: none; border-bottom: 1px solid #eee; }
    #chat-main-panel { height: auto !important; min-height: 0; }
}
