/* ============================================
   CONTACT TOOLBAR - CLEAN & ORGANIZED CSS
   ============================================ */

/* --------------------------------------------
   BASE STYLES
   -------------------------------------------- */
.ct-contact-toolbar {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.ct-contact-toolbar img {
    display: block;
    vertical-align: middle;
    border: 0;
}

/* --------------------------------------------
   DESKTOP STYLES (≥768px)
   -------------------------------------------- */
@media (min-width: 768px) {
    
    /* Hide mobile elements on desktop */
    .ct-pc-only {
        display: inline-block;
    }
    
    .ct-list.mobile {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Container - fixed right side */
    .ct-contact-toolbar {
        position: fixed;
        top: 50%;
        right: 12px;
        transform: translateY(-50%);
        z-index: 2147483640;
        pointer-events: auto;
    }
    
    /* Desktop list - vertical stack */
    .ct-list.desktop {
        display: flex !important;
        flex-direction: column;
        gap: 18px;
        align-items: center;
        padding: 0;
        margin: 0;
    }
    
    /* Desktop item */
    .ct-list.desktop .ct-item {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0;
        width: auto;
        cursor: pointer;
    }
    
    /* Icon container */
    .ct-list.desktop .ct-item .ct-icon {
        width: 56px;
        height: 56px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 10px 30px rgba(6, 18, 42, 0.08);
        transition: transform 0.12s ease, box-shadow 0.12s ease;
        overflow: hidden;
        flex-shrink: 0;
    }
    
    .ct-list.desktop .ct-item .ct-icon img,
    .ct-list.desktop .ct-item .ct-icon svg {
        width: 36px;
        height: 36px;
        object-fit: contain;
        display: block;
    }
    
    /* Icon hover effect */
    .ct-list.desktop .ct-item:hover .ct-icon,
    .ct-list.desktop .ct-item:focus .ct-icon {
        transform: translateY(-3px);
        box-shadow: 0 14px 36px rgba(6, 18, 42, 0.12);
    }
    
    /* Text bubble - hidden by default */
    .ct-list.desktop .ct-item .ct-text {
        display: none !important;
        pointer-events: none !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 240px;
    }
    
    /* Text bubble - show on hover/focus */
    .ct-list.desktop .ct-item:hover .ct-text,
    .ct-list.desktop .ct-item:focus-within .ct-text,
    .ct-list.desktop .ct-item.focus .ct-text,
    .ct-list.desktop .ct-item.open .ct-text {
        display: block !important;
        pointer-events: auto !important;
        text-align: right !important;
        color: inherit !important;
    }
    
    /* Text bubble positioning */
    .ct-list.desktop .ct-item.open .ct-text,
    .ct-list.desktop .ct-item:hover .ct-text,
    .ct-list.desktop .ct-item:focus-within .ct-text {
        position: absolute !important;
        right: calc(100% + 12px) !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 2147483647 !important;
        background: transparent !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        max-width: 320px !important;
        white-space: nowrap;
    }
    
    /* Label & number structure */
    .ct-list.desktop .ct-item .ct-text .ct-label,
    .ct-list.desktop .ct-item .ct-text .ct-number {
        display: block;
        margin: 0;
        padding: 0;
        line-height: 1.1;
    }
    
    /* Default label style */
    .ct-list.desktop .ct-item .ct-text .ct-label {
        font-size: 15px;
        font-weight: 600;
        color: #1A73E8;
        text-align: right;
    }
    
    /* Number style (hidden by default) */
    .ct-list.desktop .ct-item .ct-text .ct-number {
        font-size: 20px;
        font-weight: 700;
        color: #1A73E8;
        text-align: right;
        display: none;
    }
    
    /* Phone with number - two lines */
    .ct-list.desktop .ct-item.has-number .ct-text .ct-label {
        color: #555 !important;
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 4px;
    }
    
    .ct-list.desktop .ct-item.has-number .ct-text .ct-number {
        display: block;
    }
    
    /* Chat items (Zalo/Messenger) - single line */
    .ct-list.desktop .ct-item.ct-zalo .ct-text,
    .ct-list.desktop .ct-item.ct-mess .ct-text {
        white-space: nowrap !important;
        max-width: 220px;
    }
    
    .ct-list.desktop .ct-item.ct-zalo .ct-text .ct-label,
    .ct-list.desktop .ct-item.ct-mess .ct-text .ct-label {
        color: #1A73E8 !important;
        font-size: 15px;
        font-weight: 600;
    }
    
    .ct-list.desktop a.ct-item.ct-zalo.open .ct-text,
    .ct-list.desktop a.ct-item.ct-mess.open .ct-text,
    .ct-list.desktop a.ct-item.ct-zalo:hover .ct-text,
    .ct-list.desktop a.ct-item.ct-mess:hover .ct-text {
        color: #1A73E8 !important;
        font-weight: 600;
    }
    
    /* Wide screen adjustments */
    @media (min-width: 1200px) {
        .ct-list.desktop .ct-item.open .ct-text,
        .ct-list.desktop .ct-item:hover .ct-text {
            right: calc(100% + 16px) !important;
            max-width: 380px !important;
        }
    }
}

/* --------------------------------------------
   MOBILE STYLES (<768px)
   -------------------------------------------- */
@media (max-width: 767px) {
    
    /* Hide desktop elements on mobile */
    .ct-pc-only {
        display: none !important;
    }
    
    .ct-list.desktop {
        display: none !important;
    }
    
    /* Mobile container - fixed bottom bar */
    .ct-list.mobile {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120000;
        background: #fff;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        padding: 8px 12px;
        gap: 8px;
        align-items: center;
        justify-content: space-around;
        box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
    }
    
    /* Mobile item - default layout */
    .ct-list.mobile .ct-item {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 12px;
        text-decoration: none;
        flex: 1;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fff;
        cursor: pointer;
        transition: all 0.2s;
        min-height: 56px;
    }
    
    .ct-list.mobile .ct-item:hover {
        border-color: #ccc;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }
    
    /* Icon container */
    .ct-list.mobile .ct-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .ct-list.mobile .ct-icon img,
    .ct-list.mobile .ct-icon svg {
        max-width: 32px;
        max-height: 32px;
        object-fit: contain;
    }
    
    /* Text wrapper */
    .ct-list.mobile .ct-text-wrap {
        display: flex;
        flex-direction: column;
        text-align: center;
        line-height: 1.3;
    }
    
    /* Main label */
    .ct-list.mobile .ct-label {
        font-size: 13px;
        font-weight: 600;
        color: #333;
        white-space: nowrap;
    }
    
    /* Sub label */
    .ct-list.mobile .ct-sub-label {
        font-size: 10px;
        color: #666;
        font-weight: 400;
        white-space: nowrap;
        margin-top: 2px;
    }
    
    /* Button colors - Phone */
    .ct-list.mobile .ct-phone {
        background: #e3f2fd;
        border-color: #90caf9;
    }
    
    /* Button colors - Zalo */
    .ct-list.mobile .ct-zalo {
        background: #0068FF;
        border-color: #0052CC;
    }
    
    .ct-list.mobile .ct-zalo .ct-label {
        color: #fff;
    }
    
    /* Button colors - Messenger */
    .ct-list.mobile .ct-mess {
        background: #FFE1ED;
        border-color: #E1BEE7;
    }
    
    .ct-list.mobile .ct-mess .ct-label {
        color: #6a1b9a;
    }
       
    .ct-list.mobile .ct-buy-btn .ct-label,
    .ct-list.mobile .ct-buy-btn .ct-sub-label {
        color: #fff;
    }
    
    .ct-list.mobile .ct-buy-btn .ct-icon svg {
        fill: #fff;
    }
    
    /* Responsive - Small screens */
    @media (max-width: 380px) {
        .ct-list.mobile {
            gap: 6px;
            padding: 8px;
        }
        
        .ct-list.mobile .ct-item {
            padding: 8px 10px;
            gap: 6px;
            min-height: 50px;
        }
        
        .ct-list.mobile .ct-icon {
            width: 32px;
            height: 32px;
        }
        
        .ct-list.mobile .ct-icon img,
        .ct-list.mobile .ct-icon svg {
            max-width: 28px;
            max-height: 28px;
        }
        
        .ct-list.mobile .ct-label {
            font-size: 12px;
        }
        
        .ct-list.mobile .ct-sub-label {
            font-size: 9px;
        }
    }
    
    /* Responsive - Very small screens (icon only) */
    @media (max-width: 320px) {
        .ct-list.mobile .ct-text-wrap {
            display: none;
        }
        
        .ct-list.mobile .ct-item {
            justify-content: center;
            padding: 12px 8px;
        }
    }
}

/* ============================================
   SINGLE PRODUCT PAGE CUSTOMIZATION
   ============================================ */
@media (max-width: 767px) {
    
    /* Container styling */
    .single-product .ct-list.mobile {
        background: #f5f5f5;
        padding: 12px 10px;
        gap: 10px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    }
    
    /* Hide Messenger on product page */
    .single-product .ct-list.mobile .ct-mess {
        display: none !important;
    }
    
    /* Ensure equal height for all buttons */
    .single-product .ct-list.mobile .ct-item {
        flex: 0 0 auto;
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Zalo - icon only with blue border, no background */
    .single-product .ct-list.mobile .ct-zalo {
        flex: 1 1 auto;
        min-width: 60px;
        max-width: 80px;
        padding: 0;
        background: transparent !important;
        border: 1px solid #0068FF !important;
        border-radius: 8px;
        justify-content: center;
        align-items: center;
    }
    
    .single-product .ct-list.mobile .ct-zalo .ct-icon {
        width: 40px;
        height: 40px;
    }
    
    .single-product .ct-list.mobile .ct-zalo .ct-icon img {
        max-width: 36px;
        max-height: 36px;
    }
    
    /* Hide all Zalo text */
    .single-product .ct-list.mobile .ct-zalo .ct-text-wrap,
    .single-product .ct-list.mobile .ct-zalo .ct-label,
    .single-product .ct-list.mobile .ct-zalo .ct-sub-label {
        display: none !important;
    }
    
    /* Phone - 41% width */
    .single-product .ct-list.mobile .ct-phone {
        flex: 0 0 40%;
        padding: 10px 12px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    .single-product .ct-list.mobile .ct-phone .ct-icon {
        width: 36px;
        height: 36px;
    }
    
    .single-product .ct-list.mobile .ct-phone .ct-label {
        color: #fff;
        font-size: 13px;
        font-weight: 600;
    }
    
    .single-product .ct-list.mobile .ct-phone .ct-sub-label {
        color: rgba(255, 255, 255, 0.9);
        font-size: 10px;
    }
    
    /* Buy button - 41% width (equal to Phone) */
    .single-product .ct-list.mobile .ct-buy-btn {
        flex: 0 0 40%;
        background: #FF2E2E;
        padding: 10px 12px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    .single-product .ct-list.mobile .ct-buy-btn .ct-icon {
        width: 36px;
        height: 36px;
    }
    
    .single-product .ct-list.mobile .ct-buy-btn:hover {
        background: linear-gradient(135deg, #FF5722 0%, #FF3D00 100%);
        box-shadow: 0 6px 16px rgba(255, 87, 34, 0.4);
        transform: translateY(-1px);
    }
    
    .single-product .ct-list.mobile .ct-buy-btn .ct-label {
        color: #fff;
        font-size: 15px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    
    .single-product .ct-list.mobile .ct-buy-btn .ct-sub-label {
        color: #fff;
        font-size: 10px;
        font-weight: 400;
    }
    
    .single-product .ct-list.mobile .ct-buy-btn .ct-icon {
        width: 38px;
        height: 38px;
    }
    
    .single-product .ct-list.mobile .ct-buy-btn .ct-icon img,
    .single-product .ct-list.mobile .ct-buy-btn .ct-icon svg {
        max-width: 32px;
        max-height: 32px;
    }
    
    .single-product .ct-list.mobile .ct-buy-btn .ct-text-wrap {
        display: flex;
        flex-direction: column;
        text-align: left;
    }
    
    /* Product page - Small screens */
    @media (max-width: 380px) {
        .single-product .ct-list.mobile .ct-zalo {
            flex: 0 0 60px;
            min-width: 60px;
            padding: 0;
        }
        
        .single-product .ct-list.mobile .ct-phone {
            flex: 0 0 35%;
            padding: 8px 10px;
        }
        
        .single-product .ct-list.mobile .ct-buy-btn {
            flex: 1 1 auto;
            padding: 10px 12px;
        }
        
        .single-product .ct-list.mobile .ct-buy-btn .ct-label {
            font-size: 13px;
        }
    }
    
    /* Product page - Very small screens */
    @media (max-width: 320px) {
        .single-product .ct-list.mobile .ct-zalo {
            flex: 0 0 50px;
            min-width: 50px;
        }
        
        .single-product .ct-list.mobile .ct-phone .ct-sub-label,
        .single-product .ct-list.mobile .ct-buy-btn .ct-sub-label {
            display: none;
        }
    }
}
/* ========= CHIA 3 NÚT MOBILE 32% ========= */
@media (max-width: 767px) {
  /* Áp dụng cho 3 nút chính (Zalo, Phone, Messenger / Buy nếu dùng) */
  .ct-list.mobile .ct-zalo,
  .ct-list.mobile .ct-phone,
  .ct-list.mobile .ct-mess,
  .ct-list.mobile .ct-buy-btn {
    flex: 0 0 32%;
    max-width: 32%;
    box-sizing: border-box;
  }

  /* Bảo đảm nội dung trong nút căn giữa đẹp */
  .ct-list.mobile .ct-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    gap: 6px;
  }

  /* Giữ icon & text không bị chạm mép */
  .ct-list.mobile .ct-icon {
    flex-shrink: 0;
  }

  /* Nếu bạn từng có quy tắc .single-product .ct-list.mobile .ct-mess { display: none; }
     và bạn muốn hiển thị Messenger ở trang sản phẩm, hãy xóa hoặc override nó: */
  .single-product .ct-list.mobile .ct-mess {
    display: flex !important;
  }

  /* Trường hợp màn hình rất nhỏ: giảm chút kích thước để không bị tràn */
  @media (max-width: 380px) {
    .ct-list.mobile .ct-zalo,
    .ct-list.mobile .ct-phone,
    .ct-list.mobile .ct-mess,
    .ct-list.mobile .ct-buy-btn {
      flex: 0 0 30%;
      max-width: 30%;
    }
    .ct-list.mobile {
      padding-left: 8px;
      padding-right: 8px;
      gap: 6px;
    }
  }
}
