/**
 * ChatWtsapp - Widget CSS
 * 
 * @package ChatWtsapp
 * @version 3.1.0
 */

/* ===========================================
   VARIÁVEIS
=========================================== */
:root {
    --chatwtsapp-primary: #25D366;
    --chatwtsapp-button-size: 60px;
    --chatwtsapp-shadow: 0 4px 15px rgba(0,0,0,0.2);
    --chatwtsapp-z-index: 999999;
}

/* ===========================================
   WIDGET CONTAINER
=========================================== */
.chatwtsapp-widget {
    position: fixed;
    z-index: var(--chatwtsapp-z-index);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Posições */
.chatwtsapp-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatwtsapp-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* ===========================================
   BOTÃO FLUTUANTE
=========================================== */
.chatwtsapp-button {
    width: var(--chatwtsapp-button-size);
    height: var(--chatwtsapp-button-size);
    border-radius: 50%;
    border: none;
    background: var(--chatwtsapp-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chatwtsapp-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.chatwtsapp-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.chatwtsapp-button:active {
    transform: scale(0.95);
}

.chatwtsapp-button svg {
    width: 60%;
    height: 60%;
    transition: all 0.3s;
}

.chatwtsapp-icon-close {
    position: absolute;
}

/* Animações do Botão */
.chatwtsapp-button.animation-bounce {
    animation: chatwtsapp-bounce 2s infinite;
}

.chatwtsapp-button.animation-pulse {
    animation: chatwtsapp-pulse 2s infinite;
}

.chatwtsapp-button.animation-shake {
    animation: chatwtsapp-shake 2s infinite;
}

@keyframes chatwtsapp-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes chatwtsapp-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@keyframes chatwtsapp-shake {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-5deg); }
    20%, 40% { transform: rotate(5deg); }
    50% { transform: rotate(0deg); }
}

/* Remove animação quando card está aberto */
.chatwtsapp-widget.is-open .chatwtsapp-button {
    animation: none;
}

/* ===========================================
   CARD DE DEPARTAMENTOS
=========================================== */
.chatwtsapp-card {
    position: absolute;
    bottom: calc(var(--chatwtsapp-button-size) + 15px);
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

/* Posicionamento do Card */
.chatwtsapp-widget.position-bottom-right .chatwtsapp-card {
    right: 0;
}

.chatwtsapp-widget.position-bottom-left .chatwtsapp-card {
    left: 0;
}

/* Card Aberto */
.chatwtsapp-widget.is-open .chatwtsapp-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ===========================================
   CARD HEADER
=========================================== */
.chatwtsapp-card-header {
    background: var(--chatwtsapp-primary);
    color: white;
    padding: 20px;
    position: relative;
}

.chatwtsapp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatwtsapp-close:hover {
    background: rgba(255,255,255,0.3);
}

.chatwtsapp-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chatwtsapp-header-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatwtsapp-header-text h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.chatwtsapp-header-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.chatwtsapp-response-time {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===========================================
   CARD BODY - DEPARTAMENTOS
=========================================== */
.chatwtsapp-card-body {
    max-height: 300px;
    overflow-y: auto;
}

.chatwtsapp-department-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
    gap: 12px;
}

.chatwtsapp-department-item:last-child {
    border-bottom: none;
}

.chatwtsapp-department-item:hover {
    background: #f8f9fa;
}

.chatwtsapp-department-item .dept-icon {
    width: 45px;
    height: 45px;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chatwtsapp-department-item .dept-info {
    flex: 1;
    min-width: 0;
}

.chatwtsapp-department-item .dept-info h4 {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.chatwtsapp-department-item .dept-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatwtsapp-department-item .dept-arrow {
    color: #25D366;
    font-size: 22px;
    transition: transform 0.2s;
}

.chatwtsapp-department-item:hover .dept-arrow {
    transform: translateX(3px);
}

/* ===========================================
   CARD FOOTER
=========================================== */
.chatwtsapp-card-footer {
    padding: 10px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #f0f0f0;
}

.chatwtsapp-card-footer small {
    font-size: 11px;
    color: #999;
}

.chatwtsapp-card-footer a {
    color: var(--chatwtsapp-primary);
    text-decoration: none;
}

/* ===========================================
   SCROLLBAR CUSTOMIZADA
=========================================== */
.chatwtsapp-card-body::-webkit-scrollbar {
    width: 6px;
}

.chatwtsapp-card-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatwtsapp-card-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chatwtsapp-card-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ===========================================
   MOBILE
=========================================== */
@media (max-width: 480px) {
    .chatwtsapp-widget {
        bottom: 15px !important;
        right: 15px !important;
        left: auto !important;
    }
    
    .chatwtsapp-card {
        width: calc(100vw - 30px);
        right: 0 !important;
        left: auto !important;
        max-width: 350px;
    }
    
    .chatwtsapp-button {
        width: 55px;
        height: 55px;
    }
}

/* ===========================================
   ACESSIBILIDADE
=========================================== */
.chatwtsapp-button:focus,
.chatwtsapp-close:focus,
.chatwtsapp-department-item:focus {
    outline: 2px solid var(--chatwtsapp-primary);
    outline-offset: 2px;
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chatwtsapp-button,
    .chatwtsapp-card,
    .chatwtsapp-department-item {
        animation: none;
        transition: none;
    }
}

/* ===========================================
   PRINT - ESCONDE
=========================================== */
@media print {
    .chatwtsapp-widget {
        display: none !important;
    }
}
