/* ═══════════════════════════════════════════════════
   Drive365 — Live Chat Widget
   Premium Navy + Gold Design
   ═══════════════════════════════════════════════════ */

/* ===== Chat Bubble ===== */
.livechat-bubble {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 6px 24px rgba(212,175,55,0.4), 0 0 0 0 rgba(212,175,55,0.3);
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    animation: livechatPulse 3s ease-in-out infinite;
    border: none;
    outline: none;
}
.livechat-bubble.scrolled {
    bottom: 96px;
}
.livechat-bubble:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 32px rgba(212,175,55,0.5);
    animation: none;
}
.livechat-bubble .bubble-icon { transition: transform 0.3s; }
.livechat-bubble.open .bubble-icon { transform: rotate(90deg); }
.livechat-bubble .bubble-close { display: none; }
.livechat-bubble.open .bubble-icon { display: none; }
.livechat-bubble.open .bubble-close { display: block; }

.livechat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #0B0F19;
    display: none;
    animation: badgePop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.livechat-badge.show { display: block; }

.livechat-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #0B0F19;
    transition: background 0.3s;
}
.livechat-status-dot.online { background: #22c55e; }
.livechat-status-dot.offline { background: #f59e0b; }

@keyframes livechatPulse {
    0%, 100% { box-shadow: 0 6px 24px rgba(212,175,55,0.4), 0 0 0 0 rgba(212,175,55,0.3); }
    50% { box-shadow: 0 6px 24px rgba(212,175,55,0.4), 0 0 0 10px rgba(212,175,55,0); }
}
@keyframes badgePop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ===== Chat Window ===== */
.livechat-window {
    position: fixed;
    bottom: 104px;
    right: 32px;
    width: 380px;
    max-height: 520px;
    background: rgba(11, 15, 25, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212,175,55,0.15);
    border-radius: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,175,55,0.1);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.livechat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Header */
.livechat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(212,175,55,0.1), rgba(212,175,55,0.03));
    border-bottom: 1px solid rgba(212,175,55,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.livechat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B0F19;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}
.livechat-header-info { flex: 1; min-width: 0; }
.livechat-header-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
}
.livechat-header-status {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    gap: 5px;
}
.livechat-header-status .status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.livechat-header-status .status-indicator.online { background: #22c55e; }
.livechat-header-status .status-indicator.offline { background: #f59e0b; }
.livechat-header-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
}
.livechat-header-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Messages Area */
.livechat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 250px;
    max-height: 320px;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,0.2) transparent;
}
.livechat-messages::-webkit-scrollbar { width: 4px; }
.livechat-messages::-webkit-scrollbar-track { background: transparent; }
.livechat-messages::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.2); border-radius: 4px; }

/* Message Bubbles */
.livechat-msg {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    animation: msgSlideIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.livechat-msg.customer { align-self: flex-end; }
.livechat-msg.admin { align-self: flex-start; }

.livechat-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.84rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.livechat-msg.customer .livechat-msg-bubble {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19;
    border-bottom-right-radius: 4px;
}
.livechat-msg.admin .livechat-msg-bubble {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    border-bottom-left-radius: 4px;
}
.livechat-msg-time {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    margin-top: 3px;
    padding: 0 4px;
}
.livechat-msg.customer .livechat-msg-time { text-align: right; }

/* Greeting Message */
.livechat-greeting {
    text-align: center;
    padding: 20px;
}
.livechat-greeting-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(212,175,55,0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.livechat-greeting-text {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
}

/* Typing Indicator */
.livechat-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}
.livechat-typing.show { display: flex; }
.livechat-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.livechat-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.livechat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.livechat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input Area */
.livechat-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0,0,0,0.2);
}
.livechat-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.84rem;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 40px;
    max-height: 80px;
    transition: border-color 0.2s;
}
.livechat-input:focus {
    border-color: rgba(212,175,55,0.3);
}
.livechat-input::placeholder {
    color: rgba(255,255,255,0.3);
}
.livechat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s;
}
.livechat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}
.livechat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Attach Ticket Button */
.livechat-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s;
}
.livechat-attach-btn:hover {
    color: #d4af37;
    border-color: rgba(212,175,55,0.3);
    background: rgba(212,175,55,0.08);
}

/* Ticket Insert Panel */
.livechat-ticket-panel {
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(212,175,55,0.1);
    position: relative;
}

/* Ticket Dropdown — opens upward */
.livechat-ticket-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 10px 10px 0 0;
    border: 1px solid rgba(212,175,55,0.15);
    background: rgba(11,15,25,0.98);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,0.2) transparent;
    z-index: 10;
}
.livechat-ticket-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.livechat-ticket-dropdown-item:hover {
    background: rgba(212,175,55,0.08);
}
.livechat-ticket-dropdown-item:last-child {
    border-bottom: none;
}
.livechat-ticket-dropdown-num {
    font-size: 0.68rem;
    color: #d4af37;
    font-weight: 600;
}
.livechat-ticket-dropdown-subject {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}
.livechat-ticket-dropdown-meta {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.3);
    margin-top: 3px;
    display: flex;
    gap: 8px;
}
.livechat-ticket-dropdown-empty {
    padding: 16px 12px;
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.3);
}

/* Ticket Card in Messages */
.livechat-ticket-card {
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.15);
    border-radius: 12px;
    padding: 10px 14px;
    margin-top: 4px;
}
.livechat-ticket-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: #d4af37;
    font-weight: 600;
    margin-bottom: 6px;
}
.livechat-ticket-card-subject {
    font-size: 0.8rem;
    color: #fff;
    font-weight: 600;
    margin-bottom: 4px;
}
.livechat-ticket-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
}

/* Footer Link */
.livechat-footer {
    padding: 6px 16px 10px;
    text-align: center;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.2);
}

/* Offline State */
.livechat-offline {
    text-align: center;
    padding: 24px 20px;
}
.livechat-offline-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}
.livechat-offline-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}
.livechat-offline-text {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 16px;
    line-height: 1.4;
}
.livechat-offline-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19;
    border: none;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.livechat-offline-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

/* Login Required */
.livechat-login-required {
    text-align: center;
    padding: 24px 20px;
}
.livechat-login-required p {
    font-size: 0.84rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 12px;
}
.livechat-login-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19;
    border: none;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}
.livechat-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

/* End Chat Button */
.livechat-end-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}
.livechat-end-btn:hover {
    color: #ef4444;
    background: rgba(239,68,68,0.1);
}

/* ===== Sound Toggle ===== */
.livechat-sound-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}
.livechat-sound-btn:hover { color: #d4af37; }
.livechat-sound-btn.muted { color: rgba(255,255,255,0.15); }

/* ===== Proactive Chat Nudge ===== */
.livechat-proactive {
    position: fixed;
    bottom: 90px;
    right: 32px;
    z-index: 9999;
    animation: proactiveSlide 0.4s ease-out;
}
.livechat-proactive.scrolled { bottom: 154px; }
.livechat-proactive-bubble {
    background: linear-gradient(135deg, rgba(11,15,25,0.95), rgba(20,25,40,0.95));
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 16px 16px 4px 16px;
    padding: 14px 18px;
    max-width: 260px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    position: relative;
}
.livechat-proactive-text { font-size: 0.82rem; color: rgba(255,255,255,0.85); line-height: 1.4; }
.livechat-proactive-close {
    position: absolute; top: 4px; right: 8px;
    background: none; border: none;
    color: rgba(255,255,255,0.3); cursor: pointer; font-size: 1rem;
}
@keyframes proactiveSlide {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Pre-chat Form ===== */
.livechat-prechat { text-align: center; padding: 8px 20px; }
.livechat-prechat-icon { font-size: 2rem; margin-bottom: 8px; }
.livechat-prechat-title { font-size: 0.95rem; font-weight: 600; color: #fff; margin-bottom: 16px; }
.livechat-prechat-form { display: flex; flex-direction: column; gap: 10px; }
.livechat-prechat-input {
    width: 100%; padding: 10px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; color: #fff; font-size: 0.82rem;
    outline: none; transition: border 0.2s; box-sizing: border-box;
}
.livechat-prechat-input:focus { border-color: rgba(212,175,55,0.4); }
.livechat-prechat-btn {
    padding: 11px;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19; border: none; border-radius: 10px;
    font-size: 0.84rem; font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.livechat-prechat-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,175,55,0.3); }

/* ===== Emoji Picker ===== */
.livechat-emoji-picker {
    padding: 8px; background: rgba(0,0,0,0.4);
    border-top: 1px solid rgba(212,175,55,0.1);
    max-height: 160px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(212,175,55,0.2) transparent;
}
.livechat-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.livechat-emoji-grid span {
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer; padding: 5px; border-radius: 6px; transition: background 0.15s;
}
.livechat-emoji-grid span:hover { background: rgba(212,175,55,0.15); }

/* ===== File Upload ===== */
.livechat-upload-preview {
    padding: 8px 16px; background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(212,175,55,0.1);
}
.livechat-upload-info { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: rgba(255,255,255,0.6); }
.livechat-upload-info i { color: #d4af37; }
.livechat-upload-cancel { margin-left: auto; background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 1rem; }
.livechat-upload-progress { margin-top: 6px; width: 100%; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.livechat-upload-bar { height: 100%; background: linear-gradient(90deg, #d4af37, #f0d060); width: 0; transition: width 0.3s; border-radius: 2px; }

.livechat-file-msg {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: rgba(212,175,55,0.06); border: 1px solid rgba(212,175,55,0.12);
    border-radius: 10px; text-decoration: none; color: rgba(255,255,255,0.8);
    font-size: 0.78rem; transition: background 0.2s;
}
.livechat-file-msg:hover { background: rgba(212,175,55,0.12); }
.livechat-file-msg i { color: #d4af37; font-size: 0.9rem; }
.livechat-file-msg img { max-width: 200px; max-height: 150px; border-radius: 8px; }

/* ===== Chat Rating ===== */
.livechat-rating { text-align: center; padding: 20px; }
.livechat-rating-title { font-size: 0.9rem; font-weight: 600; color: #fff; margin-bottom: 14px; }
.livechat-rating-stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.livechat-rating-stars span { font-size: 1.6rem; cursor: pointer; color: rgba(255,255,255,0.2); transition: all 0.2s; }
.livechat-rating-stars span:hover,
.livechat-rating-stars span.active { color: #d4af37; transform: scale(1.15); }
.livechat-rating-comment {
    width: 100%; padding: 8px 12px; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
    color: #fff; font-size: 0.78rem; resize: none; outline: none; margin-bottom: 10px; box-sizing: border-box;
}
.livechat-rating-submit {
    width: 100%; padding: 10px;
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: #0B0F19; border: none; border-radius: 10px;
    font-weight: 700; font-size: 0.82rem; cursor: pointer; transition: all 0.2s; margin-bottom: 6px;
}
.livechat-rating-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,175,55,0.3); }
.livechat-rating-skip { background: none; border: none; color: rgba(255,255,255,0.3); font-size: 0.75rem; cursor: pointer; }
.livechat-rating-skip:hover { color: rgba(255,255,255,0.5); }

@keyframes msgSlideIn {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes modalPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes thankYouPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .livechat-bubble { bottom: 24px; right: 20px; width: 54px; height: 54px; font-size: 1.2rem; }
    .livechat-window { bottom: 0; right: 0; left: 0; width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; border: none; }
    .livechat-messages { max-height: calc(100vh - 180px); max-height: calc(100dvh - 180px); }
    .livechat-proactive { right: 20px; bottom: 84px; }
}

body.mobile-app-mode .livechat-bubble { bottom: 100px; }
body.mobile-app-mode .livechat-bubble.scrolled { bottom: 100px; }
body.mobile-app-mode .livechat-window { bottom: 0; right: 0; left: 0; width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 20px 20px 0 0; }

