/**
 * WhatsApp Chat Widget - CSS
 * GTAuto.pt
 */

:root {
    --whatsapp-green: #25D366;
    --whatsapp-dark: #128C7E;
}

/* Widget container - hidden by default, shown by JS on mobile */
#whatsapp-widget {
    display: none;
	font-family: sans-serif;
}

/* ==========================================
   FLOATING BUBBLE
   ========================================== */
.whatsapp-bubble {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 1050;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.whatsapp-bubble:hover {
    transform: scale(1.1);
}

.bubble-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    border: none;
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.6);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.8);
    }
}

.bubble-button i {
    font-size: 28px;
    color: white;
}

/* Online status badge */
.status-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #34B7F1;
    border: 2px solid #333;
    border-radius: 50%;
/*    animation: blink 2.2s infinite; */
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==========================================
   CHAT WINDOW
   ========================================== */
.chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    z-index: 1049;
    display: none;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-window.show {
    display: block;
}

/* ==========================================
   CHAT HEADER
   ========================================== */
.chat-header {
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark) 100%);
    color: white;
    padding: 16px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--whatsapp-green);
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.chat-status {
    font-size: 12px;
    opacity: 1;
    display: flex;
    align-items: center;
    gap: 1px;
    margin: 3px 0 0;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #34B7F1;
    border-radius: 50%;
    display: inline-block;
    animation: blink 2s infinite;
}

.close-chat {
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: normal;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.close-chat i.btn-close {
	padding: 0;
}

.close-chat:hover {
    opacity: 1;
}

/* ==========================================
   CHAT BODY
   ========================================== */
.chat-body {
    padding: 20px;
    background: #ece5dd;
    min-height: 180px;
}

.welcome-message {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.welcome-message::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid white;
}

.welcome-message p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #333;
}

.welcome-message p:last-child {
    margin-bottom: 0;
}

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

/* Business Hours - Muted */
.business-hours {
    background: rgba(255, 255, 255, 0.6);
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 12px;
}

.hours-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px 0;
    font-weight: 500;
}

.hours-text {
    font-size: 12px;
    color: #666;
    margin: 0 0 2px 0;
    line-height: 1.4;
}

.hours-text:last-child {
    margin-bottom: 0;
}

/* ==========================================
   MESSAGE FORM
   ========================================== */
.message-form {
    background: white;
    padding: 16px;
    border-radius: 0 0 16px 16px;
}

.message-textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.message-textarea:focus {
    outline: none;
    border-color: var(--whatsapp-green);
}

.message-textarea::placeholder {
    color: #999;
}

.char-counter {
    text-align: right;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.send-button {
    background: var(--whatsapp-green);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.send-button:hover:not(:disabled) {
    background: var(--whatsapp-dark);
}

.send-button:active:not(:disabled) {
    transform: scale(0.98);
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.send-button i {
    font-size: 16px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 576px) {
    .chat-window {
        bottom: 85px;
        right: 10px;
        width: calc(100vw - 20px);
    }

    .whatsapp-bubble {
        bottom: 15px;
        right: 15px;
    }

    .bubble-button {
        width: 56px;
        height: 56px;
    }

    .bubble-button i {
        font-size: 26px;
    }
}

/* ==========================================
   STATUS Online/Offline
   ========================================== */


.status-badge.offline {
  background:#E62020;
  animation: none;
}

.chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #6bcdf4; /* online */
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
  margin-top: 0;
  animation: blink 2s infinite;
}

.chat-status.offline {
  color: #eee;
  white-space: pre-line;
}

.chat-status.offline::before {
  background: #FF2400; 
  margin-top: -12px;
  animation: none;
}