/**
 * Float Popup - Online Support Widget Styles
 * Fixed position sidebar on left side of the page
 *
 * @package TnTComfy
 */

/* Float Popup Container */
.float-popup {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 140px; /* Giữ nguyên kích thước */
    max-height: 90vh;
    background: #33CC33; /* Green background như hình minh họa */
    color: #FFFFFF;
    z-index: 999;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    border-radius: 0 4px 4px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Ensure popup is visible on desktop by default */
@media (min-width: 769px) {
    .float-popup {
        transform: translateX(0) translateY(-50%);
    }
    
    /* Minimized state - hide popup content, show only toggle button */
    .float-popup.minimized {
        transform: translateX(-100%) translateY(-50%);
        opacity: 0;
        pointer-events: none;
    }
}

/* Header */
.float-popup-header {
    background: #28A745; /* Darker green */
    padding: 6px 8px; /* Giảm từ 12px 16px xuống 50% */
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Giảm từ 2px xuống 1px */
    position: relative;
}

.float-popup-title {
    font-size: 11.2px; /* 70% của 16px ban đầu */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.35px; /* 70% của 0.5px */
    margin: 0;
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    line-height: 1.3;
}

/* Minimize Button */
.float-popup-minimize {
    display: none; /* Hidden on mobile */
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s ease;
    padding: 0;
    align-items: center;
    justify-content: center;
}

@media (min-width: 769px) {
    .float-popup-minimize {
        display: flex;
    }
}

.float-popup-minimize:hover {
    background: rgba(0, 0, 0, 0.4);
}

.minimize-icon {
    display: block;
    line-height: 1;
    font-weight: 300;
}

/* Image Section */
.float-popup-image-section {
    background: #FFFFFF;
    padding: 8px; /* Giảm từ 16px xuống 50% */
}

.float-popup-image-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 6px; /* Giảm từ 12px xuống 50% */
}

.float-popup-image {
    width: 100%;
    height: auto;
    border-radius: 4px; /* Giảm từ 8px xuống 50% */
    display: block;
}

.float-popup-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: #F5F5F5;
    border-radius: 4px; /* Giảm từ 8px xuống 50% */
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-icon {
    font-size: 33.6px; /* 70% của 48px ban đầu */
}

/* Speech Bubble */
.float-popup-speech-bubble {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #FF5722; /* Accent color - Red */
    color: #FFFFFF;
    padding: 5.6px 8.4px; /* 70% của 8px 12px */
    border-radius: 8.4px; /* 70% của 12px */
    font-size: 8.4px; /* 70% của 12px ban đầu */
    font-weight: 600;
    box-shadow: 0 1.4px 5.6px rgba(0, 0, 0, 0.2); /* 70% của 2px 8px */
    max-width: 60%;
    z-index: 10;
}

.float-popup-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -3px; /* Giảm từ -6px xuống 50% */
    right: 10px; /* Giảm từ 20px xuống 50% */
    width: 0;
    height: 0;
    border-left: 3px solid transparent; /* Giảm từ 6px xuống 50% */
    border-right: 3px solid transparent; /* Giảm từ 6px xuống 50% */
    border-top: 3px solid #FF5722; /* Giảm từ 6px xuống 50% */
}

.speech-bubble-text {
    display: block;
    line-height: 1.2; /* Giảm từ 1.3 xuống */
}

/* Banner */
.float-popup-banner {
    background: #FF5722; /* Accent color - Red */
    padding: 5px 6px; /* Giảm từ 10px 12px xuống 50% */
    border-radius: 4px; /* Giảm từ 8px xuống 50% */
    text-align: center;
}

.float-popup-banner-text {
    font-size: 9.1px; /* 70% của 13px ban đầu */
    font-weight: 500;
    line-height: 1.35;
    margin: 0;
    color: #FFFFFF;
}

/* Contacts Section */
.float-popup-contacts {
    flex: 1;
    overflow-y: auto;
    background: #33CC33; /* Green background */
    padding: 4px 0; /* Giảm từ 8px xuống 50% */
}

.float-popup-contacts::-webkit-scrollbar {
    width: 4px;
}

.float-popup-contacts::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.float-popup-contacts::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.float-popup-contacts::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Contact Section */
.float-popup-contact-section {
    margin-bottom: 6px; /* Giảm từ 12px xuống 50% */
}

.float-popup-contact-section:last-child {
    margin-bottom: 0;
}

.contact-section-title {
    font-size: 9.8px; /* 70% của 14px ban đầu */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.35px; /* 70% của 0.5px */
    color: #FFFFFF;
    margin: 0;
    padding: 5px 8px 4px; /* Giữ nguyên padding */
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Inter', sans-serif;
    line-height: 1.3;
}

.float-popup-contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.float-popup-contact-item {
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.15); /* Giảm từ 1px xuống 50% */
}

.float-popup-contact-section .float-popup-contact-list .float-popup-contact-item:last-child {
    border-bottom: none;
}

.float-popup-contact-link {
    display: block;
    padding: 6px 8px; /* Giảm từ 12px 16px xuống 50% */
    color: #FFFFFF;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.float-popup-contact-link:hover,
.float-popup-contact-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    text-decoration: none;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 3px; /* Giảm từ 6px xuống 50% */
}

.contact-name {
    font-size: 9.8px; /* 70% của 14px ban đầu */
    font-weight: 600;
    display: block;
    line-height: 1.3;
}

.contact-phone-wrapper {
    display: flex;
    align-items: center;
    gap: 4px; /* Giữ nguyên */
}

.zalo-icon {
    font-size: 11.2px; /* 70% của 16px ban đầu */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px; /* Giữ nguyên */
    height: 10px; /* Giữ nguyên */
    flex-shrink: 0;
}

.contact-phone {
    font-size: 10.5px; /* 70% của 15px ban đầu */
    font-weight: 700;
    letter-spacing: 0.35px; /* 70% của 0.5px */
    line-height: 1.3;
}

/* Close Button */
.float-popup-close {
    display: none; /* Hidden on desktop */
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px; /* Giữ nguyên kích thước button */
    height: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 16.8px; /* 70% của 24px ban đầu */
    line-height: 1;
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.2s ease;
}

.float-popup-close:hover {
    background: rgba(0, 0, 0, 0.5);
}

.close-icon {
    display: block;
    line-height: 1;
}

/* Toggle Button (Mobile) */
.float-popup-toggle {
    display: none; /* Hidden on desktop by default */
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 25px; /* Giảm từ 50px xuống 50% */
    height: 40px; /* Giảm từ 80px xuống 50% */
    background: #33CC33;
    color: #FFFFFF;
    border: none;
    border-radius: 0 4px 4px 0; /* Giảm từ 8px xuống 4px */
    cursor: pointer;
    z-index: 998;
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15); /* Giảm từ 2px 8px xuống 50% */
    transition: all 0.3s ease;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px; /* Giảm từ 4px xuống 50% */
    padding: 4px 2px; /* Giảm từ 8px 4px xuống 50% */
}

/* Minimized Toggle Button (Desktop) */
.float-popup-minimized-toggle {
    display: none; /* Hidden by default */
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 40px;
    background: #33CC33;
    color: #FFFFFF;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    z-index: 999;
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
}

@media (min-width: 769px) {
    .float-popup-minimized-toggle.show {
        display: flex;
    }
}

.float-popup-minimized-toggle:hover {
    background: #28A745;
    width: 30px;
}

.minimized-toggle-icon {
    font-size: 16.8px; /* 70% của 24px ban đầu */
    display: block;
}

.minimized-toggle-text {
    font-size: 7.7px; /* 70% của 11px ban đầu */
    font-weight: 600;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.float-popup-toggle:hover {
    background: #28A745;
    width: 30px; /* Giảm từ 60px xuống 50% */
}

.toggle-icon {
    font-size: 16.8px; /* 70% của 24px ban đầu */
    display: block;
}

.toggle-text {
    font-size: 7.7px; /* 70% của 11px ban đầu */
    font-weight: 600;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .float-popup {
        width: 130px; /* Giảm từ 260px xuống 50% */
    }
}

@media (max-width: 768px) {
    /* Hide popup by default on mobile */
    .float-popup {
        transform: translateX(-100%) translateY(-50%);
        width: 140px; /* Giảm từ 280px xuống 50% */
        max-height: 85vh;
    }

    /* Show toggle button on mobile */
    .float-popup-toggle {
        display: flex !important;
    }

    /* Show close button when popup is open */
    .float-popup-close {
        display: block;
    }

    /* Show popup when active */
    .float-popup.active {
        transform: translateX(0) translateY(-50%);
    }
}

@media (max-width: 480px) {
    .float-popup {
        width: 100%;
        max-width: 160px; /* Giảm từ 320px xuống 50% */
        left: 0;
        top: 0;
        transform: translateX(-100%) translateY(0);
        max-height: 100vh;
        border-radius: 0;
    }

    .float-popup.active {
        transform: translateX(0) translateY(0);
    }

    .float-popup-toggle {
        width: 22.5px; /* Giảm từ 45px xuống 50% */
        height: 35px; /* Giảm từ 70px xuống 50% */
    }
}

/* Animation */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%) translateY(-50%);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(-50%);
        opacity: 1;
    }
}

.float-popup.active {
    animation: slideInLeft 0.3s ease-out;
}

/* Ensure main content doesn't overlap */
@media (min-width: 769px) {
    body:has(.float-popup) {
        padding-left: 0; /* Popup không che content */
    }
}

/* Accessibility */
.float-popup-contact-link:focus {
    outline: 2px solid #FFFFFF;
    outline-offset: -2px;
}

.float-popup-toggle:focus,
.float-popup-close:focus {
    outline: 2px solid #FFFFFF;
    outline-offset: 2px;
}
