/* Container cho tất cả widget */
.chat-widgets-container {
    position: fixed;
    bottom: 120px;
    right: 30px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Style chung cho tất cả widget */
.chat-widget {
    cursor: pointer;
}

.chat-widget img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.chat-widget a {
    outline: none;
    display: block;
}

.chat-widget img:hover,
.phone-call-trigger:hover .phone-call-svg,
.messenger-chat-widget a:hover .messenger-svg,
.zalo-chat-widget a:hover .zalo-svg {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Zalo icon dạng inline SVG */
.zalo-svg {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.zalo-svg svg {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Messenger icon dạng inline SVG */
.messenger-svg {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00B2FF, #006AFF);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.messenger-svg svg {
    width: 36px;
    height: 36px;
    pointer-events: none;
}

/* Phone icon dạng inline SVG — sync size/shadow/transition với 2 img kia */
.phone-call-svg {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.phone-call-svg svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    pointer-events: none;
}

.phone-call-trigger:hover .phone-call-svg {
    animation: pulse 1s ease-in-out;
}

.chat-widget img:active {
    background-color: transparent;
    outline: none;
}

/* Thứ tự hiển thị các widget */
.zalo-chat-widget {
    order: 1;
}

.messenger-chat-widget {
    order: 2;
}

.phone-call-widget {
    order: 3;
}

/* Phone Call Trigger */
.phone-call-trigger {
    display: block;
    cursor: pointer;
}

/* Hover animations — Zalo: wiggle, Messenger: swing. Keep scale(1.1) inside keyframes
   để không bị :hover transform ghi đè khi animation đang chạy. */
.zalo-chat-widget a:hover img,
.zalo-chat-widget a:hover .zalo-svg {
    animation: gcw-wiggle 0.5s ease-in-out;
}

.messenger-chat-widget a:hover img,
.messenger-chat-widget a:hover .messenger-svg {
    animation: gcw-swing 0.6s ease-out;
}

@keyframes gcw-wiggle {
    0%   { transform: scale(1)   rotate(0deg); }
    20%  { transform: scale(1.1) rotate(8deg); }
    50%  { transform: scale(1.1) rotate(-8deg); }
    75%  { transform: scale(1.1) rotate(6deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

@keyframes gcw-swing {
    0%   { transform: scale(1)    rotate(-10deg); }
    100% { transform: scale(1.1)  rotate(0deg); }
}

/* Phone Modal Styles */
.phone-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.phone-modal.show {
    display: block;
}

.phone-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.phone-modal-header {
    position: relative;
    padding: 15px 20px 0;
    text-align: right;
}

.phone-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.phone-modal-close:hover {
    color: #333;
}

.phone-modal-body {
    padding: 20px 30px 40px;
    text-align: center;
}

.phone-icon-container {
    margin-bottom: 25px;
}

.phone-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 50%;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.phone-icon {
    width: 40px;
    height: 40px;
    fill: white;
}

.phone-modal-title {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.phone-number {
    margin: 20px 0;
}

.phone-link {
    font-size: 28px;
    font-weight: bold;
    color: #4CAF50;
    text-decoration: none;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    transition: color 0.3s ease;
}

.phone-link:hover {
    color: #45a049;
}

.phone-modal-subtitle {
    color: #666;
    font-size: 16px;
    margin: 20px 0 30px 0;
    line-height: 1.5;
}

.phone-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.phone-modal-buttons .btn-call-now,
.phone-modal-buttons .btn-cancel {
    min-width: 140px;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.btn-call-now {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-call-now:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
    color: white;
    text-decoration: none;
}

.btn-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-cancel {
    background: transparent;
    color: #666;
    padding: 12px 25px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #333;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -30%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-widgets-container {
        bottom: 120px;
        right: 10px;
    }
    
    .chat-widget img,
    .phone-call-svg,
    .messenger-svg,
    .zalo-svg {
        width: 50px;
        height: 50px;
    }
    .phone-call-svg svg {
        width: 26px;
        height: 26px;
    }
    .messenger-svg svg {
        width: 33px;
        height: 33px;
    }
    
    .phone-modal-content {
        width: 95%;
        margin: 0px;
    }
    
    .phone-modal-body {
        padding: 15px 20px 30px;
    }
    
    .phone-modal-title {
        font-size: 20px;
    }
    
    .phone-link {
        font-size: 24px;
    }
    
    .phone-modal-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-call-now,
    .btn-cancel {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .phone-icon-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .phone-icon {
        width: 35px;
        height: 35px;
    }
    
    .phone-link {
        font-size: 22px;
        letter-spacing: 1px;
    }
}