/**
 * Chat Widget Styles - PT Arsitekta Marine
 * Floating Chat Bubble Widget
 */

/* ============================================
   Chat Widget Container
============================================ */
.chat-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    background: transparent !important;
}

/* Hide popup completely when not active */
.chat-widget:not(.active) .chat-popup {
    display: none;
}

/* ============================================
   Chat Toggle Button
============================================ */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1B7A8C, #2596A6);
    border: none;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 20px rgba(27, 122, 140, 0.4);
    transition: transform 0.3s;
}

.chat-toggle:hover {
    transform: scale(1.1);
}

.toggle-icon {
    color: white;
    font-size: 1.5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: 0.3s;
}

.toggle-icon.close {
    opacity: 0;
}

.chat-widget.active .toggle-icon.open {
    opacity: 0;
}

.chat-widget.active .toggle-icon.close {
    opacity: 1;
}

.online-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 14px;
    height: 14px;
    background: #10B981;
    border: 3px solid white;
    border-radius: 50%;
}

/* ============================================
   Chat Popup Container
============================================ */
.chat-popup {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 360px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    flex-direction: column;
    overflow: hidden;
    max-height: 500px;
    pointer-events: none;
}

.chat-widget.active .chat-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    display: flex;
    pointer-events: auto;
}

/* ============================================
   Chat Header
============================================ */
.chat-popup-header {
    background: linear-gradient(135deg, #1B7A8C, #2596A6);
    padding: 16px;
    position: relative;
    color: white;
}

.chat-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-avatar-lg {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.admin-avatar-lg img {
    width: 75%;
    height: 75%;
    object-fit: contain;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border: 2px solid white;
    border-radius: 50%;
}

.header-info {
    flex: 1;
}

.header-info h4 {
    font-size: 1rem;
    margin: 0;
}

.header-info .dept {
    font-size: 0.75rem;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}

.btn-change-category {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-change-category:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-change-category i {
    font-size: 0.7rem;
}

/* ============================================
   Chat Body
============================================ */
.chat-popup-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f5f7f9;
    max-height: 320px;
}

/* Welcome Message */
.welcome-msg {
    margin-bottom: 12px;
}

.welcome-msg p {
    margin: 0;
    font-size: 0.9rem;
    color: #374151;
}

.welcome-msg .sub {
    color: #6B7280;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ============================================
   Category Selection
============================================ */
.category-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-btn {
    background: white;
    border: 2px solid #E5E7EB;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}

.category-btn:hover {
    border-color: #1B7A8C;
    background: rgba(27, 122, 140, 0.05);
}

.category-btn i {
    color: #1B7A8C;
    width: 20px;
}

/* ============================================
   Connecting/Admin Found
============================================ */
.connecting-msg {
    text-align: center;
    margin-bottom: 16px;
}

.admin-found {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #D1FAE5;
    padding: 10px 16px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.admin-pic {
    width: 32px;
    height: 32px;
    background: #10B981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

#adminNameDisplay {
    font-weight: 600;
    color: #065F46;
}

/* Back to Category Button */
.btn-back-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    color: #6B7280;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back-category:hover {
    background: #F3F4F6;
    border-color: #1B7A8C;
    color: #1B7A8C;
}

.btn-back-category i {
    font-size: 0.75rem;
}

/* ============================================
   Quick Info Form
============================================ */
.form-mini {
    margin-bottom: 10px;
}

.form-mini input {
    width: 100%;
    padding: 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-mini input:focus {
    outline: none;
    border-color: #1B7A8C;
}

.btn-connect {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1B7A8C, #2596A6);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.btn-connect:hover {
    opacity: 0.9;
}

.btn-connect:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================
   Chat Messages
============================================ */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

.msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    flex-shrink: 0;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.msg-content {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.msg.user .msg-content {
    background: #1B7A8C;
    color: white;
}

.msg-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.msg-time {
    font-size: 0.7rem;
    color: #9CA3AF;
    margin-top: 4px;
    display: block;
}

.msg.user .msg-time {
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   Limit Reached Box
============================================ */
.limit-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-top: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.limit-box > i {
    font-size: 2.5rem;
    color: #25D366;
}

.limit-box p {
    margin: 10px 0;
    color: #6B7280;
}

.wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #25D366;
    color: white;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 10px;
    text-decoration: none;
    transition: background 0.2s;
}

.wa-btn:hover {
    background: #1ea952;
    color: white;
}

.reset-btn {
    display: block;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid #E5E7EB;
    color: #6B7280;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #F3F4F6;
}

/* ============================================
   Chat Footer
============================================ */
.chat-popup-footer {
    padding: 12px;
    background: white;
    border-top: 1px solid #E5E7EB;
}

.send-form {
    display: flex;
    gap: 8px;
}

.send-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    font-size: 0.9rem;
}

.send-form input:focus {
    outline: none;
    border-color: #1B7A8C;
}

.send-form button {
    width: 42px;
    height: 42px;
    background: #1B7A8C;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-form button:hover {
    background: #156a7a;
}

.msg-count {
    text-align: center;
    font-size: 0.7rem;
    color: #9CA3AF;
    margin-top: 6px;
}

.footer-info {
    text-align: center;
    font-size: 0.8rem;
    color: #9CA3AF;
}

.wa-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: #25D366;
    color: white;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.wa-footer:hover {
    background: #1ea952;
    color: white;
}

/* ============================================
   Mobile Responsive
============================================ */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .chat-popup {
        width: calc(100vw - 30px);
        bottom: 70px;
    }
}
